diff options
author | Chris Forbes <[email protected]> | 2014-04-27 16:03:55 +1200 |
---|---|---|
committer | Chris Forbes <[email protected]> | 2014-06-04 18:56:08 +1200 |
commit | d0495c6db8406131888cc263aa53ecd3e8b3ea6d (patch) | |
tree | 9ec4ba246a71b8aa2e3f502dd07d2381b6091632 /src | |
parent | 5ecffe5a3a41cac5fe28d8136095a0c2acf385a8 (diff) |
glsl: Disallow `precise` redeclarations of vars from outer scopes
Signed-off-by: Chris Forbes <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/glsl/ast_to_hir.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index a57ce5058e1..e1f95081378 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -3187,6 +3187,15 @@ ast_declarator_list::hir(exec_list *instructions, _mesa_glsl_error(& loc, state, "undeclared variable `%s' cannot be marked " "precise", decl->identifier); + } else if (state->current_function != NULL && + !state->symbols->name_declared_this_scope(decl->identifier)) { + /* Note: we have to check if we're in a function, since + * builtins are treated as having come from another scope. + */ + _mesa_glsl_error(& loc, state, + "variable `%s' from an outer scope may not be " + "redeclared `precise' in this scope", + earlier->name); } else if (earlier->data.used) { _mesa_glsl_error(& loc, state, "variable `%s' may not be redeclared " |