i965/vec4: Get rid of the uniform_vector_size array
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 30 Sep 2015 18:02:14 +0000 (11:02 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 2 Oct 2015 21:19:39 +0000 (14:19 -0700)
The uniform_vector_size array was only ever used by pack_uniform_registers
which no longer needs it.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
src/mesa/drivers/dri/i965/brw_vec4.cpp
src/mesa/drivers/dri/i965/brw_vec4.h
src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp

index 057537ecae3ef0d773309deacb7cfc00aaccedd0..6aaf764a67adca2a126931ba9a44b98df6320574 100644 (file)
@@ -1666,7 +1666,6 @@ vec4_visitor::setup_uniforms(int reg)
     */
    if (devinfo->gen < 6 && this->uniforms == 0) {
       assert(this->uniforms < this->uniform_array_size);
-      this->uniform_vector_size[this->uniforms] = 1;
 
       stage_prog_data->param =
          reralloc(NULL, stage_prog_data->param, const gl_constant_value *, 4);
index 341897e9f079ed48bfe35832b65875ada1a5b9f6..76b13a6f0d4cad1c6bb48e474a6f4d728536b3c9 100644 (file)
@@ -124,8 +124,7 @@ public:
    dst_reg output_reg[BRW_VARYING_SLOT_COUNT];
    const char *output_reg_annotation[BRW_VARYING_SLOT_COUNT];
    int *uniform_size;
-   int *uniform_vector_size;
-   int uniform_array_size; /*< Size of uniform_[vector_]size arrays */
+   int uniform_array_size; /*< Size of the uniform_size array */
    int uniforms;
 
    src_reg shader_start_time;
index 2555038f2215d5f8286a8ab51d21557e18dca2d3..b0abfc10dc9a22d23333e295bb0c9facf393cecf 100644 (file)
@@ -166,16 +166,14 @@ vec4_visitor::nir_setup_uniforms(nir_shader *shader)
 
       struct gl_program_parameter_list *plist = prog->Parameters;
       for (unsigned p = 0; p < plist->NumParameters; p++) {
-         uniform_vector_size[uniforms] = plist->Parameters[p].Size;
-
          /* Parameters should be either vec4 uniforms or single component
           * constants; matrices and other larger types should have been broken
           * down earlier.
           */
-         assert(uniform_vector_size[uniforms] <= 4);
+         assert(plist->Parameters[p].Size <= 4);
 
-         int i;
-         for (i = 0; i < uniform_vector_size[uniforms]; i++) {
+         unsigned i;
+         for (i = 0; i < plist->Parameters[p].Size; i++) {
             stage_prog_data->param[uniforms * 4 + i] = &plist->ParameterValues[p][i];
          }
          for (; i < 4; i++) {
@@ -218,10 +216,9 @@ vec4_visitor::nir_setup_uniform(nir_variable *var)
 
        for (unsigned s = 0; s < vector_count; s++) {
           assert(uniforms < uniform_array_size);
-          uniform_vector_size[uniforms] = storage->type->vector_elements;
 
           int i;
-          for (i = 0; i < uniform_vector_size[uniforms]; i++) {
+          for (i = 0; i < storage->type->vector_elements; i++) {
              stage_prog_data->param[uniforms * 4 + i] = components;
              components++;
           }
@@ -258,10 +255,6 @@ vec4_visitor::nir_setup_builtin_uniform(nir_variable *var)
          stage_prog_data->param[uniforms * 4 + j] =
             &values[GET_SWZ(slots[i].swizzle, j)];
 
-      uniform_vector_size[uniforms] =
-         (var->type->is_scalar() || var->type->is_vector() ||
-          var->type->is_matrix() ? var->type->vector_elements : 4);
-
       uniforms++;
    }
 }
index f3030808f861a27091e0cd30e4c1d5d6622291a5..af01d8eed96dff18f58f9b3598654f776eafbeb9 100644 (file)
@@ -702,8 +702,6 @@ vec4_visitor::setup_vec4_uniform_value(unsigned param_offset,
 
    for (unsigned i = n; i < 4; ++i)
       stage_prog_data->param[param_offset + i] = &zero;
-
-   uniform_vector_size[param_offset / 4] = n;
 }
 
 vec4_instruction *
@@ -1886,7 +1884,6 @@ vec4_visitor::vec4_visitor(const struct brw_compiler *compiler,
    }
 
    this->uniform_size = rzalloc_array(mem_ctx, int, this->uniform_array_size);
-   this->uniform_vector_size = rzalloc_array(mem_ctx, int, this->uniform_array_size);
 }
 
 vec4_visitor::~vec4_visitor()
index f4b50ba9d9fd74a4ddce6252752658a14937263f..3a267d80b5aa08369962aa7c0155765626804e7c 100644 (file)
@@ -262,7 +262,6 @@ vec4_vs_visitor::setup_uniform_clipplane_values()
 {
    for (int i = 0; i < key->nr_userclip_plane_consts; ++i) {
       assert(this->uniforms < uniform_array_size);
-      this->uniform_vector_size[this->uniforms] = 4;
       this->userplane[i] = dst_reg(UNIFORM, this->uniforms);
       this->userplane[i].type = BRW_REGISTER_TYPE_F;
       for (int j = 0; j < 4; ++j) {