glsl: build stageref mask using IR, not symbol table
authorTapani Pälli <tapani.palli@intel.com>
Mon, 29 Jun 2015 11:19:00 +0000 (14:19 +0300)
committerTapani Pälli <tapani.palli@intel.com>
Wed, 1 Jul 2015 11:40:34 +0000 (14:40 +0300)
Instead of using symbol table, build mask by inspecting IR. This
change is required by further patches to move resource list creation
to happen later when symbol table does not exist anymore.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
src/glsl/linker.cpp

index 74c2f2d4c92fbab6ef5e01793df814ee2fe62d73..d9527d4ba2b6f142dbf8d3fab35a00e5ba32c881 100644 (file)
@@ -2624,9 +2624,17 @@ build_stageref(struct gl_shader_program *shProg, const char *name)
       struct gl_shader *sh = shProg->_LinkedShaders[i];
       if (!sh)
          continue;
-      ir_variable *var = sh->symbols->get_variable(name);
-      if (var)
-         stages |= (1 << i);
+
+      /* Shader symbol table may contain variables that have
+       * been optimized away. Search IR for the variable instead.
+       */
+      foreach_in_list(ir_instruction, node, sh->ir) {
+         ir_variable *var = node->as_variable();
+         if (var && strcmp(var->name, name) == 0) {
+            stages |= (1 << i);
+            break;
+         }
+      }
    }
    return stages;
 }