[Mesa-dev] [RFC 15/27] i965/vec4: Use unsigned instead of signed for visitor uniform count

Topi Pohjolainen topi.pohjolainen at intel.com
Sat Feb 22 01:05:41 PST 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           |  2 +-
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |  2 +-
 src/mesa/drivers/dri/i965/brw_vec4_vp.cpp      |  2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index d45d8cb..6ff7a27 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -385,7 +385,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;
    }
 }
@@ -416,12 +416,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++) {
       int size = this->uniform_vector_size[src];
 
       if (!uniform_used[src]) {
@@ -429,7 +429,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)
@@ -584,7 +584,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;
 
@@ -593,7 +593,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 bd69f96..1495e0b 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -387,7 +387,7 @@ public:
    const char *output_reg_annotation[BRW_VARYING_SLOT_COUNT];
    int uniform_size[MAX_UNIFORMS];
    int uniform_vector_size[MAX_UNIFORMS];
-   int uniforms;
+   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 831f9ff..8843f6b 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -3233,7 +3233,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;
    }
 
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