[Mesa-dev] [PATCH 04/18] glsl: fix signed/unsigned comparision warnings on MSVC

Brian Paul brianp at vmware.com
Sun Nov 4 15:43:49 PST 2012


---
 src/glsl/lower_mat_op_to_vec.cpp            |    8 ++++----
 src/glsl/lower_vec_index_to_cond_assign.cpp |    4 ++--
 src/glsl/lower_vec_index_to_swizzle.cpp     |    2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/glsl/lower_mat_op_to_vec.cpp b/src/glsl/lower_mat_op_to_vec.cpp
index a371afc..08cae29 100644
--- a/src/glsl/lower_mat_op_to_vec.cpp
+++ b/src/glsl/lower_mat_op_to_vec.cpp
@@ -122,7 +122,7 @@ ir_mat_op_to_vec_visitor::do_mul_mat_mat(ir_dereference *result,
 					 ir_dereference *a,
 					 ir_dereference *b)
 {
-   int b_col, i;
+   unsigned b_col, i;
    ir_assignment *assign;
    ir_expression *expr;
 
@@ -154,7 +154,7 @@ ir_mat_op_to_vec_visitor::do_mul_mat_vec(ir_dereference *result,
 					 ir_dereference *a,
 					 ir_dereference *b)
 {
-   int i;
+   unsigned i;
    ir_assignment *assign;
    ir_expression *expr;
 
@@ -183,7 +183,7 @@ ir_mat_op_to_vec_visitor::do_mul_vec_mat(ir_dereference *result,
 					 ir_dereference *a,
 					 ir_dereference *b)
 {
-   int i;
+   unsigned i;
 
    for (i = 0; i < b->type->matrix_columns; i++) {
       ir_rvalue *column_result;
@@ -208,7 +208,7 @@ ir_mat_op_to_vec_visitor::do_mul_mat_scalar(ir_dereference *result,
 					    ir_dereference *a,
 					    ir_dereference *b)
 {
-   int i;
+   unsigned i;
 
    for (i = 0; i < a->type->matrix_columns; i++) {
       ir_expression *column_expr;
diff --git a/src/glsl/lower_vec_index_to_cond_assign.cpp b/src/glsl/lower_vec_index_to_cond_assign.cpp
index fce9c34..789f62a 100644
--- a/src/glsl/lower_vec_index_to_cond_assign.cpp
+++ b/src/glsl/lower_vec_index_to_cond_assign.cpp
@@ -71,7 +71,7 @@ ir_vec_index_to_cond_assign_visitor::convert_vec_index_to_cond_assign(ir_rvalue
    ir_assignment *assign;
    ir_variable *index, *var;
    ir_dereference *deref;
-   int i;
+   unsigned i;
 
    if (!orig_deref)
       return ir;
@@ -164,7 +164,7 @@ ir_vec_index_to_cond_assign_visitor::visit_leave(ir_assignment *ir)
    ir_variable *index, *var;
    ir_dereference_variable *deref;
    ir_assignment *assign;
-   int i;
+   unsigned i;
 
    ir->rhs = convert_vec_index_to_cond_assign(ir->rhs);
    if (ir->condition)
diff --git a/src/glsl/lower_vec_index_to_swizzle.cpp b/src/glsl/lower_vec_index_to_swizzle.cpp
index 46fd6ac..264d6dc 100644
--- a/src/glsl/lower_vec_index_to_swizzle.cpp
+++ b/src/glsl/lower_vec_index_to_swizzle.cpp
@@ -93,7 +93,7 @@ ir_vec_index_to_swizzle_visitor::convert_vec_index_to_swizzle(ir_rvalue *ir)
     * large.  For simplicity sake, just clamp the index to [0, size-1].
     */
    const int i = MIN2(MAX2(ir_constant->value.i[0], 0),
-		      (deref->array->type->vector_elements - 1));
+		      ((int) deref->array->type->vector_elements - 1));
 
    return new(ctx) ir_swizzle(deref->array, i, 0, 0, 0, 1);
 }
-- 
1.7.3.4



More information about the mesa-dev mailing list