[Mesa-dev] [PATCH 07/20] i965/vec4: Use unsigned instead of signed for visitor uniform count

Topi Pohjolainen topi.pohjolainen at intel.com
Fri Apr 11 00:28:47 PDT 2014


Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/mesa/drivers/dri/i965/brw_vec4.cpp         | 12 ++++++------
 src/mesa/drivers/dri/i965/brw_vec4.h           |  4 ++--
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |  4 ++--
 src/mesa/drivers/dri/i965/brw_vec4_vp.cpp      |  2 +-
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index 89d7d37..46aebad 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -505,7 +505,7 @@ vec4_visitor::split_uniform_registers()
    }
 
    /* Update that everything is now vector-sized. */
-   for (int i = 0; i < this->uniforms; i++) {
+   for (unsigned i = 0; i < this->uniforms; i++) {
       this->uniform_size[i] = 1;
    }
 }
@@ -536,12 +536,12 @@ vec4_visitor::pack_uniform_registers()
       }
    }
 
-   int new_uniform_count = 0;
+   unsigned new_uniform_count = 0;
 
    /* Now, figure out a packing of the live uniform vectors into our
     * push constants.
     */
-   for (int src = 0; src < uniforms; src++) {
+   for (unsigned src = 0; src < uniforms; src++) {
       assert(src < uniform_array_size);
       int size = this->uniform_vector_size[src];
 
@@ -550,7 +550,7 @@ vec4_visitor::pack_uniform_registers()
 	 continue;
       }
 
-      int dst;
+      unsigned dst;
       /* Find the lowest place we can slot this uniform in. */
       for (dst = 0; dst < src; dst++) {
 	 if (this->uniform_vector_size[dst] + size <= 4)
@@ -705,7 +705,7 @@ vec4_visitor::move_push_constants_to_pull_constants()
    /* Only allow 32 registers (256 uniform components) as push constants,
     * which is the limit on gen6.
     */
-   int max_uniform_components = 32 * 8;
+   unsigned max_uniform_components = 32 * 8;
    if (this->uniforms * 4 <= max_uniform_components)
       return;
 
@@ -714,7 +714,7 @@ vec4_visitor::move_push_constants_to_pull_constants()
     * look for the most infrequently used uniform vec4s, but leave
     * that for later.
     */
-   for (int i = 0; i < this->uniforms * 4; i += 4) {
+   for (unsigned i = 0; i < this->uniforms * 4; i += 4) {
       pull_constant_loc[i / 4] = -1;
 
       if (i >= max_uniform_components) {
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index 75965ef..9684012 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -395,8 +395,8 @@ public:
    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 uniforms;
+   unsigned uniform_array_size; /*< Size of uniform_[vector_]size arrays */
+   unsigned uniforms;
 
    src_reg shader_start_time;
 
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index bd00ce3..8835ac6 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -3269,7 +3269,7 @@ vec4_visitor::move_uniform_array_access_to_pull_constants()
 {
    int pull_constant_loc[this->uniforms];
 
-   for (int i = 0; i < this->uniforms; i++) {
+   for (unsigned i = 0; i < this->uniforms; i++) {
       pull_constant_loc[i] = -1;
    }
 
@@ -3286,7 +3286,7 @@ vec4_visitor::move_uniform_array_access_to_pull_constants()
 	 if (inst->src[i].file != UNIFORM || !inst->src[i].reladdr)
 	    continue;
 
-	 int uniform = inst->src[i].reg;
+	 unsigned uniform = inst->src[i].reg;
 
 	 /* If this array isn't already present in the pull constant buffer,
 	  * add it.
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_vp.cpp b/src/mesa/drivers/dri/i965/brw_vec4_vp.cpp
index f1000f2..fa26970 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_vp.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_vp.cpp
@@ -570,7 +570,7 @@ vec4_vs_visitor::get_vp_src_reg(const prog_src_register &src)
          break;
 
       case PROGRAM_STATE_VAR:
-         assert(src.Index < this->uniforms);
+         assert(src.Index < (int)this->uniforms);
          result = src_reg(dst_reg(UNIFORM, src.Index));
          result.type = BRW_REGISTER_TYPE_F;
          break;
-- 
1.8.3.1



More information about the mesa-dev mailing list