i965/vec4_nir: Get rid of the uniform_driver_location tracking
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 18 Aug 2015 18:42:02 +0000 (11:42 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 25 Aug 2015 17:18:27 +0000 (10:18 -0700)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_vec4.h
src/mesa/drivers/dri/i965/brw_vec4_nir.cpp

index 59a8397736004c6302a51a6fb88bc838157009f0..673a29e4b7f57c1bac195b72b322a2915677fecf 100644 (file)
@@ -447,7 +447,6 @@ public:
    dst_reg *nir_locals;
    dst_reg *nir_ssa_values;
    src_reg *nir_inputs;
-   unsigned *nir_uniform_driver_location;
    dst_reg *nir_system_values;
 
 protected:
index 9e52229190ec338c08d5de8e64f7b8ec61f17a64..59e440a899da94d4463ea3a49081f7762628144a 100644 (file)
@@ -132,9 +132,6 @@ vec4_visitor::nir_setup_uniforms(nir_shader *shader)
 {
    uniforms = 0;
 
-   nir_uniform_driver_location =
-      rzalloc_array(mem_ctx, unsigned, this->uniform_array_size);
-
    if (shader_prog) {
       foreach_list_typed(nir_variable, var, node, &shader->uniforms) {
          /* UBO's, atomics and samplers don't take up space in the
@@ -182,7 +179,6 @@ vec4_visitor::nir_setup_uniforms(nir_shader *shader)
             stage_prog_data->param[uniforms * 4 + i] = &zero;
          }
 
-         nir_uniform_driver_location[uniforms] = var->data.driver_location;
          uniforms++;
       }
    }
@@ -230,7 +226,6 @@ vec4_visitor::nir_setup_uniform(nir_variable *var)
              stage_prog_data->param[uniforms * 4 + i] = &zero;
           }
 
-          nir_uniform_driver_location[uniforms] = var->data.driver_location;
           uniforms++;
        }
     }
@@ -263,7 +258,6 @@ vec4_visitor::nir_setup_builtin_uniform(nir_variable *var)
          (var->type->is_scalar() || var->type->is_vector() ||
           var->type->is_matrix() ? var->type->vector_elements : 4);
 
-      nir_uniform_driver_location[uniforms] = var->data.driver_location;
       uniforms++;
    }
 }
@@ -570,24 +564,14 @@ vec4_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
       has_indirect = true;
       /* fallthrough */
    case nir_intrinsic_load_uniform: {
-      int uniform = instr->const_index[0] + instr->const_index[1];
-
       dest = get_nir_dest(instr->dest);
 
-      if (has_indirect) {
-         /* Split addressing into uniform and offset */
-         int offset = uniform - nir_uniform_driver_location[uniform];
-         assert(offset >= 0);
-
-         uniform -= offset;
-         assert(uniform >= 0);
+      src = src_reg(dst_reg(UNIFORM, instr->const_index[0]));
+      src.reg_offset = instr->const_index[1];
 
-         src = src_reg(dst_reg(UNIFORM, uniform));
-         src.reg_offset = offset;
+      if (has_indirect) {
          src_reg tmp = get_nir_src(instr->src[0], BRW_REGISTER_TYPE_D, 1);
          src.reladdr = new(mem_ctx) src_reg(tmp);
-      } else {
-         src = src_reg(dst_reg(UNIFORM, uniform));
       }
 
       emit(MOV(dest, src));