From dc24230de7f913969b52dee3579bb8fa3d50a8c0 Mon Sep 17 00:00:00 2001 From: Karl Schultz Date: Sat, 30 Aug 2003 14:45:04 +0000 Subject: Silence compiler warnings about implicit casts or conversions by supplying explicit casts and/or tweaking constant and variable definitions. --- src/mesa/swrast/s_lines.c | 12 +++++------ src/mesa/swrast/s_nvfragprog.c | 13 ++++++------ src/mesa/swrast/s_tritemp.h | 45 +++++++++++++++++++++++++++++++----------- 3 files changed, 46 insertions(+), 24 deletions(-) (limited to 'src/mesa/swrast') diff --git a/src/mesa/swrast/s_lines.c b/src/mesa/swrast/s_lines.c index a9284d5029..97143a2f4b 100644 --- a/src/mesa/swrast/s_lines.c +++ b/src/mesa/swrast/s_lines.c @@ -123,14 +123,12 @@ draw_wide_line( GLcontext *ctx, struct sw_span *span, GLboolean xMajor ) /***** Rasterization *****/ /**********************************************************************/ - /* Simple color index line (no stipple, width=1, no Z, no fog, no tex)*/ #define NAME simple_ci_line #define INTERP_INDEX #define RENDER_SPAN(span) _swrast_write_index_span(ctx, &span) #include "s_linetemp.h" - /* Simple RGBA index line (no stipple, width=1, no Z, no fog, no tex)*/ #define NAME simple_rgba_line #define INTERP_RGBA @@ -146,10 +144,10 @@ draw_wide_line( GLcontext *ctx, struct sw_span *span, GLboolean xMajor ) #define RENDER_SPAN(span) \ if (ctx->Line.StippleFlag) { \ span.arrayMask |= SPAN_MASK; \ - compute_stipple_mask(ctx, span.end, span.array->mask); \ + compute_stipple_mask(ctx, span.end, span.array->mask); \ } \ if (ctx->Line.Width > 1.0) { \ - draw_wide_line(ctx, &span, dx > dy); \ + draw_wide_line(ctx, &span, (GLboolean)(dx > dy)); \ } \ else { \ _swrast_write_index_span(ctx, &span); \ @@ -168,7 +166,7 @@ draw_wide_line( GLcontext *ctx, struct sw_span *span, GLboolean xMajor ) compute_stipple_mask(ctx, span.end, span.array->mask); \ } \ if (ctx->Line.Width > 1.0) { \ - draw_wide_line(ctx, &span, dx > dy); \ + draw_wide_line(ctx, &span, (GLboolean)(dx > dy)); \ } \ else { \ _swrast_write_rgba_span(ctx, &span); \ @@ -188,7 +186,7 @@ draw_wide_line( GLcontext *ctx, struct sw_span *span, GLboolean xMajor ) compute_stipple_mask(ctx, span.end, span.array->mask); \ } \ if (ctx->Line.Width > 1.0) { \ - draw_wide_line(ctx, &span, dx > dy); \ + draw_wide_line(ctx, &span, (GLboolean)(dx > dy)); \ } \ else { \ _swrast_write_texture_span(ctx, &span); \ @@ -209,7 +207,7 @@ draw_wide_line( GLcontext *ctx, struct sw_span *span, GLboolean xMajor ) compute_stipple_mask(ctx, span.end, span.array->mask); \ } \ if (ctx->Line.Width > 1.0) { \ - draw_wide_line(ctx, &span, dx > dy); \ + draw_wide_line(ctx, &span, (GLboolean)(dx > dy)); \ } \ else { \ _swrast_write_texture_span(ctx, &span); \ diff --git a/src/mesa/swrast/s_nvfragprog.c b/src/mesa/swrast/s_nvfragprog.c index cb3ca86a53..63a30d4e7c 100644 --- a/src/mesa/swrast/s_nvfragprog.c +++ b/src/mesa/swrast/s_nvfragprog.c @@ -610,7 +610,7 @@ execute_program( GLcontext *ctx, { GLfloat a[4], result[4]; fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); - result[0] = result[1] = result[2] = result[3] = _mesa_cos(a[0]); + result[0] = result[1] = result[2] = result[3] = (GLfloat)_mesa_cos(a[0]); store_vector4( inst, machine, result ); } break; @@ -755,7 +755,7 @@ execute_program( GLcontext *ctx, a[1] = 0.0F; result[0] = 1.0F; result[1] = a[0]; - result[2] = (a[0] > 0.0) ? _mesa_pow(2.0, a[3]) : 0.0F; + result[2] = (a[0] > 0.0F) ? (GLfloat)_mesa_pow(2.0, a[3]) : 0.0F; result[3] = 1.0F; store_vector4( inst, machine, result ); } @@ -903,7 +903,7 @@ execute_program( GLcontext *ctx, fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); fetch_vector1( ctx, &inst->SrcReg[1], machine, program, b ); result[0] = result[1] = result[2] = result[3] - = _mesa_pow(a[0], b[0]); + = (GLfloat)_mesa_pow(a[0], b[0]); store_vector4( inst, machine, result ); } break; @@ -997,7 +997,8 @@ execute_program( GLcontext *ctx, { GLfloat a[4], result[4]; fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); - result[0] = result[1] = result[2] = result[3] = _mesa_sin(a[0]); + result[0] = result[1] = result[2] = + result[3] = (GLfloat)_mesa_sin(a[0]); store_vector4( inst, machine, result ); } break; @@ -1184,8 +1185,8 @@ init_machine( GLcontext *ctx, struct fp_machine *machine, /* Load input registers */ if (inputsRead & (1 << FRAG_ATTRIB_WPOS)) { GLfloat *wpos = machine->Inputs[FRAG_ATTRIB_WPOS]; - wpos[0] = span->x + col; - wpos[1] = span->y; + wpos[0] = (GLfloat) span->x + col; + wpos[1] = (GLfloat) span->y; wpos[2] = (GLfloat) span->array->z[col] / ctx->DepthMaxF; wpos[3] = span->w + col * span->dwdx; } diff --git a/src/mesa/swrast/s_tritemp.h b/src/mesa/swrast/s_tritemp.h index 97060285e5..7e8cad6f33 100644 --- a/src/mesa/swrast/s_tritemp.h +++ b/src/mesa/swrast/s_tritemp.h @@ -392,11 +392,25 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, else { ASSERT (ctx->Light.ShadeModel == GL_FLAT); span.interpMask |= SPAN_FLAT; - span.drdx = span.drdy = span.redStep = 0; - span.dgdx = span.dgdy = span.greenStep = 0; - span.dbdx = span.dbdy = span.blueStep = 0; + span.drdx = span.drdy = 0.0F; + span.dgdx = span.dgdy = 0.0F; + span.dbdx = span.dbdy = 0.0F; +# if CHAN_TYPE == GL_FLOAT + span.redStep = 0.0F; + span.greenStep = 0.0F; + span.blueStep = 0.0F; +# else + span.redStep = 0; + span.greenStep = 0; + span.blueStep = 0; +# endif /* GL_FLOAT */ # ifdef INTERP_ALPHA - span.dadx = span.dady = span.alphaStep = 0; + span.dadx = span.dady = 0.0F; +# if CHAN_TYPE == GL_FLOAT + span.alphaStep = 0.0F; +# else + span.alphaStep = 0; +# endif /* GL_FLOAT */ # endif } #endif /* INTERP_RGB */ @@ -426,9 +440,18 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, # endif } else { - span.dsrdx = span.dsrdy = span.specRedStep = 0; - span.dsgdx = span.dsgdy = span.specGreenStep = 0; - span.dsbdx = span.dsbdy = span.specBlueStep = 0; + span.dsrdx = span.dsrdy = 0.0F; + span.dsgdx = span.dsgdy = 0.0F; + span.dsbdx = span.dsbdy = 0.0F; +# if CHAN_TYPE == GL_FLOAT + span.specRedStep = 0.0F; + span.specGreenStep = 0.0F; + span.specBlueStep = 0.0F; +# else + span.specRedStep = 0; + span.specGreenStep = 0; + span.specBlueStep = 0; +# endif } #endif /* INTERP_SPEC */ #ifdef INTERP_INDEX @@ -721,9 +744,9 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, fdgOuter = span.dgdy + dxOuter * span.dgdx; fdbOuter = span.dbdy + dxOuter * span.dbdx; # else - rLeft = (ChanToFixed(vLower->color[RCOMP]) + span.drdx * adjx + span.drdy * adjy) + FIXED_HALF; - gLeft = (ChanToFixed(vLower->color[GCOMP]) + span.dgdx * adjx + span.dgdy * adjy) + FIXED_HALF; - bLeft = (ChanToFixed(vLower->color[BCOMP]) + span.dbdx * adjx + span.dbdy * adjy) + FIXED_HALF; + rLeft = (GLint)(ChanToFixed(vLower->color[RCOMP]) + span.drdx * adjx + span.drdy * adjy) + FIXED_HALF; + gLeft = (GLint)(ChanToFixed(vLower->color[GCOMP]) + span.dgdx * adjx + span.dgdy * adjy) + FIXED_HALF; + bLeft = (GLint)(ChanToFixed(vLower->color[BCOMP]) + span.dbdx * adjx + span.dbdy * adjy) + FIXED_HALF; fdrOuter = SignedFloatToFixed(span.drdy + dxOuter * span.drdx); fdgOuter = SignedFloatToFixed(span.dgdy + dxOuter * span.dgdx); fdbOuter = SignedFloatToFixed(span.dbdy + dxOuter * span.dbdx); @@ -733,7 +756,7 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, aLeft = vLower->color[ACOMP] + (span.dadx * adjx + span.dady * adjy) * (1.0F / FIXED_SCALE); fdaOuter = span.dady + dxOuter * span.dadx; # else - aLeft = (ChanToFixed(vLower->color[ACOMP]) + span.dadx * adjx + span.dady * adjy) + FIXED_HALF; + aLeft = (GLint)(ChanToFixed(vLower->color[ACOMP]) + span.dadx * adjx + span.dady * adjy) + FIXED_HALF; fdaOuter = SignedFloatToFixed(span.dady + dxOuter * span.dadx); # endif # endif -- cgit v1.2.3