[Mesa-dev] [PATCH 07/19] glsl: Don't allow unnamed interface blocks to redeclare variables.
Paul Berry
stereotype441 at gmail.com
Wed Oct 2 17:45:20 PDT 2013
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.
---
src/glsl/ast_to_hir.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index f4f81e0..3615587 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.
--
1.8.4
More information about the mesa-dev
mailing list