From 016701f6860a840e079cb4c5f844a8cced712cd8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 29 Jul 2008 17:43:35 -0600 Subject: [PATCH] mesa: Silence compiler warnings on Windows. --- src/mesa/shader/prog_execute.c | 2 +- src/mesa/shader/prog_parameter.c | 1 + src/mesa/shader/prog_statevars.c | 10 +++++----- src/mesa/shader/shader_api.c | 6 +++--- src/mesa/shader/slang/slang_print.c | 3 ++- src/mesa/shader/slang/slang_simplify.c | 4 ++-- src/mesa/shader/slang/slang_vartable.c | 10 +++++----- 7 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c index 4575a069ea5..b9b7712f3f7 100644 --- a/src/mesa/shader/prog_execute.c +++ b/src/mesa/shader/prog_execute.c @@ -717,7 +717,7 @@ _mesa_execute_program(GLcontext * ctx, * result.z = result.x * APPX(result.y) * We do what the ARB extension says. */ - q[2] = pow(2.0, t[0]); + q[2] = (GLfloat) pow(2.0, t[0]); } q[1] = t[0] - floor_t0; q[3] = 1.0F; diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c index e209bbf6c40..d87e8f6e15f 100644 --- a/src/mesa/shader/prog_parameter.c +++ b/src/mesa/shader/prog_parameter.c @@ -296,6 +296,7 @@ _mesa_add_sampler(struct gl_program_parameter_list *paramList, return (GLint) paramList->ParameterValues[i][0]; } else { + GLuint i; const GLint size = 1; /* a sampler is basically a texture unit number */ GLfloat value; GLint numSamplers = 0; diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c index e446e1c4197..91392650a36 100644 --- a/src/mesa/shader/prog_statevars.c +++ b/src/mesa/shader/prog_statevars.c @@ -254,7 +254,7 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], value[1] = ctx->Fog.Start; value[2] = ctx->Fog.End; value[3] = (ctx->Fog.End == ctx->Fog.Start) - ? 1.0 : 1.0F / (ctx->Fog.End - ctx->Fog.Start); + ? 1.0f : (GLfloat)(1.0 / (ctx->Fog.End - ctx->Fog.Start)); return; case STATE_CLIPPLANE: { @@ -410,9 +410,9 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], = ctx->Texture.Unit[unit]._Current; if (texObj) { struct gl_texture_image *texImage = texObj->Image[0][0]; - ASSIGN_4V(value, 1.0 / texImage->Width, - 1.0 / texImage->Height, - 0.0, 1.0); + ASSIGN_4V(value, (GLfloat) (1.0 / texImage->Width), + (GLfloat)(1.0 / texImage->Height), + 0.0f, 1.0f); } } return; @@ -426,7 +426,7 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], * exp2: 2^-((density/(ln(2)^2) * fogcoord)^2) */ value[0] = (ctx->Fog.End == ctx->Fog.Start) - ? 1.0 : -1.0F / (ctx->Fog.End - ctx->Fog.Start); + ? 1.0f : (GLfloat)(-1.0F / (ctx->Fog.End - ctx->Fog.Start)); value[1] = ctx->Fog.End * -value[0]; value[2] = ctx->Fog.Density * ONE_DIV_LN2; value[3] = ctx->Fog.Density * ONE_DIV_SQRT_LN2; diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index feb8363f503..92bf3ecb5cd 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -1002,7 +1002,7 @@ get_uniformfv(GLcontext *ctx, GLuint program, GLint location, = _mesa_lookup_shader_program(ctx, program); if (shProg) { if (shProg->Uniforms && - location >= 0 && location < shProg->Uniforms->NumUniforms) { + location >= 0 && location < (GLint) shProg->Uniforms->NumUniforms) { GLint progPos; GLuint i; const struct gl_program *prog = NULL; @@ -1310,7 +1310,7 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program, GLint location, /* ordinary uniform variable */ GLsizei k, i; - if (count * elems > program->Parameters->Parameters[location].Size) { + if (count * elems > (GLint) program->Parameters->Parameters[location].Size) { _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(count too large)"); return; } @@ -1521,7 +1521,7 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows, if (location == -1) return; /* The standard specifies this as a no-op */ - if (location < 0 || location >= shProg->Uniforms->NumUniforms) { + if (location < 0 || location >= (GLint) shProg->Uniforms->NumUniforms) { _mesa_error(ctx, GL_INVALID_VALUE, "glUniformMatrix(location)"); return; } diff --git a/src/mesa/shader/slang/slang_print.c b/src/mesa/shader/slang/slang_print.c index 2284b3be417..f48762fb111 100644 --- a/src/mesa/shader/slang/slang_print.c +++ b/src/mesa/shader/slang/slang_print.c @@ -268,6 +268,7 @@ slang_print_tree(const slang_operation *op, int indent) for (i = 0; i < op->locals->num_variables; i++) { printf("%s ", (char *) op->locals->variables[i]->a_name); } + printf("\n"); print_generic(op, NULL, indent+3); spaces(indent); printf("}}\n"); @@ -665,7 +666,7 @@ slang_print_tree(const slang_operation *op, int indent) void slang_print_function(const slang_function *f, GLboolean body) { - int i; + GLuint i; #if 0 if (_mesa_strcmp((char *) f->header.a_name, "main") != 0) diff --git a/src/mesa/shader/slang/slang_simplify.c b/src/mesa/shader/slang/slang_simplify.c index b729ceca7ea..d45e71574c7 100644 --- a/src/mesa/shader/slang/slang_simplify.c +++ b/src/mesa/shader/slang/slang_simplify.c @@ -69,7 +69,7 @@ _slang_lookup_constant(const char *name) for (i = 0; info[i].Name; i++) { if (strcmp(info[i].Name, name) == 0) { /* found */ - GLint value = -1.0; + GLint value = -1; _mesa_GetIntegerv(info[i].Token, &value); ASSERT(value >= 0); /* sanity check that glGetFloatv worked */ return value; @@ -103,7 +103,7 @@ _slang_simplify(slang_operation *oper, oper->literal[0] = oper->literal[1] = oper->literal[2] = - oper->literal[3] = value; + oper->literal[3] = (GLfloat) value; oper->type = SLANG_OPER_LITERAL_INT; return; } diff --git a/src/mesa/shader/slang/slang_vartable.c b/src/mesa/shader/slang/slang_vartable.c index 771f9b92d5b..aba47f9929e 100644 --- a/src/mesa/shader/slang/slang_vartable.c +++ b/src/mesa/shader/slang/slang_vartable.c @@ -130,7 +130,7 @@ _slang_pop_var_table(slang_var_table *vt) /* just verify that any remaining allocations in this scope * were for temps */ - for (i = 0; i < vt->MaxRegisters * 4; i++) { + for (i = 0; i < (int) vt->MaxRegisters * 4; i++) { if (t->Temps[i] != FREE && t->Parent->Temps[i] == FREE) { if (dbg) printf(" Free reg %d\n", i/4); assert(t->Temps[i] == TEMP); @@ -207,7 +207,7 @@ alloc_reg(slang_var_table *vt, GLint size, GLboolean isTemp) for (i = 0; i <= vt->MaxRegisters * 4 - size; i += step) { GLuint found = 0; - for (j = 0; j < size; j++) { + for (j = 0; j < (GLuint) size; j++) { if (i + j < vt->MaxRegisters * 4 && t->Temps[i + j] == FREE) { found++; } @@ -219,7 +219,7 @@ alloc_reg(slang_var_table *vt, GLint size, GLboolean isTemp) /* found block of size free regs */ if (size > 1) assert(i % 4 == 0); - for (j = 0; j < size; j++) + for (j = 0; j < (GLuint) size; j++) t->Temps[i + j] = isTemp ? TEMP : VAR; assert(i < MAX_PROGRAM_TEMPS * 4); t->ValSize[i] = size; @@ -321,7 +321,7 @@ _slang_free_temp(slang_var_table *vt, slang_ir_storage *store) else { /*assert(store->Swizzle == SWIZZLE_NOOP);*/ assert(t->ValSize[r*4] == store->Size); - for (i = 0; i < store->Size; i++) { + for (i = 0; i < (GLuint) store->Size; i++) { assert(t->Temps[r * 4 + i] == TEMP); t->Temps[r * 4 + i] = FREE; } @@ -335,7 +335,7 @@ _slang_is_temp(const slang_var_table *vt, const slang_ir_storage *store) struct table *t = vt->Top; GLuint comp; assert(store->Index >= 0); - assert(store->Index < vt->MaxRegisters); + assert(store->Index < (int) vt->MaxRegisters); if (store->Swizzle == SWIZZLE_NOOP) comp = 0; else -- 2.30.2