mesa: Silence compiler warnings on Windows.

This commit is contained in:
Michal Krol
2008-07-15 11:44:47 +02:00
parent 6c534b830c
commit f9c574d719
9 changed files with 26 additions and 28 deletions

View File

@@ -716,7 +716,7 @@ _mesa_execute_program(GLcontext * ctx,
* result.z = result.x * APPX(result.y) * result.z = result.x * APPX(result.y)
* We do what the ARB extension says. * 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[1] = t[0] - floor_t0;
q[3] = 1.0F; q[3] = 1.0F;

View File

@@ -319,6 +319,7 @@ _mesa_add_sampler(struct gl_program_parameter_list *paramList,
return (GLint) paramList->ParameterValues[i][0]; return (GLint) paramList->ParameterValues[i][0];
} }
else { else {
GLuint i;
const GLint size = 1; /* a sampler is basically a texture unit number */ const GLint size = 1; /* a sampler is basically a texture unit number */
GLfloat value; GLfloat value;
GLint numSamplers = 0; GLint numSamplers = 0;

View File

@@ -363,7 +363,7 @@ _mesa_print_swizzle(GLuint swizzle)
_mesa_printf(".xyzw\n"); _mesa_printf(".xyzw\n");
} }
else { else {
char *s = _mesa_swizzle_string(swizzle, 0, 0); const char *s = _mesa_swizzle_string(swizzle, 0, 0);
_mesa_printf("%s\n", s); _mesa_printf("%s\n", s);
} }
} }

View File

@@ -249,7 +249,7 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
value[1] = ctx->Fog.Start; value[1] = ctx->Fog.Start;
value[2] = ctx->Fog.End; value[2] = ctx->Fog.End;
value[3] = (ctx->Fog.End == ctx->Fog.Start) value[3] = (ctx->Fog.End == ctx->Fog.Start)
? 1.0 : (GLfloat)(1.0 / (ctx->Fog.End - ctx->Fog.Start)); ? 1.0f : (GLfloat)(1.0 / (ctx->Fog.End - ctx->Fog.Start));
return; return;
case STATE_CLIPPLANE: case STATE_CLIPPLANE:
{ {
@@ -409,9 +409,9 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
= ctx->Texture.Unit[unit]._Current; = ctx->Texture.Unit[unit]._Current;
if (texObj) { if (texObj) {
struct gl_texture_image *texImage = texObj->Image[0][0]; struct gl_texture_image *texImage = texObj->Image[0][0];
ASSIGN_4V(value, 1.0 / texImage->Width, ASSIGN_4V(value, (GLfloat) (1.0 / texImage->Width),
(GLfloat)(1.0 / texImage->Height), (GLfloat)(1.0 / texImage->Height),
0.0, 1.0); 0.0f, 1.0f);
} }
} }
return; return;
@@ -425,7 +425,7 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
* exp2: 2^-((density/(ln(2)^2) * fogcoord)^2) * exp2: 2^-((density/(ln(2)^2) * fogcoord)^2)
*/ */
value[0] = (ctx->Fog.End == ctx->Fog.Start) value[0] = (ctx->Fog.End == ctx->Fog.Start)
? 1.0 : (GLfloat)(-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[1] = ctx->Fog.End * -value[0];
value[2] = (GLfloat)(ctx->Fog.Density * ONE_DIV_LN2); value[2] = (GLfloat)(ctx->Fog.Density * ONE_DIV_LN2);
value[3] = (GLfloat)(ctx->Fog.Density * ONE_DIV_SQRT_LN2); value[3] = (GLfloat)(ctx->Fog.Density * ONE_DIV_SQRT_LN2);

View File

@@ -969,7 +969,7 @@ get_uniformfv(GLcontext *ctx, GLuint program, GLint location,
= _mesa_lookup_shader_program(ctx, program); = _mesa_lookup_shader_program(ctx, program);
if (shProg) { if (shProg) {
if (shProg->Uniforms && if (shProg->Uniforms &&
location >= 0 && location < shProg->Uniforms->NumUniforms) { location >= 0 && location < (GLint) shProg->Uniforms->NumUniforms) {
GLint progPos; GLint progPos;
GLuint i; GLuint i;
const struct gl_program *prog = NULL; const struct gl_program *prog = NULL;
@@ -1217,7 +1217,7 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program, GLint location,
/* ordinary uniform variable */ /* ordinary uniform variable */
GLsizei k, i; 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)"); _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(count too large)");
return; return;
} }
@@ -1367,7 +1367,7 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows,
if (location == -1) if (location == -1)
return; /* The standard specifies this as a no-op */ 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)"); _mesa_error(ctx, GL_INVALID_VALUE, "glUniformMatrix(location)");
return; return;
} }

View File

@@ -2623,7 +2623,7 @@ _slang_gen_subscript(slang_assemble_ctx * A, slang_operation *oper)
index = (GLint) oper->children[1].literal[0]; index = (GLint) oper->children[1].literal[0];
if (oper->children[1].type != SLANG_OPER_LITERAL_INT || if (oper->children[1].type != SLANG_OPER_LITERAL_INT ||
index >= max) { index >= (GLint) max) {
slang_info_log_error(A->log, "Invalid array index for vector type"); slang_info_log_error(A->log, "Invalid array index for vector type");
return NULL; return NULL;
} }

View File

@@ -241,7 +241,7 @@ find_var(const slang_variable_scope *s, slang_atom name)
void void
slang_print_tree(const slang_operation *op, int indent) slang_print_tree(const slang_operation *op, int indent)
{ {
int i; GLuint i;
switch (op->type) { switch (op->type) {
@@ -261,13 +261,10 @@ slang_print_tree(const slang_operation *op, int indent)
case SLANG_OPER_BLOCK_NEW_SCOPE: case SLANG_OPER_BLOCK_NEW_SCOPE:
spaces(indent); spaces(indent);
printf("{{ // new scope locals=%p: ", (void*)op->locals); printf("{{ // new scope locals=%p: ", (void*)op->locals);
{ for (i = 0; i < op->locals->num_variables; i++) {
int i; printf("%s ", (char *) op->locals->variables[i]->a_name);
for (i = 0; i < op->locals->num_variables; i++) {
printf("%s ", (char *) op->locals->variables[i]->a_name);
}
printf("\n");
} }
printf("\n");
print_generic(op, NULL, indent+3); print_generic(op, NULL, indent+3);
spaces(indent); spaces(indent);
printf("}}\n"); printf("}}\n");
@@ -665,7 +662,7 @@ slang_print_tree(const slang_operation *op, int indent)
void void
slang_print_function(const slang_function *f, GLboolean body) slang_print_function(const slang_function *f, GLboolean body)
{ {
int i; GLuint i;
#if 0 #if 0
if (_mesa_strcmp((char *) f->header.a_name, "main") != 0) if (_mesa_strcmp((char *) f->header.a_name, "main") != 0)

View File

@@ -76,7 +76,7 @@ _slang_lookup_constant(const char *name)
for (i = 0; info[i].Name; i++) { for (i = 0; info[i].Name; i++) {
if (strcmp(info[i].Name, name) == 0) { if (strcmp(info[i].Name, name) == 0) {
/* found */ /* found */
GLint value = -1.0; GLint value = -1;
_mesa_GetIntegerv(info[i].Token, &value); _mesa_GetIntegerv(info[i].Token, &value);
ASSERT(value >= 0); /* sanity check that glGetFloatv worked */ ASSERT(value >= 0); /* sanity check that glGetFloatv worked */
return value / info[i].Divisor; return value / info[i].Divisor;
@@ -110,7 +110,7 @@ _slang_simplify(slang_operation *oper,
oper->literal[0] = oper->literal[0] =
oper->literal[1] = oper->literal[1] =
oper->literal[2] = oper->literal[2] =
oper->literal[3] = value; oper->literal[3] = (GLfloat) value;
oper->type = SLANG_OPER_LITERAL_INT; oper->type = SLANG_OPER_LITERAL_INT;
return; return;
} }
@@ -380,7 +380,7 @@ _slang_adapt_call(slang_operation *callOper, const slang_function *fun,
&origArg); &origArg);
callOper->children[i + j].children[1].type callOper->children[i + j].children[1].type
= SLANG_OPER_LITERAL_INT; = SLANG_OPER_LITERAL_INT;
callOper->children[i + j].children[1].literal[0] = j; callOper->children[i + j].children[1].literal[0] = (GLfloat) j;
} }
} }
@@ -394,11 +394,11 @@ _slang_adapt_call(slang_operation *callOper, const slang_function *fun,
} }
} }
if (callOper->num_children < numParams) { if (callOper->num_children < (GLuint) numParams) {
/* still not enough args for all params */ /* still not enough args for all params */
return GL_FALSE; return GL_FALSE;
} }
else if (callOper->num_children > numParams) { else if (callOper->num_children > (GLuint) numParams) {
/* now too many arguments */ /* now too many arguments */
/* XXX this isn't always an error, see spec */ /* XXX this isn't always an error, see spec */
return GL_FALSE; return GL_FALSE;

View File

@@ -129,7 +129,7 @@ _slang_pop_var_table(slang_var_table *vt)
/* just verify that any remaining allocations in this scope /* just verify that any remaining allocations in this scope
* were for temps * 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 (t->Temps[i] != FREE && t->Parent->Temps[i] == FREE) {
if (dbg) printf(" Free reg %d\n", i/4); if (dbg) printf(" Free reg %d\n", i/4);
assert(t->Temps[i] == TEMP); assert(t->Temps[i] == TEMP);
@@ -206,7 +206,7 @@ alloc_reg(slang_var_table *vt, GLint size, GLboolean isTemp)
for (i = 0; i <= vt->MaxRegisters * 4 - size; i += step) { for (i = 0; i <= vt->MaxRegisters * 4 - size; i += step) {
GLuint found = 0; 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) { if (i + j < vt->MaxRegisters * 4 && t->Temps[i + j] == FREE) {
found++; found++;
} }
@@ -218,7 +218,7 @@ alloc_reg(slang_var_table *vt, GLint size, GLboolean isTemp)
/* found block of size free regs */ /* found block of size free regs */
if (size > 1) if (size > 1)
assert(i % 4 == 0); assert(i % 4 == 0);
for (j = 0; j < size; j++) for (j = 0; j < (GLuint) size; j++)
t->Temps[i + j] = isTemp ? TEMP : VAR; t->Temps[i + j] = isTemp ? TEMP : VAR;
assert(i < MAX_PROGRAM_TEMPS * 4); assert(i < MAX_PROGRAM_TEMPS * 4);
t->ValSize[i] = size; t->ValSize[i] = size;
@@ -313,7 +313,7 @@ _slang_free_temp(slang_var_table *vt, slang_ir_storage *store)
else { else {
/*assert(store->Swizzle == SWIZZLE_NOOP);*/ /*assert(store->Swizzle == SWIZZLE_NOOP);*/
assert(t->ValSize[r*4] == store->Size); 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); assert(t->Temps[r * 4 + i] == TEMP);
t->Temps[r * 4 + i] = FREE; t->Temps[r * 4 + i] = FREE;
} }
@@ -327,7 +327,7 @@ _slang_is_temp(const slang_var_table *vt, const slang_ir_storage *store)
struct table *t = vt->Top; struct table *t = vt->Top;
GLuint comp; GLuint comp;
assert(store->Index >= 0); assert(store->Index >= 0);
assert(store->Index < vt->MaxRegisters); assert(store->Index < (int) vt->MaxRegisters);
if (store->Swizzle == SWIZZLE_NOOP) if (store->Swizzle == SWIZZLE_NOOP)
comp = 0; comp = 0;
else else