glsl/ir: add param index to variable.
authorDave Airlie <airlied@redhat.com>
Mon, 8 Feb 2016 01:09:29 +0000 (11:09 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 9 Feb 2016 00:52:08 +0000 (10:52 +1000)
We have a requirement to store the index into the mesa parameterlist
for uniforms. Up until now we've overwritten var->data.location with
this info. However this then stops us accessing UniformStorage,
which is needed to do proper dereferencing.

Add a new variable to ir_variable to store this value in, and change
the two uses to use it correctly.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/compiler/glsl/ir.h
src/mesa/program/ir_to_mesa.cpp
src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index 09e21b221885632f3d1e20ec8c9ede9cbd00bf2e..bf9b7caffaed471d63e96690fbed35d4240b193c 100644 (file)
@@ -863,6 +863,14 @@ public:
        */
       int location;
 
+      /**
+       * for glsl->tgsi/mesa IR we need to store the index into the
+       * parameters for uniforms, initially the code overloaded location
+       * but this causes problems with indirect samplers and AoA.
+       * This is assigned in _mesa_generate_parameters_list_for_uniforms.
+       */
+      int param_index;
+
       /**
        * Vertex stream output identifier.
        */
index 768d9216483c3a73d4d596e4686d244610e91f62..68cc4a5e0cd02fffe98a34050e6faaa72288e1e3 100644 (file)
@@ -1389,7 +1389,7 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir)
       switch (var->data.mode) {
       case ir_var_uniform:
         entry = new(mem_ctx) variable_storage(var, PROGRAM_UNIFORM,
-                                              var->data.location);
+                                              var->data.param_index);
         this->variables.push_tail(entry);
         break;
       case ir_var_shader_in:
@@ -2268,8 +2268,7 @@ public:
    {
       this->idx = -1;
       this->program_resource_visitor::process(var);
-
-      var->data.location = this->idx;
+      var->data.param_index = this->idx;
    }
 
 private:
index b8182de0be8b6bae7636d13457c7c6d121d675db..4b5f2a3fc578924f003e044491a377c14312c16c 100644 (file)
@@ -2350,7 +2350,7 @@ glsl_to_tgsi_visitor::visit(ir_dereference_variable *ir)
       switch (var->data.mode) {
       case ir_var_uniform:
          entry = new(mem_ctx) variable_storage(var, PROGRAM_UNIFORM,
-                                               var->data.location);
+                                               var->data.param_index);
          this->variables.push_tail(entry);
          break;
       case ir_var_shader_in: