summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Berry <[email protected]>2013-09-27 14:18:09 -0700
committerPaul Berry <[email protected]>2013-10-10 14:27:08 -0700
commit9bb60a155fbbee70113c8742e3157a371ac8c586 (patch)
tree642e0e122f9075cf607561ff29a75c17a9940083 /src
parent1838df97a28cf859f20d6535c00509574b200152 (diff)
glsl: Don't allow unnamed interface blocks to redeclare variables.
Note: some limited amount of redeclaration is actually allowed, provided the shader is redeclaring the built-in gl_PerVertex interface block. Support for this will be added in future patches. Fixes piglit tests spec/glsl-1.50/compiler/unnamed-interface-block-elem-conflicts-with-prev-{block-elem,global}.vert. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/glsl/ast_to_hir.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 90401adaafe..c06a2a9c69a 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -4742,6 +4742,9 @@ ast_interface_block::hir(exec_list *instructions,
var_mode);
var->init_interface_type(block_type);
+ if (state->symbols->get_variable(var->name) != NULL)
+ _mesa_glsl_error(&loc, state, "`%s' redeclared", var->name);
+
/* Propagate the "binding" keyword into this UBO's fields;
* the UBO declaration itself doesn't get an ir_variable unless it
* has an instance name. This is ugly.