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 <kenneth@whitecape.org>
This commit is contained in:
Eric Anholt
2012-03-29 17:02:15 -07:00
parent cc7e0de009
commit f2475ca424
3 changed files with 33 additions and 13 deletions

View File

@@ -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;
}
}