summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorKarl Schultz <karl.w.schultz@gmail.com>2010-02-13 17:31:58 -0700
committerKarl Schultz <karl.w.schultz@gmail.com>2010-02-13 17:34:04 -0700
commitb30898f4ab533085d97a33638ad0a1cf9ddb1d67 (patch)
tree7c27558e2905da625b75060628967d3d52fe6728 /src/mesa
parent5fd2b46a20321d8600d6256bff17ec3ebc9cb510 (diff)
mesa: Fix compiler warnings
Add explicit casts, fix constant types, fix variable types. Fixes about 340 warnings in MSFT Visual Studio.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/clear.c18
-rw-r--r--src/mesa/main/image.c8
-rw-r--r--src/mesa/main/macros.h4
-rw-r--r--src/mesa/main/texgetimage.c4
-rw-r--r--src/mesa/shader/nvprogram.c6
-rw-r--r--src/mesa/shader/prog_execute.c12
-rw-r--r--src/mesa/shader/prog_parameter.c2
-rw-r--r--src/mesa/shader/slang/slang_codegen.c2
-rw-r--r--src/mesa/shader/slang/slang_compile.c2
-rw-r--r--src/mesa/swrast/s_aatritemp.h4
-rw-r--r--src/mesa/swrast/s_atifragshader.c4
-rw-r--r--src/mesa/swrast/s_clear.c2
-rw-r--r--src/mesa/swrast/s_texcombine.c2
-rw-r--r--src/mesa/swrast_setup/ss_context.c2
-rw-r--r--src/mesa/swrast_setup/ss_tritmp.h12
-rw-r--r--src/mesa/tnl/t_draw.c2
16 files changed, 43 insertions, 43 deletions
diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c
index 4a3c111658..8085bedf1c 100644
--- a/src/mesa/main/clear.c
+++ b/src/mesa/main/clear.c
@@ -236,7 +236,7 @@ make_color_buffer_mask(GLcontext *ctx, GLint drawbuffer)
mask |= BUFFER_BIT_BACK_RIGHT;
break;
default:
- if (drawbuffer < 0 || drawbuffer >= ctx->Const.MaxDrawBuffers) {
+ if (drawbuffer < 0 || drawbuffer >= (GLint)ctx->Const.MaxDrawBuffers) {
mask = INVALID_MASK;
}
else if (att[BUFFER_COLOR0 + drawbuffer].Renderbuffer) {
@@ -306,11 +306,11 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
* floating point state var. This will not always work. We'll
* need a new ctx->Driver.ClearBuffer() hook....
*/
- GLfloat clearSave[4];
+ GLclampf clearSave[4];
/* save color */
COPY_4V(clearSave, ctx->Color.ClearColor);
/* set color */
- COPY_4V(ctx->Color.ClearColor, value);
+ COPY_4V_CAST(ctx->Color.ClearColor, value, GLclampf);
if (ctx->Driver.ClearColor)
ctx->Driver.ClearColor(ctx, ctx->Color.ClearColor);
/* clear buffer(s) */
@@ -365,11 +365,11 @@ _mesa_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
* floating point state var. This will not always work. We'll
* need a new ctx->Driver.ClearBuffer() hook....
*/
- GLfloat clearSave[4];
+ GLclampf clearSave[4];
/* save color */
COPY_4V(clearSave, ctx->Color.ClearColor);
/* set color */
- COPY_4V(ctx->Color.ClearColor, value);
+ COPY_4V_CAST(ctx->Color.ClearColor, value, GLclampf);
if (ctx->Driver.ClearColor)
ctx->Driver.ClearColor(ctx, ctx->Color.ClearColor);
/* clear buffer(s) */
@@ -423,7 +423,7 @@ _mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
* XXX in the future we may have a new ctx->Driver.ClearBuffer()
* hook instead.
*/
- const GLfloat clearSave = ctx->Depth.Clear;
+ const GLclampd clearSave = ctx->Depth.Clear;
ctx->Depth.Clear = *value;
if (ctx->Driver.ClearDepth)
ctx->Driver.ClearDepth(ctx, *value);
@@ -443,11 +443,11 @@ _mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
return;
}
else if (mask) {
- GLfloat clearSave[4];
+ GLclampf clearSave[4];
/* save color */
COPY_4V(clearSave, ctx->Color.ClearColor);
/* set color */
- COPY_4V(ctx->Color.ClearColor, value);
+ COPY_4V_CAST(ctx->Color.ClearColor, value, GLclampf);
if (ctx->Driver.ClearColor)
ctx->Driver.ClearColor(ctx, ctx->Color.ClearColor);
/* clear buffer(s) */
@@ -503,7 +503,7 @@ _mesa_ClearBufferfi(GLenum buffer, GLint drawbuffer,
{
/* save current clear values */
- const GLfloat clearDepthSave = ctx->Depth.Clear;
+ const GLclampd clearDepthSave = ctx->Depth.Clear;
const GLuint clearStencilSave = ctx->Stencil.Clear;
/* set new clear values */
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index 81993e7063..468f2a9b21 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -5662,7 +5662,7 @@ clip_right_or_top(GLint *srcX0, GLint *srcX1,
/* chop off [t, 1] part */
ASSERT(t >= 0.0 && t <= 1.0);
*dstX1 = maxValue;
- bias = (*srcX0 < *srcX1) ? 0.5 : -0.5;
+ bias = (*srcX0 < *srcX1) ? 0.5F : -0.5F;
*srcX1 = *srcX0 + (GLint) (t * (*srcX1 - *srcX0) + bias);
}
else if (*dstX0 > maxValue) {
@@ -5672,7 +5672,7 @@ clip_right_or_top(GLint *srcX0, GLint *srcX1,
/* chop off [t, 1] part */
ASSERT(t >= 0.0 && t <= 1.0);
*dstX0 = maxValue;
- bias = (*srcX0 < *srcX1) ? -0.5 : 0.5;
+ bias = (*srcX0 < *srcX1) ? -0.5F : 0.5F;
*srcX0 = *srcX1 + (GLint) (t * (*srcX0 - *srcX1) + bias);
}
}
@@ -5695,7 +5695,7 @@ clip_left_or_bottom(GLint *srcX0, GLint *srcX1,
/* chop off [0, t] part */
ASSERT(t >= 0.0 && t <= 1.0);
*dstX0 = minValue;
- bias = (*srcX0 < *srcX1) ? 0.5 : -0.5; /* flipped??? */
+ bias = (*srcX0 < *srcX1) ? 0.5F : -0.5F; /* flipped??? */
*srcX0 = *srcX0 + (GLint) (t * (*srcX1 - *srcX0) + bias);
}
else if (*dstX1 < minValue) {
@@ -5705,7 +5705,7 @@ clip_left_or_bottom(GLint *srcX0, GLint *srcX1,
/* chop off [0, t] part */
ASSERT(t >= 0.0 && t <= 1.0);
*dstX1 = minValue;
- bias = (*srcX0 < *srcX1) ? 0.5 : -0.5;
+ bias = (*srcX0 < *srcX1) ? 0.5F : -0.5F;
*srcX1 = *srcX1 + (GLint) (t * (*srcX0 - *srcX1) + bias);
}
}
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index 55578adf83..38a97fdb18 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -83,14 +83,14 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
/** Convert GLuint in [0,4294967295] to GLfloat in [0.0,1.0] */
-#define UINT_TO_FLOAT(U) ((GLfloat) (U) * (1.0F / 4294967295.0))
+#define UINT_TO_FLOAT(U) ((GLfloat) ((U) * (1.0F / 4294967295.0)))
/** Convert GLfloat in [0.0,1.0] to GLuint in [0,4294967295] */
#define FLOAT_TO_UINT(X) ((GLuint) ((X) * 4294967295.0))
/** Convert GLint in [-2147483648,2147483647] to GLfloat in [-1.0,1.0] */
-#define INT_TO_FLOAT(I) ((2.0F * (I) + 1.0F) * (1.0F/4294967294.0))
+#define INT_TO_FLOAT(I) ((GLfloat) ((2.0F * (I) + 1.0F) * (1.0F/4294967294.0)))
/** Convert GLfloat in [-1.0,1.0] to GLint in [-2147483648,2147483647] */
/* causes overflow:
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 66d01c15d0..6b3355a7ec 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -590,7 +590,7 @@ getteximage_error_check(GLcontext *ctx, GLenum target, GLint level,
{
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- const GLuint maxLevels = _mesa_max_texture_levels(ctx, target);
+ const GLint maxLevels = _mesa_max_texture_levels(ctx, target);
GLenum baseFormat;
if (maxLevels == 0) {
@@ -776,7 +776,7 @@ getcompressedteximage_error_check(GLcontext *ctx, GLenum target, GLint level,
{
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- const GLuint maxLevels = _mesa_max_texture_levels(ctx, target);
+ const GLint maxLevels = _mesa_max_texture_levels(ctx, target);
if (maxLevels == 0) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImage(target=0x%x)",
diff --git a/src/mesa/shader/nvprogram.c b/src/mesa/shader/nvprogram.c
index 87f295e39a..c3b10f5d9b 100644
--- a/src/mesa/shader/nvprogram.c
+++ b/src/mesa/shader/nvprogram.c
@@ -570,15 +570,15 @@ _mesa_setup_nv_temporary_count(GLcontext *ctx, struct gl_program *program)
inst->DstReg.Index + 1);
}
if (inst->SrcReg[0].File == PROGRAM_TEMPORARY) {
- program->NumTemporaries = MAX2(program->NumTemporaries,
+ program->NumTemporaries = MAX2((GLint)program->NumTemporaries,
inst->SrcReg[0].Index + 1);
}
if (inst->SrcReg[1].File == PROGRAM_TEMPORARY) {
- program->NumTemporaries = MAX2(program->NumTemporaries,
+ program->NumTemporaries = MAX2((GLint)program->NumTemporaries,
inst->SrcReg[1].Index + 1);
}
if (inst->SrcReg[2].File == PROGRAM_TEMPORARY) {
- program->NumTemporaries = MAX2(program->NumTemporaries,
+ program->NumTemporaries = MAX2((GLint)program->NumTemporaries,
inst->SrcReg[2].Index + 1);
}
}
diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c
index 7781cb3f7f..aea4b074b3 100644
--- a/src/mesa/shader/prog_execute.c
+++ b/src/mesa/shader/prog_execute.c
@@ -599,13 +599,13 @@ store_vector4ui(const struct prog_instruction *inst,
if (inst->CondUpdate) {
if (writeMask & WRITEMASK_X)
- machine->CondCodes[0] = generate_cc(value[0]);
+ machine->CondCodes[0] = generate_cc((float)value[0]);
if (writeMask & WRITEMASK_Y)
- machine->CondCodes[1] = generate_cc(value[1]);
+ machine->CondCodes[1] = generate_cc((float)value[1]);
if (writeMask & WRITEMASK_Z)
- machine->CondCodes[2] = generate_cc(value[2]);
+ machine->CondCodes[2] = generate_cc((float)value[2]);
if (writeMask & WRITEMASK_W)
- machine->CondCodes[3] = generate_cc(value[3]);
+ machine->CondCodes[3] = generate_cc((float)value[3]);
#if DEBUG_PROG
printf("CondCodes=(%s,%s,%s,%s) for:\n",
_mesa_condcode_string(machine->CondCodes[0]),
@@ -1000,7 +1000,7 @@ _mesa_execute_program(GLcontext * ctx,
val = -FLT_MAX;
}
else {
- val = log(a[0]) * 1.442695F;
+ val = (float)(log(a[0]) * 1.442695F);
}
result[0] = result[1] = result[2] = result[3] = val;
store_vector4(inst, machine, result);
@@ -1065,7 +1065,7 @@ _mesa_execute_program(GLcontext * ctx,
/* The fast LOG2 macro doesn't meet the precision
* requirements.
*/
- q[2] = (log(t[0]) * 1.442695F);
+ q[2] = (float)(log(t[0]) * 1.442695F);
}
}
else {
diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c
index 5822510701..d4970c4e44 100644
--- a/src/mesa/shader/prog_parameter.c
+++ b/src/mesa/shader/prog_parameter.c
@@ -209,7 +209,7 @@ _mesa_add_named_constant(struct gl_program_parameter_list *paramList,
{
/* first check if this is a duplicate constant */
GLint pos;
- for (pos = 0; pos < paramList->NumParameters; pos++) {
+ for (pos = 0; pos < (GLint)paramList->NumParameters; pos++) {
const GLfloat *pvals = paramList->ParameterValues[pos];
if (pvals[0] == values[0] &&
pvals[1] == values[1] &&
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 83098b7350..fe4bddf9ad 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -3117,7 +3117,7 @@ _slang_can_unroll_for_loop(slang_assemble_ctx * A, const slang_operation *oper)
if (start >= end)
return GL_FALSE; /* degenerate case */
- if (end - start > MAX_FOR_LOOP_UNROLL_ITERATIONS) {
+ if ((GLuint)(end - start) > MAX_FOR_LOOP_UNROLL_ITERATIONS) {
slang_info_log_print(A->log,
"Note: 'for (%s=%d; %s<%d; ++%s)' is too"
" many iterations to unroll",
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index 1dce3adf89..33964e0c3b 100644
--- a/src/mesa/shader/slang/slang_compile.c
+++ b/src/mesa/shader/slang/slang_compile.c
@@ -239,7 +239,7 @@ parse_general_number(slang_parse_ctx *ctx, float *number)
}
parse_identifier_str(ctx, &flt);
- flt = strdup(flt);
+ flt = _mesa_strdup(flt);
if (!flt) {
return 0;
}
diff --git a/src/mesa/swrast/s_aatritemp.h b/src/mesa/swrast/s_aatritemp.h
index a8b22c548f..76d4005b8c 100644
--- a/src/mesa/swrast/s_aatritemp.h
+++ b/src/mesa/swrast/s_aatritemp.h
@@ -328,11 +328,11 @@
#if defined(DO_ATTRIBS)
/* compute attributes at left-most fragment */
- span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 1.5, iy + 0.5F, wPlane);
+ span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 1.5F, iy + 0.5F, wPlane);
ATTRIB_LOOP_BEGIN
GLuint c;
for (c = 0; c < 4; c++) {
- span.attrStart[attr][c] = solve_plane(ix + 1.5, iy + 0.5F, attrPlane[attr][c]);
+ span.attrStart[attr][c] = solve_plane(ix + 1.5F, iy + 0.5F, attrPlane[attr][c]);
}
ATTRIB_LOOP_END
#endif
diff --git a/src/mesa/swrast/s_atifragshader.c b/src/mesa/swrast/s_atifragshader.c
index 05da64de3a..0f06cdf9f9 100644
--- a/src/mesa/swrast/s_atifragshader.c
+++ b/src/mesa/swrast/s_atifragshader.c
@@ -86,7 +86,7 @@ apply_swizzle(GLfloat values[4], GLuint swizzle)
q = 0.000000001F;
values[0] = s / q;
values[1] = t / q;
- values[2] = 1.0 / q;
+ values[2] = 1.0F / q;
break;
}
values[3] = 0.0;
@@ -138,7 +138,7 @@ apply_src_mod(GLint optype, GLuint mod, GLfloat * val)
val[i] = 1 - val[i];
if (mod & GL_BIAS_BIT_ATI)
- val[i] = val[i] - 0.5;
+ val[i] = val[i] - 0.5F;
if (mod & GL_2X_BIT_ATI)
val[i] = 2 * val[i];
diff --git a/src/mesa/swrast/s_clear.c b/src/mesa/swrast/s_clear.c
index 21167a64b3..820297f3ee 100644
--- a/src/mesa/swrast/s_clear.c
+++ b/src/mesa/swrast/s_clear.c
@@ -77,7 +77,7 @@ clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb,
UNCLAMPED_FLOAT_TO_USHORT(clearColor[BCOMP], ctx->Color.ClearColor[2]);
UNCLAMPED_FLOAT_TO_USHORT(clearColor[ACOMP], ctx->Color.ClearColor[3]);
for (i = 0; i < width; i++) {
- COPY_4V(span.array->rgba[i], clearColor);
+ COPY_4V_CAST(span.array->rgba[i], clearColor, GLchan);
}
}
else {
diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c
index 95e2c082ba..f322663ad4 100644
--- a/src/mesa/swrast/s_texcombine.c
+++ b/src/mesa/swrast/s_texcombine.c
@@ -368,7 +368,7 @@ texture_combine( GLcontext *ctx, GLuint unit, GLuint n,
(arg0[i][GCOMP] - 0.5F) * (arg1[i][GCOMP] - 0.5F) +
(arg0[i][BCOMP] - 0.5F) * (arg1[i][BCOMP] - 0.5F))
* 4.0F * scaleRGB;
- dot = CLAMP(dot, 0.0, 1.0F);
+ dot = CLAMP(dot, 0.0F, 1.0F);
rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = dot;
}
break;
diff --git a/src/mesa/swrast_setup/ss_context.c b/src/mesa/swrast_setup/ss_context.c
index 61172f9979..23d3cb3807 100644
--- a/src/mesa/swrast_setup/ss_context.c
+++ b/src/mesa/swrast_setup/ss_context.c
@@ -122,7 +122,7 @@ setup_vertex_format(GLcontext *ctx)
swsetup->last_index_bitset)) {
DECLARE_RENDERINPUTS(index_bitset);
struct tnl_attr_map map[_TNL_ATTRIB_MAX];
- int i, e = 0;
+ unsigned int i, e = 0;
swsetup->intColors = intColors;
diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h
index d9bf54dd46..b9b78e16b0 100644
--- a/src/mesa/swrast_setup/ss_tritmp.h
+++ b/src/mesa/swrast_setup/ss_tritmp.h
@@ -132,9 +132,9 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
saved_index[1] = v[1]->attrib[FRAG_ATTRIB_CI][0];
saved_index[2] = v[2]->attrib[FRAG_ATTRIB_CI][0];
- SS_IND(v[0]->attrib[FRAG_ATTRIB_CI][0], (GLuint) vbindex[e0]);
- SS_IND(v[1]->attrib[FRAG_ATTRIB_CI][0], (GLuint) vbindex[e1]);
- SS_IND(v[2]->attrib[FRAG_ATTRIB_CI][0], (GLuint) vbindex[e2]);
+ SS_IND(v[0]->attrib[FRAG_ATTRIB_CI][0], vbindex[e0]);
+ SS_IND(v[1]->attrib[FRAG_ATTRIB_CI][0], vbindex[e1]);
+ SS_IND(v[2]->attrib[FRAG_ATTRIB_CI][0], vbindex[e2]);
}
}
}
@@ -159,9 +159,9 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
offset += MAX2(dzdx, dzdy) * ctx->Polygon.OffsetFactor;
}
/* new Z values */
- oz0 = CLAMP(v[0]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0, max);
- oz1 = CLAMP(v[1]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0, max);
- oz2 = CLAMP(v[2]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0, max);
+ oz0 = CLAMP(v[0]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0F, max);
+ oz1 = CLAMP(v[1]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0F, max);
+ oz2 = CLAMP(v[2]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0F, max);
}
}
diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index 812d712b07..149f693711 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -429,7 +429,7 @@ void _tnl_draw_prims( GLcontext *ctx,
_tnl_vbo_draw_prims );
return;
}
- else if (max_index + max_basevertex > max) {
+ else if ((GLint)max_index + max_basevertex > max) {
/* The software TNL pipeline has a fixed amount of storage for
* vertices and it is necessary to split incoming drawing commands
* if they exceed that limit.