summaryrefslogtreecommitdiffstats
path: root/src/glsl/ast_function.cpp
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2012-03-29 17:02:15 -0700
committerEric Anholt <[email protected]>2012-04-19 16:33:36 -0700
commitf2475ca424f7e001be50f64dafa5700f6603d684 (patch)
tree432e0d9c8da042785c8fb6de1aa70a2eeed89eae /src/glsl/ast_function.cpp
parentcc7e0de009a0ab528fe950b17fa465a0a97988fc (diff)
glsl: Track in each ir_variable whether it was ever assigned.
This will be used for some compile-and-link-time error checking, where currently we've been doing error checking only at link time. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/ast_function.cpp')
-rw-r--r--src/glsl/ast_function.cpp29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp
index 39401017b81..8bf0ba2a876 100644
--- a/src/glsl/ast_function.cpp
+++ b/src/glsl/ast_function.cpp
@@ -152,19 +152,22 @@ verify_parameter_modes(_mesa_glsl_parse_state *state,
return false;
}
- if (actual->variable_referenced()
- && actual->variable_referenced()->read_only) {
- _mesa_glsl_error(&loc, state,
- "function parameter '%s %s' references the "
- "read-only variable '%s'",
- mode, formal->name,
- actual->variable_referenced()->name);
- return false;
- } else if (!actual->is_lvalue()) {
- _mesa_glsl_error(&loc, state,
- "function parameter '%s %s' is not an lvalue",
- mode, formal->name);
- return false;
+ ir_variable *var = actual->variable_referenced();
+ if (var) {
+ if (var->read_only) {
+ _mesa_glsl_error(&loc, state,
+ "function parameter '%s %s' references the "
+ "read-only variable '%s'",
+ mode, formal->name,
+ actual->variable_referenced()->name);
+ return false;
+ } else if (!actual->is_lvalue()) {
+ _mesa_glsl_error(&loc, state,
+ "function parameter '%s %s' is not an lvalue",
+ mode, formal->name);
+ return false;
+ }
+ var->assigned = true;
}
}