diff options
author | marha <marha@users.sourceforge.net> | 2011-01-13 22:01:27 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-01-13 22:01:27 +0000 |
commit | a0a46bd55d7cbbf70757a29c067e21b70ac4e2df (patch) | |
tree | 95803181a66e63d191b3fe06a031f9ed8ae701b8 /mesalib/src/glsl/ast_to_hir.cpp | |
parent | 2ebdcfeee38bed8c65daa78aa7d18d8d1d93ed85 (diff) | |
download | vcxsrv-a0a46bd55d7cbbf70757a29c067e21b70ac4e2df.tar.gz vcxsrv-a0a46bd55d7cbbf70757a29c067e21b70ac4e2df.tar.bz2 vcxsrv-a0a46bd55d7cbbf70757a29c067e21b70ac4e2df.zip |
mesalib pixman xkbcomp git update 13 jan 2011
Diffstat (limited to 'mesalib/src/glsl/ast_to_hir.cpp')
-rw-r--r-- | mesalib/src/glsl/ast_to_hir.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp index 74a3d4775..ef209d078 100644 --- a/mesalib/src/glsl/ast_to_hir.cpp +++ b/mesalib/src/glsl/ast_to_hir.cpp @@ -1623,6 +1623,7 @@ ast_expression::hir(exec_list *instructions, result = new(ctx) ir_dereference_variable(var);
if (var != NULL) {
+ var->used = true;
type = result->type;
} else {
_mesa_glsl_error(& loc, state, "`%s' undeclared",
@@ -1797,8 +1798,16 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, struct _mesa_glsl_parse_state *state,
YYLTYPE *loc)
{
- if (qual->flags.q.invariant)
- var->invariant = 1;
+ if (qual->flags.q.invariant) {
+ if (var->used) {
+ _mesa_glsl_error(loc, state,
+ "variable `%s' may not be redeclared "
+ "`invariant' after being used",
+ var->name);
+ } else {
+ var->invariant = 1;
+ }
+ }
/* FINISHME: Mark 'in' variables at global scope as read-only. */
if (qual->flags.q.constant || qual->flags.q.attribute
@@ -2005,6 +2014,11 @@ ast_declarator_list::hir(exec_list *instructions, _mesa_glsl_error(& loc, state,
"`%s' cannot be marked invariant, fragment shader "
"inputs only\n", decl->identifier);
+ } else if (earlier->used) {
+ _mesa_glsl_error(& loc, state,
+ "variable `%s' may not be redeclared "
+ "`invariant' after being used",
+ earlier->name);
} else {
earlier->invariant = true;
}
|