diff options
author | Tapani Pälli <[email protected]> | 2015-01-19 12:28:17 +0200 |
---|---|---|
committer | Tapani Pälli <[email protected]> | 2015-01-22 07:54:19 +0200 |
commit | adc8cdfa351240f1ce28b677e1be79a30a36b594 (patch) | |
tree | 797d4dc739d6be43b19792743391607fd26a840f /src/glsl | |
parent | 28b7c6b28523f9a6786441bb0b86bf143b8a9b7c (diff) |
glsl: do not allow interface block to have name already taken
Fixes currently failing Piglit case
interface-blocks-name-reused-globally.vert
v2: combine var declaration with assignment (Ian)
Signed-off-by: Tapani Pälli <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/ast_to_hir.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 811a9557df9..1ba29f7a943 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -5443,9 +5443,23 @@ ast_interface_block::hir(exec_list *instructions, state->struct_specifier_depth--; - if (!redeclaring_per_vertex) + if (!redeclaring_per_vertex) { validate_identifier(this->block_name, loc, state); + /* From section 4.3.9 ("Interface Blocks") of the GLSL 4.50 spec: + * + * "Block names have no other use within a shader beyond interface + * matching; it is a compile-time error to use a block name at global + * scope for anything other than as a block name." + */ + ir_variable *var = state->symbols->get_variable(this->block_name); + if (var && !var->type->is_interface()) { + _mesa_glsl_error(&loc, state, "Block name `%s' is " + "already used in the scope.", + this->block_name); + } + } + const glsl_type *earlier_per_vertex = NULL; if (redeclaring_per_vertex) { /* Find the previous declaration of gl_PerVertex. If we're redeclaring |