[Mesa-dev] [PATCH 05/11] i965/vec4: Get rid of the uniform_vector_size array

Jason Ekstrand jason at jlekstrand.net
Wed Sep 30 18:41:09 PDT 2015


The uniform_vector_size array was only ever used by pack_uniform_registers
which no longer needs it.
---
 src/mesa/drivers/dri/i965/brw_vec4.cpp            |  1 -
 src/mesa/drivers/dri/i965/brw_vec4.h              |  3 +--
 src/mesa/drivers/dri/i965/brw_vec4_nir.cpp        | 15 ++++-----------
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp    |  3 ---
 src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp |  1 -
 5 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index f0fa07e..4e9f3f7 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -1667,7 +1667,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);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index 341897e..76b13a6 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -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;
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
index 2555038..b0abfc1 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
@@ -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++;
    }
 }
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index f303080..af01d8e 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -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()
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
index f4b50ba..3a267d8 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
@@ -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) {
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list