[Mesa-dev] [PATCH 02/11] mesa: add some casts to silence MSVC warnings

Brian Paul brianp at vmware.com
Tue Jan 22 16:51:12 PST 2013


---
 src/mesa/program/program.c |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c
index 993803d..0cca460 100644
--- a/src/mesa/program/program.c
+++ b/src/mesa/program/program.c
@@ -840,8 +840,8 @@ _mesa_find_used_registers(const struct gl_program *prog,
 
       for (j = 0; j < n; j++) {
          if (inst->SrcReg[j].File == file) {
-            ASSERT(inst->SrcReg[j].Index < usedSize);
-            if(inst->SrcReg[j].Index < usedSize)
+            ASSERT(inst->SrcReg[j].Index < (GLint) usedSize);
+            if (inst->SrcReg[j].Index < (GLint) usedSize)
                used[inst->SrcReg[j].Index] = GL_TRUE;
          }
       }
@@ -908,23 +908,23 @@ _mesa_valid_register_index(const struct gl_context *ctx,
       return GL_TRUE;  /* XXX or maybe false? */
 
    case PROGRAM_TEMPORARY:
-      return index >= 0 && index < c->MaxTemps;
+      return index >= 0 && index < (GLint) c->MaxTemps;
 
    case PROGRAM_ENV_PARAM:
-      return index >= 0 && index < c->MaxEnvParams;
+      return index >= 0 && index < (GLint) c->MaxEnvParams;
 
    case PROGRAM_LOCAL_PARAM:
-      return index >= 0 && index < c->MaxLocalParams;
+      return index >= 0 && index < (GLint) c->MaxLocalParams;
 
    case PROGRAM_UNIFORM:
    case PROGRAM_STATE_VAR:
       /* aka constant buffer */
-      return index >= 0 && index < c->MaxUniformComponents / 4;
+      return index >= 0 && index < (GLint) c->MaxUniformComponents / 4;
 
    case PROGRAM_CONSTANT:
       /* constant buffer w/ possible relative negative addressing */
       return (index > (int) c->MaxUniformComponents / -4 &&
-              index < c->MaxUniformComponents / 4);
+              index < (int) c->MaxUniformComponents / 4);
 
    case PROGRAM_INPUT:
       if (index < 0)
@@ -932,11 +932,11 @@ _mesa_valid_register_index(const struct gl_context *ctx,
 
       switch (shaderType) {
       case MESA_SHADER_VERTEX:
-         return index < VERT_ATTRIB_GENERIC0 + c->MaxAttribs;
+         return index < VERT_ATTRIB_GENERIC0 + (GLint) c->MaxAttribs;
       case MESA_SHADER_FRAGMENT:
-         return index < FRAG_ATTRIB_VAR0 + ctx->Const.MaxVarying;
+         return index < FRAG_ATTRIB_VAR0 + (GLint) ctx->Const.MaxVarying;
       case MESA_SHADER_GEOMETRY:
-         return index < GEOM_ATTRIB_VAR0 + ctx->Const.MaxVarying;
+         return index < GEOM_ATTRIB_VAR0 + (GLint) ctx->Const.MaxVarying;
       default:
          return GL_FALSE;
       }
@@ -947,17 +947,17 @@ _mesa_valid_register_index(const struct gl_context *ctx,
 
       switch (shaderType) {
       case MESA_SHADER_VERTEX:
-         return index < VERT_RESULT_VAR0 + ctx->Const.MaxVarying;
+         return index < VERT_RESULT_VAR0 + (GLint) ctx->Const.MaxVarying;
       case MESA_SHADER_FRAGMENT:
-         return index < FRAG_RESULT_DATA0 + ctx->Const.MaxDrawBuffers;
+         return index < FRAG_RESULT_DATA0 + (GLint) ctx->Const.MaxDrawBuffers;
       case MESA_SHADER_GEOMETRY:
-         return index < GEOM_RESULT_VAR0 + ctx->Const.MaxVarying;
+         return index < GEOM_RESULT_VAR0 + (GLint) ctx->Const.MaxVarying;
       default:
          return GL_FALSE;
       }
 
    case PROGRAM_ADDRESS:
-      return index >= 0 && index < c->MaxAddressRegs;
+      return index >= 0 && index < (GLint) c->MaxAddressRegs;
 
    default:
       _mesa_problem(ctx,
-- 
1.7.3.4



More information about the mesa-dev mailing list