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

Fixes piglit test
spec/glsl-1.50/compiler/interface-block-instance-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 1d7539d56fe74130223f12ca429575db066b2bdf..1a5df71201d6e3b9175b4401589922eac1e24f54 100644 (file)
@@ -4692,6 +4692,9 @@ ast_interface_block::hir(exec_list *instructions,
     *     field selector ( . ) operator (analogously to structures)."
     */
    if (this->instance_name) {
+      if (!redeclaring_per_vertex)
+         validate_identifier(this->instance_name, loc, state);
+
       ir_variable *var;
 
       if (this->is_array) {