glsl: mark special built-in inputs referenced by vertex stage
authorTapani Pälli <tapani.palli@intel.com>
Thu, 30 Apr 2015 06:27:00 +0000 (09:27 +0300)
committerTapani Pälli <tapani.palli@intel.com>
Wed, 6 May 2015 08:10:51 +0000 (11:10 +0300)
Refactoring done on active attribute queries did not take in to
account special built-in inputs for the vertex stage. This commit
sets them referenced by vertex stage so that they get enumerated
properly.

Fixes Piglit test 'get-active-attrib-returns-all-inputs' failure.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90243
Acked-by: Jose Fonseca <jfonseca@vmware.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-By: Martin Peres <martin.peres@linux.intel.com>
src/glsl/linker.cpp

index 330fae004b3b7898d6ec53971deb3a5eeace3176..52a277eb719d8a2de43fcba0c9c062d5084b51b0 100644 (file)
@@ -2558,6 +2558,7 @@ add_interface_variables(struct gl_shader_program *shProg,
 {
    foreach_in_list(ir_instruction, node, sh->ir) {
       ir_variable *var = node->as_variable();
+      uint8_t mask = 0;
 
       if (!var)
          continue;
@@ -2573,6 +2574,10 @@ add_interface_variables(struct gl_shader_program *shProg,
              var->data.location != SYSTEM_VALUE_VERTEX_ID_ZERO_BASE &&
              var->data.location != SYSTEM_VALUE_INSTANCE_ID)
             continue;
+         /* Mark special built-in inputs referenced by the vertex stage so
+          * that they are considered active by the shader queries.
+          */
+         mask = (1 << (MESA_SHADER_VERTEX));
          /* FALLTHROUGH */
       case ir_var_shader_in:
          if (programInterface != GL_PROGRAM_INPUT)
@@ -2587,7 +2592,7 @@ add_interface_variables(struct gl_shader_program *shProg,
       };
 
       if (!add_program_resource(shProg, programInterface, var,
-                                build_stageref(shProg, var->name)))
+                                build_stageref(shProg, var->name) | mask))
          return false;
    }
    return true;