From 7c4268176eaaeb45003db4d5042a518b84c9f6dc Mon Sep 17 00:00:00 2001 From: Karl Schultz Date: Wed, 19 Sep 2001 20:30:44 +0000 Subject: [PATCH] silence compiler warnings (last batch for src) --- src/mesa/main/convolve.c | 16 +++++++++--- src/mesa/main/texstore.c | 30 ++++++++++----------- src/mesa/swrast/s_aalinetemp.h | 6 ++--- src/mesa/swrast/s_aatriangle.c | 4 +-- src/mesa/swrast/s_aatritemp.h | 8 +++--- src/mesa/swrast/s_accum.c | 4 +-- src/mesa/swrast/s_feedback.c | 4 +-- src/mesa/swrast/s_fog.c | 24 ++++++++--------- src/mesa/swrast/s_pointtemp.h | 6 ++--- src/mesa/swrast/s_texture.c | 6 ++--- src/mesa/swrast/s_triangle.c | 30 +++++++++++---------- src/mesa/swrast/s_tritemp.h | 48 ++++++++++++++++++++++------------ 12 files changed, 106 insertions(+), 80 deletions(-) diff --git a/src/mesa/main/convolve.c b/src/mesa/main/convolve.c index faea445e4c8..1ec5993572d 100644 --- a/src/mesa/main/convolve.c +++ b/src/mesa/main/convolve.c @@ -1,4 +1,4 @@ -/* $Id: convolve.c,v 1.24 2001/05/09 22:24:22 brianp Exp $ */ +/* $Id: convolve.c,v 1.25 2001/09/19 20:30:44 kschultz Exp $ */ /* * Mesa 3-D graphics library @@ -450,10 +450,20 @@ _mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) } break; case GL_CONVOLUTION_FILTER_SCALE: - COPY_4V(ctx->Pixel.ConvolutionFilterScale[c], params); + /* COPY_4V(ctx->Pixel.ConvolutionFilterScale[c], params); */ + /* need cast to prevent compiler warnings */ + ctx->Pixel.ConvolutionFilterScale[c][0] = (GLfloat) params[0]; + ctx->Pixel.ConvolutionFilterScale[c][1] = (GLfloat) params[1]; + ctx->Pixel.ConvolutionFilterScale[c][2] = (GLfloat) params[2]; + ctx->Pixel.ConvolutionFilterScale[c][3] = (GLfloat) params[3]; break; case GL_CONVOLUTION_FILTER_BIAS: - COPY_4V(ctx->Pixel.ConvolutionFilterBias[c], params); + /* COPY_4V(ctx->Pixel.ConvolutionFilterBias[c], params); */ + /* need cast to prevent compiler warnings */ + ctx->Pixel.ConvolutionFilterBias[c][0] = (GLfloat) params[0]; + ctx->Pixel.ConvolutionFilterBias[c][1] = (GLfloat) params[1]; + ctx->Pixel.ConvolutionFilterBias[c][2] = (GLfloat) params[2]; + ctx->Pixel.ConvolutionFilterBias[c][3] = (GLfloat) params[3]; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(pname)"); diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 480ad07232c..9798e32390f 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1,4 +1,4 @@ -/* $Id: texstore.c,v 1.33 2001/07/23 16:07:12 brianp Exp $ */ +/* $Id: texstore.c,v 1.34 2001/09/19 20:30:44 kschultz Exp $ */ /* * Mesa 3-D graphics library @@ -1032,7 +1032,7 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, const GLchan (*rowA)[4] = (const GLchan (*)[4]) srcRowA; const GLchan (*rowB)[4] = (const GLchan (*)[4]) srcRowB; GLchan (*dst)[4] = (GLchan (*)[4]) dstRow; - for (i = j = 0, k = k0; i < dstWidth; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4; @@ -1051,7 +1051,7 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, const GLchan (*rowA)[3] = (const GLchan (*)[3]) srcRowA; const GLchan (*rowB)[3] = (const GLchan (*)[3]) srcRowB; GLchan (*dst)[3] = (GLchan (*)[3]) dstRow; - for (i = j = 0, k = k0; i < dstWidth; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4; @@ -1071,7 +1071,7 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, const GLchan *rowA = (const GLchan *) srcRowA; const GLchan *rowB = (const GLchan *) srcRowB; GLchan *dst = (GLchan *) dstRow; - for (i = j = 0, k = k0; i < dstWidth; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4; } @@ -1083,7 +1083,7 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, const GLchan (*rowA)[2] = (const GLchan (*)[2]) srcRowA; const GLchan (*rowB)[2] = (const GLchan (*)[2]) srcRowB; GLchan (*dst)[2] = (GLchan (*)[2]) dstRow; - for (i = j = 0, k = k0; i < dstWidth; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4; @@ -1098,7 +1098,7 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, const GLfloat *rowA = (const GLfloat *) srcRowA; const GLfloat *rowB = (const GLfloat *) srcRowB; GLfloat *dst = (GLfloat *) dstRow; - for (i = j = 0, k = k0; i < dstWidth; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) * 0.25F; } @@ -1112,7 +1112,7 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, const GLubyte (*rowA)[4] = (const GLubyte (*)[4]) srcRowA; const GLubyte (*rowB)[4] = (const GLubyte (*)[4]) srcRowB; GLubyte (*dst)[4] = (GLubyte (*)[4]) dstRow; - for (i = j = 0, k = k0; i < dstWidth; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4; @@ -1131,7 +1131,7 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, const GLubyte (*rowA)[3] = (const GLubyte (*)[3]) srcRowA; const GLubyte (*rowB)[3] = (const GLubyte (*)[3]) srcRowB; GLubyte (*dst)[3] = (GLubyte (*)[3]) dstRow; - for (i = j = 0, k = k0; i < dstWidth; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4; @@ -1148,7 +1148,7 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, const GLushort *rowA = (const GLushort *) srcRowA; const GLushort *rowB = (const GLushort *) srcRowB; GLushort *dst = (GLushort *) dstRow; - for (i = j = 0, k = k0; i < dstWidth; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { const GLint rowAr0 = rowA[j] & 0x1f; const GLint rowAr1 = rowA[k] & 0x1f; @@ -1175,7 +1175,7 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, const GLushort *rowA = (const GLushort *) srcRowA; const GLushort *rowB = (const GLushort *) srcRowB; GLushort *dst = (GLushort *) dstRow; - for (i = j = 0, k = k0; i < dstWidth; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { const GLint rowAr0 = rowA[j] & 0xf; const GLint rowAr1 = rowA[k] & 0xf; @@ -1207,7 +1207,7 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, const GLushort *rowA = (const GLushort *) srcRowA; const GLushort *rowB = (const GLushort *) srcRowB; GLushort *dst = (GLushort *) dstRow; - for (i = j = 0, k = k0; i < dstWidth; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { const GLint rowAr0 = rowA[j] & 0x1f; const GLint rowAr1 = rowA[k] & 0x1f; @@ -1239,7 +1239,7 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, const GLubyte (*rowA)[2] = (const GLubyte (*)[2]) srcRowA; const GLubyte (*rowB)[2] = (const GLubyte (*)[2]) srcRowB; GLubyte (*dst)[2] = (GLubyte (*)[2]) dstRow; - for (i = j = 0, k = k0; i < dstWidth; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) >> 2; @@ -1254,7 +1254,7 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, const GLubyte *rowA = (const GLubyte *) srcRowA; const GLubyte *rowB = (const GLubyte *) srcRowB; GLubyte *dst = (GLubyte *) dstRow; - for (i = j = 0, k = k0; i < dstWidth; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { const GLint rowAr0 = rowA[j] & 0x3; const GLint rowAr1 = rowA[k] & 0x3; @@ -1284,7 +1284,7 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, const GLubyte *rowA = (const GLubyte *) srcRowA; const GLubyte *rowB = (const GLubyte *) srcRowB; GLubyte *dst = (GLubyte *) dstRow; - for (i = j = 0, k = k0; i < dstWidth; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) >> 2; } @@ -1615,7 +1615,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB, 0 }; const GLenum *targets; - GLuint level; + GLint level; GLint maxLevels = 0; ASSERT(texObj); diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h index 5808245948a..2d8f8492e0e 100644 --- a/src/mesa/swrast/s_aalinetemp.h +++ b/src/mesa/swrast/s_aalinetemp.h @@ -1,4 +1,4 @@ -/* $Id: s_aalinetemp.h,v 1.13 2001/09/18 23:06:14 kschultz Exp $ */ +/* $Id: s_aalinetemp.h,v 1.14 2001/09/19 20:30:44 kschultz Exp $ */ /* * Mesa 3-D graphics library @@ -212,10 +212,10 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) #ifdef DO_INDEX if (ctx->Light.ShadeModel == GL_SMOOTH) { compute_plane(line.x0, line.y0, line.x1, line.y1, - v0->index, v1->index, line.iPlane); + (GLfloat) v0->index, (GLfloat) v1->index, line.iPlane); } else { - constant_plane(v1->index, line.iPlane); + constant_plane((GLfloat) v1->index, line.iPlane); } #endif #ifdef DO_TEX diff --git a/src/mesa/swrast/s_aatriangle.c b/src/mesa/swrast/s_aatriangle.c index d5350ff8531..83f145ca9fd 100644 --- a/src/mesa/swrast/s_aatriangle.c +++ b/src/mesa/swrast/s_aatriangle.c @@ -1,4 +1,4 @@ -/* $Id: s_aatriangle.c,v 1.18 2001/05/29 15:23:15 brianp Exp $ */ +/* $Id: s_aatriangle.c,v 1.19 2001/09/19 20:30:44 kschultz Exp $ */ /* * Mesa 3-D graphics library @@ -347,7 +347,7 @@ compute_lambda(const GLfloat sPlane[4], const GLfloat tPlane[4], if (rho2 == 0.0F) return 0.0; else - return log(rho2) * 1.442695 * 0.5; /* 1.442695 = 1/log(2) */ + return (GLfloat) (log(rho2) * 1.442695 * 0.5); /* 1.442695 = 1/log(2) */ } diff --git a/src/mesa/swrast/s_aatritemp.h b/src/mesa/swrast/s_aatritemp.h index 6cb45783dad..69f102858f6 100644 --- a/src/mesa/swrast/s_aatritemp.h +++ b/src/mesa/swrast/s_aatritemp.h @@ -1,4 +1,4 @@ -/* $Id: s_aatritemp.h,v 1.20 2001/07/13 20:12:44 brianp Exp $ */ +/* $Id: s_aatritemp.h,v 1.21 2001/09/19 20:30:44 kschultz Exp $ */ /* * Mesa 3-D graphics library @@ -184,11 +184,11 @@ #endif #ifdef DO_INDEX if (ctx->Light.ShadeModel == GL_SMOOTH) { - compute_plane(p0, p1, p2, v0->index, - v1->index, v2->index, iPlane); + compute_plane(p0, p1, p2, (GLfloat) v0->index, + (GLfloat) v1->index, (GLfloat) v2->index, iPlane); } else { - constant_plane(v2->index, iPlane); + constant_plane((GLfloat) v2->index, iPlane); } #endif #ifdef DO_SPEC diff --git a/src/mesa/swrast/s_accum.c b/src/mesa/swrast/s_accum.c index 6d3e2feb6ab..5b7936b210a 100644 --- a/src/mesa/swrast/s_accum.c +++ b/src/mesa/swrast/s_accum.c @@ -1,4 +1,4 @@ -/* $Id: s_accum.c,v 1.12 2001/07/13 20:07:37 brianp Exp $ */ +/* $Id: s_accum.c,v 1.13 2001/09/19 20:30:44 kschultz Exp $ */ /* * Mesa 3-D graphics library @@ -108,7 +108,7 @@ static void rescale_accum( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLuint n = ctx->DrawBuffer->Width * ctx->DrawBuffer->Height * 4; - const GLfloat s = swrast->_IntegerAccumScaler * (32767.0 / CHAN_MAXF); + const GLfloat s = swrast->_IntegerAccumScaler * (32767.0F / CHAN_MAXF); GLaccum *accum = ctx->DrawBuffer->Accum; GLuint i; diff --git a/src/mesa/swrast/s_feedback.c b/src/mesa/swrast/s_feedback.c index 2b42ce210eb..f25b179a2c5 100644 --- a/src/mesa/swrast/s_feedback.c +++ b/src/mesa/swrast/s_feedback.c @@ -1,4 +1,4 @@ -/* $Id: s_feedback.c,v 1.8 2001/06/12 22:06:53 brianp Exp $ */ +/* $Id: s_feedback.c,v 1.9 2001/09/19 20:30:44 kschultz Exp $ */ /* * Mesa 3-D graphics library @@ -58,7 +58,7 @@ static void feedback_vertex( GLcontext *ctx, win[0] = v->win[0]; win[1] = v->win[1]; win[2] = v->win[2] / ctx->DepthMaxF; - win[3] = 1.0 / v->win[3]; + win[3] = 1.0F / v->win[3]; color[0] = CHAN_TO_FLOAT(pv->color[0]); color[1] = CHAN_TO_FLOAT(pv->color[1]); diff --git a/src/mesa/swrast/s_fog.c b/src/mesa/swrast/s_fog.c index 74431d89b9b..6280391cc6e 100644 --- a/src/mesa/swrast/s_fog.c +++ b/src/mesa/swrast/s_fog.c @@ -1,4 +1,4 @@ -/* $Id: s_fog.c,v 1.13 2001/06/18 23:55:18 brianp Exp $ */ +/* $Id: s_fog.c,v 1.14 2001/09/19 20:30:44 kschultz Exp $ */ /* * Mesa 3-D graphics library @@ -56,11 +56,11 @@ _mesa_z_to_fogfactor(GLcontext *ctx, GLfloat z) return CLAMP(f, 0.0F, 1.0F); case GL_EXP: d = ctx->Fog.Density; - f = exp(-d * z); + f = (GLfloat) exp(-d * z); return f; case GL_EXP2: d = ctx->Fog.Density; - f = exp(-(d * d * z * z)); + f = (GLfloat) exp(-(d * d * z * z)); return f; default: _mesa_problem(ctx, "Bad fog mode in make_fog_coord"); @@ -92,10 +92,10 @@ _mesa_fog_rgba_pixels( const GLcontext *ctx, for (i = 0; i < n; i++) { const GLfloat f = fog[i]; - const GLfloat g = 1.0 - f; - rgba[i][RCOMP] = f * rgba[i][RCOMP] + g * rFog; - rgba[i][GCOMP] = f * rgba[i][GCOMP] + g * gFog; - rgba[i][BCOMP] = f * rgba[i][BCOMP] + g * bFog; + const GLfloat g = 1.0F - f; + rgba[i][RCOMP] = (GLchan) (f * rgba[i][RCOMP] + g * rFog); + rgba[i][GCOMP] = (GLchan) (f * rgba[i][GCOMP] + g * gFog); + rgba[i][BCOMP] = (GLchan) (f * rgba[i][BCOMP] + g * bFog); } } @@ -116,7 +116,7 @@ _mesa_fog_ci_pixels( const GLcontext *ctx, GLuint i; for (i = 0; i < n; i++) { - const GLfloat f = CLAMP(fog[i], 0.0, 1.0); + const GLfloat f = CLAMP(fog[i], 0.0F, 1.0F); index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * idx); } } @@ -210,7 +210,7 @@ compute_fog_factors_from_z( const GLcontext *ctx, GLfloat eyez = (ndcz - p14) / p10; if (eyez < 0.0) eyez = -eyez; - fogFact[i] = exp( -ctx->Fog.Density * eyez ); + fogFact[i] = (GLfloat) exp( -ctx->Fog.Density * eyez ); } } else { @@ -220,7 +220,7 @@ compute_fog_factors_from_z( const GLcontext *ctx, GLfloat eyez = p14 / (ndcz + p10); if (eyez < 0.0) eyez = -eyez; - fogFact[i] = exp( -ctx->Fog.Density * eyez ); + fogFact[i] = (GLfloat) exp( -ctx->Fog.Density * eyez ); } } break; @@ -237,7 +237,7 @@ compute_fog_factors_from_z( const GLcontext *ctx, if (tmp < FLT_MIN_10_EXP) tmp = FLT_MIN_10_EXP; #endif - fogFact[i] = exp( tmp ); + fogFact[i] = (GLfloat) exp( tmp ); } } else { @@ -251,7 +251,7 @@ compute_fog_factors_from_z( const GLcontext *ctx, if (tmp < FLT_MIN_10_EXP) tmp = FLT_MIN_10_EXP; #endif - fogFact[i] = exp( tmp ); + fogFact[i] = (GLfloat) exp( tmp ); } } } diff --git a/src/mesa/swrast/s_pointtemp.h b/src/mesa/swrast/s_pointtemp.h index 1125d34ad68..482f42b8eb6 100644 --- a/src/mesa/swrast/s_pointtemp.h +++ b/src/mesa/swrast/s_pointtemp.h @@ -1,4 +1,4 @@ -/* $Id: s_pointtemp.h,v 1.9 2001/07/19 16:12:03 brianp Exp $ */ +/* $Id: s_pointtemp.h,v 1.10 2001/09/19 20:30:44 kschultz Exp $ */ /* * Mesa 3-D graphics library @@ -122,7 +122,7 @@ NAME ( GLcontext *ctx, const SWvertex *vert ) #if FLAGS & SPRITE { SWcontext *swctx = SWRAST_CONTEXT(ctx); - const GLfloat radius = 0.5 * vert->pointSize; /* XXX threshold, alpha */ + const GLfloat radius = 0.5F * vert->pointSize; /* XXX threshold, alpha */ SWvertex v0, v1, v2, v3; GLuint unit; @@ -182,7 +182,7 @@ NAME ( GLcontext *ctx, const SWvertex *vert ) #if FLAGS & SMOOTH const GLfloat rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */ const GLfloat rmax = radius + 0.7071F; - const GLfloat rmin2 = MAX2(0.0, rmin * rmin); + const GLfloat rmin2 = MAX2(0.0F, rmin * rmin); const GLfloat rmax2 = rmax * rmax; const GLfloat cscale = 1.0F / (rmax2 - rmin2); const GLint xmin = (GLint) (vert->win[0] - radius); diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c index 9c3e2c5b5f6..39d9a9c6129 100644 --- a/src/mesa/swrast/s_texture.c +++ b/src/mesa/swrast/s_texture.c @@ -1,4 +1,4 @@ -/* $Id: s_texture.c,v 1.38 2001/08/14 14:08:44 brianp Exp $ */ +/* $Id: s_texture.c,v 1.39 2001/09/19 20:30:44 kschultz Exp $ */ /* * Mesa 3-D graphics library @@ -68,7 +68,7 @@ if (S <= 0.0F) \ U = 0.0F; \ else if (S >= 1.0F) \ - U = SIZE; \ + U = (GLfloat) SIZE; \ else \ U = S * SIZE; \ U -= 0.5F; \ @@ -97,7 +97,7 @@ if (S <= 0.0F) \ U = 0.0F; \ else if (S >= 1.0F) \ - U = SIZE; \ + U = (GLfloat) SIZE; \ else \ U = S * SIZE; \ U -= 0.5F; \ diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index c1aa1facf14..cc447ac5707 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -1,4 +1,4 @@ -/* $Id: s_triangle.c,v 1.37 2001/09/13 22:12:54 brianp Exp $ */ +/* $Id: s_triangle.c,v 1.38 2001/09/19 20:30:44 kschultz Exp $ */ /* * Mesa 3-D graphics library @@ -708,8 +708,8 @@ fast_persp_span(GLcontext *ctx, struct triangle_span *span, for (i = 0; i < span->count; i++) { \ GLdouble invQ = tex_coord[2] ? \ (1.0 / tex_coord[2]) : 1.0; \ - GLfloat s_tmp = tex_coord[0] * invQ; \ - GLfloat t_tmp = tex_coord[1] * invQ; \ + GLfloat s_tmp = (GLfloat) (tex_coord[0] * invQ); \ + GLfloat t_tmp = (GLfloat) (tex_coord[1] * invQ); \ GLint s = IFLOOR(s_tmp) & info->smask; \ GLint t = IFLOOR(t_tmp) & info->tmask; \ GLint pos = (t << info->twidth_log2) + s; \ @@ -733,8 +733,8 @@ fast_persp_span(GLcontext *ctx, struct triangle_span *span, for (i = 0; i < span->count; i++) { \ GLdouble invQ = tex_coord[2] ? \ (1.0 / tex_coord[2]) : 1.0; \ - GLfloat s_tmp = tex_coord[0] * invQ; \ - GLfloat t_tmp = tex_coord[1] * invQ; \ + GLfloat s_tmp = (GLfloat) (tex_coord[0] * invQ); \ + GLfloat t_tmp = (GLfloat) (tex_coord[1] * invQ); \ GLfixed s_fix = FloatToFixed(s_tmp) - FIXED_HALF; \ GLfixed t_fix = FloatToFixed(t_tmp) - FIXED_HALF; \ GLint s = FixedToInt(FixedFloor(s_fix)) & info->smask; \ @@ -1144,11 +1144,12 @@ rasterize_span(GLcontext *ctx, const struct triangle_span *span) GLfloat q = span->tex[u][3]; GLuint i; for (i = 0; i < span->count; i++) { - const GLfloat invQ = (q == 0.0F) ? 1.0 : (1.0F / q); + const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); msTex[u][i] = s * invQ; mtTex[u][i] = t * invQ; mrTex[u][i] = r * invQ; - mLambda[u][i] = log(span->rho[u] * invQ * invQ) * 1.442695F * 0.5F; + mLambda[u][i] = (GLfloat) + (log(span->rho[u] * invQ * invQ) * 1.442695F * 0.5F); s += span->texStep[u][0]; t += span->texStep[u][1]; r += span->texStep[u][2]; @@ -1168,7 +1169,7 @@ rasterize_span(GLcontext *ctx, const struct triangle_span *span) GLfloat q = span->tex[u][3]; GLuint i; for (i = 0; i < span->count; i++) { - const GLfloat invQ = (q == 0.0F) ? 1.0 : (1.0F / q); + const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); msTex[u][i] = s * invQ; mtTex[u][i] = t * invQ; mrTex[u][i] = r * invQ; @@ -1191,11 +1192,12 @@ rasterize_span(GLcontext *ctx, const struct triangle_span *span) GLfloat q = span->tex[0][3]; GLuint i; for (i = 0; i < span->count; i++) { - const GLfloat invQ = (q == 0.0F) ? 1.0 : (1.0F / q); + const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); sTex[i] = s * invQ; tTex[i] = t * invQ; rTex[i] = r * invQ; - lambda[i] = log(span->rho[0] * invQ * invQ) * 1.442695F * 0.5F; + lambda[i] = (GLfloat) + (log(span->rho[0] * invQ * invQ) * 1.442695F * 0.5F); s += span->texStep[0][0]; t += span->texStep[0][1]; r += span->texStep[0][2]; @@ -1210,7 +1212,7 @@ rasterize_span(GLcontext *ctx, const struct triangle_span *span) GLfloat q = span->tex[0][3]; GLuint i; for (i = 0; i < span->count; i++) { - const GLfloat invQ = (q == 0.0F) ? 1.0 : (1.0F / q); + const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); sTex[i] = s * invQ; tTex[i] = t * invQ; rTex[i] = r * invQ; @@ -1351,9 +1353,9 @@ static void general_textured_triangle( GLcontext *ctx, span.green += span.greenStep; \ span.blue += span.blueStep; \ span.alpha += span.alphaStep; \ - sSpan[i] = span.tex[0][0] * invQ; \ - tSpan[i] = span.tex[0][1] * invQ; \ - uSpan[i] = span.tex[0][2] * invQ; \ + sSpan[i] = (GLfloat) (span.tex[0][0] * invQ); \ + tSpan[i] = (GLfloat) (span.tex[0][1] * invQ); \ + uSpan[i] = (GLfloat) (span.tex[0][2] * invQ); \ span.tex[0][0] += span.texStep[0][0]; \ span.tex[0][1] += span.texStep[0][1]; \ span.tex[0][2] += span.texStep[0][2]; \ diff --git a/src/mesa/swrast/s_tritemp.h b/src/mesa/swrast/s_tritemp.h index be69d7577d5..5c9d79d5f1f 100644 --- a/src/mesa/swrast/s_tritemp.h +++ b/src/mesa/swrast/s_tritemp.h @@ -1,4 +1,4 @@ -/* $Id: s_tritemp.h,v 1.26 2001/09/13 22:12:54 brianp Exp $ */ +/* $Id: s_tritemp.h,v 1.27 2001/09/19 20:30:44 kschultz Exp $ */ /* * Mesa 3-D graphics library @@ -375,24 +375,32 @@ # ifdef INTERP_ALPHA GLfloat eMaj_da, eBot_da; # endif - eMaj_dr = (GLint) vMax->color[RCOMP] - (GLint) vMin->color[RCOMP]; - eBot_dr = (GLint) vMid->color[RCOMP] - (GLint) vMin->color[RCOMP]; + eMaj_dr = (GLfloat) ((GLint) vMax->color[RCOMP] - + (GLint) vMin->color[RCOMP]); + eBot_dr = (GLfloat) ((GLint) vMid->color[RCOMP] - + (GLint) vMin->color[RCOMP]); drdx = oneOverArea * (eMaj_dr * eBot.dy - eMaj.dy * eBot_dr); span.redStep = SignedFloatToFixed(drdx); drdy = oneOverArea * (eMaj.dx * eBot_dr - eMaj_dr * eBot.dx); - eMaj_dg = (GLint) vMax->color[GCOMP] - (GLint) vMin->color[GCOMP]; - eBot_dg = (GLint) vMid->color[GCOMP] - (GLint) vMin->color[GCOMP]; + eMaj_dg = (GLfloat) ((GLint) vMax->color[GCOMP] - + (GLint) vMin->color[GCOMP]); + eBot_dg = (GLfloat) ((GLint) vMid->color[GCOMP] - + (GLint) vMin->color[GCOMP]); dgdx = oneOverArea * (eMaj_dg * eBot.dy - eMaj.dy * eBot_dg); span.greenStep = SignedFloatToFixed(dgdx); dgdy = oneOverArea * (eMaj.dx * eBot_dg - eMaj_dg * eBot.dx); - eMaj_db = (GLint) vMax->color[BCOMP] - (GLint) vMin->color[BCOMP]; - eBot_db = (GLint) vMid->color[BCOMP] - (GLint) vMin->color[BCOMP]; + eMaj_db = (GLfloat) ((GLint) vMax->color[BCOMP] - + (GLint) vMin->color[BCOMP]); + eBot_db = (GLfloat) ((GLint) vMid->color[BCOMP] - + (GLint) vMin->color[BCOMP]); dbdx = oneOverArea * (eMaj_db * eBot.dy - eMaj.dy * eBot_db); span.blueStep = SignedFloatToFixed(dbdx); dbdy = oneOverArea * (eMaj.dx * eBot_db - eMaj_db * eBot.dx); # ifdef INTERP_ALPHA - eMaj_da = (GLint) vMax->color[ACOMP] - (GLint) vMin->color[ACOMP]; - eBot_da = (GLint) vMid->color[ACOMP] - (GLint) vMin->color[ACOMP]; + eMaj_da = (GLfloat) ((GLint) vMax->color[ACOMP] - + (GLint) vMin->color[ACOMP]); + eBot_da = (GLfloat) ((GLint) vMid->color[ACOMP] - + (GLint) vMin->color[ACOMP]); dadx = oneOverArea * (eMaj_da * eBot.dy - eMaj.dy * eBot_da); span.alphaStep = SignedFloatToFixed(dadx); dady = oneOverArea * (eMaj.dx * eBot_da - eMaj_da * eBot.dx); @@ -454,18 +462,24 @@ GLfloat eMaj_dsr, eBot_dsr; GLfloat eMaj_dsg, eBot_dsg; GLfloat eMaj_dsb, eBot_dsb; - eMaj_dsr = (GLint) vMax->specular[RCOMP] - (GLint) vMin->specular[RCOMP]; - eBot_dsr = (GLint) vMid->specular[RCOMP] - (GLint) vMin->specular[RCOMP]; + eMaj_dsr = (GLfloat) ((GLint) vMax->specular[RCOMP] - + (GLint) vMin->specular[RCOMP]); + eBot_dsr = (GLfloat) ((GLint) vMid->specular[RCOMP] - + (GLint) vMin->specular[RCOMP]); dsrdx = oneOverArea * (eMaj_dsr * eBot.dy - eMaj.dy * eBot_dsr); span.specRedStep = SignedFloatToFixed(dsrdx); dsrdy = oneOverArea * (eMaj.dx * eBot_dsr - eMaj_dsr * eBot.dx); - eMaj_dsg = (GLint) vMax->specular[GCOMP] - (GLint) vMin->specular[GCOMP]; - eBot_dsg = (GLint) vMid->specular[GCOMP] - (GLint) vMin->specular[GCOMP]; + eMaj_dsg = (GLfloat) ((GLint) vMax->specular[GCOMP] - + (GLint) vMin->specular[GCOMP]); + eBot_dsg = (GLfloat) ((GLint) vMid->specular[GCOMP] - + (GLint) vMin->specular[GCOMP]); dsgdx = oneOverArea * (eMaj_dsg * eBot.dy - eMaj.dy * eBot_dsg); span.specGreenStep = SignedFloatToFixed(dsgdx); dsgdy = oneOverArea * (eMaj.dx * eBot_dsg - eMaj_dsg * eBot.dx); - eMaj_dsb = (GLint) vMax->specular[BCOMP] - (GLint) vMin->specular[BCOMP]; - eBot_dsb = (GLint) vMid->specular[BCOMP] - (GLint) vMin->specular[BCOMP]; + eMaj_dsb = (GLfloat) ((GLint) vMax->specular[BCOMP] - + (GLint) vMin->specular[BCOMP]); + eBot_dsb = (GLfloat) ((GLint) vMid->specular[BCOMP] - + (GLint) vMin->specular[BCOMP]); dsbdx = oneOverArea * (eMaj_dsb * eBot.dy - eMaj.dy * eBot_dsb); span.specBlueStep = SignedFloatToFixed(dsbdx); dsbdy = oneOverArea * (eMaj.dx * eBot_dsb - eMaj_dsb * eBot.dx); @@ -511,8 +525,8 @@ span.activeMask |= SPAN_INDEX; if (ctx->Light.ShadeModel == GL_SMOOTH) { GLfloat eMaj_di, eBot_di; - eMaj_di = (GLint) vMax->index - (GLint) vMin->index; - eBot_di = (GLint) vMid->index - (GLint) vMin->index; + eMaj_di = (GLfloat) ((GLint) vMax->index - (GLint) vMin->index); + eBot_di = (GLfloat) ((GLint) vMid->index - (GLint) vMin->index); didx = oneOverArea * (eMaj_di * eBot.dy - eMaj.dy * eBot_di); span.indexStep = SignedFloatToFixed(didx); didy = oneOverArea * (eMaj.dx * eBot_di - eMaj_di * eBot.dx); -- 2.30.2