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/main/api_loopback.c | 10 +++++----- src/mesa/main/arbprogram.c | 28 ++++++++++++++------------ src/mesa/main/arbvertparse.c | 8 ++++---- src/mesa/main/depth.c | 4 ++-- src/mesa/main/dlist.c | 20 +++++++++---------- src/mesa/main/imports.c | 2 +- src/mesa/main/macros.h | 9 +++++++++ src/mesa/main/matrix.c | 2 +- src/mesa/main/nvfragparse.c | 2 +- src/mesa/main/nvprogram.c | 4 ++-- src/mesa/main/nvvertexec.c | 4 ++-- src/mesa/main/occlude.c | 2 +- src/mesa/main/rastpos.c | 2 +- src/mesa/math/m_norm_tmp.h | 6 +++--- src/mesa/swrast/s_lines.c | 12 +++++------ src/mesa/swrast/s_nvfragprog.c | 13 ++++++------ src/mesa/swrast/s_tritemp.h | 45 +++++++++++++++++++++++++++++++----------- 17 files changed, 103 insertions(+), 70 deletions(-) (limited to 'src') diff --git a/src/mesa/main/api_loopback.c b/src/mesa/main/api_loopback.c index ecd701d..010a493 100644 --- a/src/mesa/main/api_loopback.c +++ b/src/mesa/main/api_loopback.c @@ -1642,31 +1642,31 @@ loopback_VertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v) static void loopback_VertexAttrib4bvARB(GLuint index, const GLbyte * v) { - ATTRIB(index, v[0], v[1], v[2], v[3]); + ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } static void loopback_VertexAttrib4ivARB(GLuint index, const GLint * v) { - ATTRIB(index, v[0], v[1], v[2], v[3]); + ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } static void loopback_VertexAttrib4ubvARB(GLuint index, const GLubyte * v) { - ATTRIB(index, v[0], v[1], v[2], v[3]); + ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } static void loopback_VertexAttrib4usvARB(GLuint index, const GLushort * v) { - ATTRIB(index, v[0], v[1], v[2], v[3]); + ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } static void loopback_VertexAttrib4uivARB(GLuint index, const GLuint * v) { - ATTRIB(index, v[0], v[1], v[2], v[3]); + ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } static void diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c index e5febdb..07ba462 100644 --- a/src/mesa/main/arbprogram.c +++ b/src/mesa/main/arbprogram.c @@ -146,16 +146,16 @@ _mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params) switch (pname) { case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB: - params[0] = ctx->Array.VertexAttrib[index].Enabled; + params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Enabled; break; case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB: - params[0] = ctx->Array.VertexAttrib[index].Size; + params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Size; break; case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB: - params[0] = ctx->Array.VertexAttrib[index].Stride; + params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Stride; break; case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB: - params[0] = ctx->Array.VertexAttrib[index].Type; + params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Type; break; case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB: params[0] = ctx->Array.VertexAttrib[index].Normalized; @@ -181,10 +181,10 @@ _mesa_GetVertexAttribivARB(GLuint index, GLenum pname, GLint *params) _mesa_GetVertexAttribfvARB(index, pname, fparams); if (ctx->ErrorValue == GL_NO_ERROR) { if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) { - COPY_4V(params, fparams); /* float to int */ + COPY_4V_CAST(params, fparams, GLint); /* float to int */ } else { - params[0] = fparams[0]; + params[0] = (GLint) fparams[0]; } } } @@ -245,7 +245,8 @@ void _mesa_ProgramEnvParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { - _mesa_ProgramEnvParameter4fARB(target, index, x, y, z, w); + _mesa_ProgramEnvParameter4fARB(target, index, (GLfloat) x, (GLfloat) y, + (GLfloat) z, (GLfloat) w); } @@ -253,8 +254,9 @@ void _mesa_ProgramEnvParameter4dvARB(GLenum target, GLuint index, const GLdouble *params) { - _mesa_ProgramEnvParameter4fARB(target, index, params[0], params[1], - params[2], params[3]); + _mesa_ProgramEnvParameter4fARB(target, index, (GLfloat) params[0], + (GLfloat) params[1], (GLfloat) params[2], + (GLfloat) params[3]); } @@ -821,7 +823,7 @@ _mesa_GetProgramRegisterfvMESA(GLenum target, if (reg[0] == 'R') { /* Temp register */ GLint i = _mesa_atoi(reg + 1); - if (i >= ctx->Const.MaxVertexProgramTemps) { + if (i >= (GLint)ctx->Const.MaxVertexProgramTemps) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramRegisterfvMESA(registerName)"); return; @@ -830,7 +832,7 @@ _mesa_GetProgramRegisterfvMESA(GLenum target, } else if (reg[0] == 'v' && reg[1] == '[') { /* Vertex Input attribute */ - GLint i; + GLuint i; for (i = 0; i < ctx->Const.MaxVertexProgramAttribs; i++) { const char *name = _mesa_nv_vertex_input_register_name(i); char number[10]; @@ -885,7 +887,7 @@ _mesa_GetProgramRegisterfvMESA(GLenum target, if (reg[0] == 'R') { /* Temp register */ GLint i = _mesa_atoi(reg + 1); - if (i >= ctx->Const.MaxFragmentProgramTemps) { + if (i >= (GLint)ctx->Const.MaxFragmentProgramTemps) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramRegisterfvMESA(registerName)"); return; @@ -894,7 +896,7 @@ _mesa_GetProgramRegisterfvMESA(GLenum target, } else if (reg[0] == 'f' && reg[1] == '[') { /* Fragment input attribute */ - GLint i; + GLuint i; for (i = 0; i < ctx->Const.MaxFragmentProgramAttribs; i++) { const char *name = _mesa_nv_fragment_input_register_name(i); if (_mesa_strncmp(reg + 2, name, 4) == 0) { diff --git a/src/mesa/main/arbvertparse.c b/src/mesa/main/arbvertparse.c index 6706f55..7492269 100644 --- a/src/mesa/main/arbvertparse.c +++ b/src/mesa/main/arbvertparse.c @@ -5528,7 +5528,7 @@ parse_tree_fold_bindings(parse_state * s, parse_tree_node * ptn) eat_children = 0; bind_row = 0; bind_nrows = 1; - bind_vals[0] = bind_vals[1] = bind_vals[2] = bind_vals[3]; + bind_vals[0] = bind_vals[1] = bind_vals[2] = bind_vals[3] = 0.0f; switch (ptn->prod_applied) { /* vertex */ case 121: @@ -6123,7 +6123,7 @@ parse_tree_fold_bindings(parse_state * s, parse_tree_node * ptn) #define FOLD_FLOAT_CONSTANT(float_ptr, bind_vals_idx, sign) \ if (float_ptr->tok == 49) /* GLfloat */ {\ - bind_vals[bind_vals_idx] = sign * s->floats.data[float_ptr->tok_attr];\ + bind_vals[bind_vals_idx] = sign * (GLfloat) s->floats.data[float_ptr->tok_attr];\ }\ else /* GLint */ {\ bind_vals[bind_vals_idx] = sign * s->ints.data[float_ptr->tok_attr];\ @@ -6131,9 +6131,9 @@ parse_tree_fold_bindings(parse_state * s, parse_tree_node * ptn) #define FOLD_SIGNED_FLOAT_CONSTANT(sf_ptr, bind_vals_idx) \ {\ - GLfloat __mul = 1.;\ + GLfloat __mul = 1.0F;\ if (sf_ptr->children[0]->prod_applied == 282) \ - __mul = -1.;\ + __mul = -1.0F;\ FOLD_FLOAT_CONSTANT(sf_ptr->children[1], bind_vals_idx, __mul);\ } diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c index 32c6162..1e07607 100644 --- a/src/mesa/main/depth.c +++ b/src/mesa/main/depth.c @@ -137,8 +137,8 @@ _mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax ) return; FLUSH_VERTICES(ctx, _NEW_DEPTH); - ctx->Depth.BoundsMin = zmin; - ctx->Depth.BoundsMax = zmax; + ctx->Depth.BoundsMin = (GLfloat) zmin; + ctx->Depth.BoundsMax = (GLfloat) zmax; } diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 1ebc4a0..abfc2df 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -4265,10 +4265,10 @@ save_ProgramLocalParameter4dARB(GLenum target, GLuint index, if (n) { n[1].e = target; n[2].ui = index; - n[3].f = x; - n[4].f = y; - n[5].f = z; - n[6].f = w; + n[3].f = (GLfloat) x; + n[4].f = (GLfloat) y; + n[5].f = (GLfloat) z; + n[6].f = (GLfloat) w; } if (ctx->ExecuteFlag) { (*ctx->Exec->ProgramLocalParameter4dARB)(target, index, x, y, z, w); @@ -4287,10 +4287,10 @@ save_ProgramLocalParameter4dvARB(GLenum target, GLuint index, if (n) { n[1].e = target; n[2].ui = index; - n[3].f = params[0]; - n[4].f = params[1]; - n[5].f = params[2]; - n[6].f = params[3]; + n[3].f = (GLfloat) params[0]; + n[4].f = (GLfloat) params[1]; + n[5].f = (GLfloat) params[2]; + n[6].f = (GLfloat) params[3]; } if (ctx->ExecuteFlag) { (*ctx->Exec->ProgramLocalParameter4dvARB)(target, index, params); @@ -4383,8 +4383,8 @@ static void save_DepthBoundsEXT( GLclampd zmin, GLclampd zmax ) ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 2 ); if (n) { - n[1].f = zmin; - n[2].f = zmax; + n[1].f = (GLfloat) zmin; + n[2].f = (GLfloat) zmax; } if (ctx->ExecuteFlag) { (*ctx->Exec->DepthBoundsEXT)( zmin, zmax ); diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 7597979..5960a95 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -489,7 +489,7 @@ _mesa_inv_sqrtf(float n) #elif defined(XFree86LOADER) && defined(IN_MODULE) return 1.0F / xf86sqrt(n); #else - return 1.0F / sqrt(n); + return (float) (1.0 / sqrt(n)); #endif } diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index f3c77ca..fcb63f5 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -146,6 +146,15 @@ do { \ (DST)[3] = (SRC)[3]; \ } while (0) +/** Copy a 4-element vector with cast */ +#define COPY_4V_CAST( DST, SRC, CAST ) \ +do { \ + (DST)[0] = (CAST)(SRC)[0]; \ + (DST)[1] = (CAST)(SRC)[1]; \ + (DST)[2] = (CAST)(SRC)[2]; \ + (DST)[3] = (CAST)(SRC)[3]; \ +} while (0) + /** Copy a 4-element unsigned byte vector */ #if defined(__i386__) #define COPY_4UBV(DST, SRC) \ diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c index 6a34858..e74e172 100644 --- a/src/mesa/main/matrix.c +++ b/src/mesa/main/matrix.c @@ -191,7 +191,7 @@ _mesa_MatrixMode( GLenum mode ) case GL_MATRIX7_ARB: if (ctx->Extensions.ARB_vertex_program || ctx->Extensions.ARB_fragment_program) { - const GLint m = mode - GL_MATRIX0_ARB; + const GLuint m = mode - GL_MATRIX0_ARB; if (m > ctx->Const.MaxProgramMatrices) { _mesa_error(ctx, GL_INVALID_ENUM, "glMatrixMode(GL_MATRIX%d_ARB)", m); diff --git a/src/mesa/main/nvfragparse.c b/src/mesa/main/nvfragparse.c index c202378..36840d0 100644 --- a/src/mesa/main/nvfragparse.c +++ b/src/mesa/main/nvfragparse.c @@ -204,7 +204,7 @@ lookup_parameter(struct parse_state *parseState, const char *name) static const GLint lookup_parameter_index(struct parse_state *parseState, const char *name) { - GLint i; + GLuint i; for (i = 0; i < parseState->numParameters; i++) { if (_mesa_strcmp(parseState->parameters[i].Name, name) == 0) return i; diff --git a/src/mesa/main/nvprogram.c b/src/mesa/main/nvprogram.c index 2fb062f..61dca50 100644 --- a/src/mesa/main/nvprogram.c +++ b/src/mesa/main/nvprogram.c @@ -1101,7 +1101,7 @@ _mesa_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name, { struct program *prog; struct fragment_program *fragProg; - GLint i; + GLuint i; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -1167,7 +1167,7 @@ _mesa_GetProgramNamedParameterfvNV(GLuint id, GLsizei len, const GLubyte *name, { struct program *prog; struct fragment_program *fragProg; - GLint i; + GLuint i; GET_CURRENT_CONTEXT(ctx); if (!ctx->_CurrentProgram) diff --git a/src/mesa/main/nvvertexec.c b/src/mesa/main/nvvertexec.c index 73d5440..e41bdfb 100644 --- a/src/mesa/main/nvvertexec.c +++ b/src/mesa/main/nvvertexec.c @@ -689,7 +689,7 @@ _mesa_exec_vertex_program(GLcontext *ctx, const struct vertex_program *program) { GLfloat t[4]; fetch_vector1( &inst->SrcReg[0], state, t ); - t[0] = t[1] = t[2] = t[3] = _mesa_pow(2.0, t[0]); + t[0] = t[1] = t[2] = t[3] = (GLfloat)_mesa_pow(2.0, t[0]); store_vector4( &inst->DstReg, state, t ); } break; @@ -706,7 +706,7 @@ _mesa_exec_vertex_program(GLcontext *ctx, const struct vertex_program *program) GLfloat t[4], u[4]; fetch_vector1( &inst->SrcReg[0], state, t ); fetch_vector1( &inst->SrcReg[1], state, u ); - t[0] = t[1] = t[2] = t[3] = _mesa_pow(t[0], u[0]); + t[0] = t[1] = t[2] = t[3] = (GLfloat)_mesa_pow(t[0], u[0]); store_vector4( &inst->DstReg, state, t ); } break; diff --git a/src/mesa/main/occlude.c b/src/mesa/main/occlude.c index f6dc705..871beb9 100644 --- a/src/mesa/main/occlude.c +++ b/src/mesa/main/occlude.c @@ -116,7 +116,7 @@ _mesa_GenQueriesARB(GLsizei n, GLuint *ids) first = _mesa_HashFindFreeKeyBlock(ctx->Occlusion.QueryObjects, n); if (first) { - GLuint i; + GLsizei i; for (i = 0; i < n; i++) { struct occlusion_query *q = new_query_object(GL_SAMPLES_PASSED_ARB, first + i); diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c index 218e4f7..7e39ddc 100644 --- a/src/mesa/main/rastpos.c +++ b/src/mesa/main/rastpos.c @@ -380,7 +380,7 @@ raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) } /* ndc = clip / W */ - d = (clip[3] == 0.0) ? 1.0 : 1.0F / clip[3]; + d = (clip[3] == 0.0F) ? 1.0F : 1.0F / clip[3]; ndc[0] = clip[0] * d; ndc[1] = clip[1] * d; ndc[2] = clip[2] * d; diff --git a/src/mesa/math/m_norm_tmp.h b/src/mesa/math/m_norm_tmp.h index 2b79455..a20cb05 100644 --- a/src/mesa/math/m_norm_tmp.h +++ b/src/mesa/math/m_norm_tmp.h @@ -323,9 +323,9 @@ TAG(normalize_normals)( const GLmatrix *mat, GLdouble len = x * x + y * y + z * z; if (len > 1e-50) { len = INV_SQRTF(len); - out[i][0] = x * len; - out[i][1] = y * len; - out[i][2] = z * len; + out[i][0] = (GLfloat)(x * len); + out[i][1] = (GLfloat)(y * len); + out[i][2] = (GLfloat)(z * len); } else { out[i][0] = x; diff --git a/src/mesa/swrast/s_lines.c b/src/mesa/swrast/s_lines.c index a9284d5..97143a2 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 cb3ca86..63a30d4 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 9706028..7e8cad6 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.1