glsl: Don't allow invalid identifiers as interface block names.
authorPaul Berry <stereotype441@gmail.com>
Sat, 28 Sep 2013 00:35:27 +0000 (17:35 -0700)
committerPaul Berry <stereotype441@gmail.com>
Thu, 10 Oct 2013 21:27:10 +0000 (14:27 -0700)
Note: we need to make an exception for the gl_PerVertex interface
block, since this is allowed to be redeclared.  Future patches will
make redeclaration of gl_PerVertex work properly.

Fixes piglit test
spec/glsl-1.50/compiler/interface-block-name-uses-gl-prefix.vert.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/ast_to_hir.cpp

index c06a2a9c69aa56df819d3e0cb12e7e053250d686..ab5a78dc9f14364ba848b8139cb7abe3934b34c7 100644 (file)
@@ -4614,6 +4614,7 @@ ast_interface_block::hir(exec_list *instructions,
       packing = GLSL_INTERFACE_PACKING_STD140;
    }
 
+   bool redeclaring_per_vertex = strcmp(this->block_name, "gl_PerVertex") == 0;
    bool block_row_major = this->layout.flags.q.row_major;
    exec_list declared_variables;
    glsl_struct_field *fields;
@@ -4643,6 +4644,9 @@ ast_interface_block::hir(exec_list *instructions,
       assert(!"interface block layout qualifier not found!");
    }
 
+   if (!redeclaring_per_vertex)
+      validate_identifier(this->block_name, loc, state);
+
    const glsl_type *block_type =
       glsl_type::get_interface_instance(fields,
                                         num_variables,