Mesa (master): swrast: silence double->float assignment warnings

Brian Paul brianp at kemper.freedesktop.org
Wed Jan 27 16:08:27 PST 2010


Module: Mesa
Branch: master
Commit: 880411c72aee7c0ec81366bdf6ab8cf25bebb9d5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=880411c72aee7c0ec81366bdf6ab8cf25bebb9d5

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Jan 27 17:00:32 2010 -0700

swrast: silence double->float assignment warnings

Reported by Karl Schultz.

---

 src/mesa/swrast/s_aatritemp.h     |    8 ++++----
 src/mesa/swrast/s_accum.c         |    2 +-
 src/mesa/swrast/s_alpha.c         |    4 ++--
 src/mesa/swrast/s_atifragshader.c |   27 ++++++++++++++-------------
 src/mesa/swrast/s_context.c       |   10 +++++-----
 src/mesa/swrast/s_fog.c           |   12 ++++++------
 src/mesa/swrast/s_fragprog.c      |    6 +++---
 src/mesa/swrast/s_points.c        |   12 ++++++------
 src/mesa/swrast/s_span.c          |    2 +-
 src/mesa/swrast/s_texcombine.c    |   20 ++++++++++----------
 src/mesa/swrast/s_texfilter.c     |    2 +-
 11 files changed, 53 insertions(+), 52 deletions(-)

diff --git a/src/mesa/swrast/s_aatritemp.h b/src/mesa/swrast/s_aatritemp.h
index 0827b3d..a8b22c5 100644
--- a/src/mesa/swrast/s_aatritemp.h
+++ b/src/mesa/swrast/s_aatritemp.h
@@ -220,11 +220,11 @@
 
 #if defined(DO_ATTRIBS)
          /* compute attributes at left-most fragment */
-         span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 0.5, iy + 0.5, wPlane);
+         span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 0.5F, iy + 0.5F, wPlane);
          ATTRIB_LOOP_BEGIN
             GLuint c;
             for (c = 0; c < 4; c++) {
-               span.attrStart[attr][c] = solve_plane(ix + 0.5, iy + 0.5, attrPlane[attr][c]);
+               span.attrStart[attr][c] = solve_plane(ix + 0.5F, iy + 0.5F, attrPlane[attr][c]);
             }
          ATTRIB_LOOP_END
 #endif
@@ -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.5, wPlane);
+         span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 1.5, 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.5, attrPlane[attr][c]);
+               span.attrStart[attr][c] = solve_plane(ix + 1.5, iy + 0.5F, attrPlane[attr][c]);
             }
          ATTRIB_LOOP_END
 #endif
diff --git a/src/mesa/swrast/s_accum.c b/src/mesa/swrast/s_accum.c
index cf53f01..2dd9ca6 100644
--- a/src/mesa/swrast/s_accum.c
+++ b/src/mesa/swrast/s_accum.c
@@ -37,7 +37,7 @@
 /* XXX this would have to change for accum buffers with more or less
  * than 16 bits per color channel.
  */
-#define ACCUM_SCALE16 32767.0
+#define ACCUM_SCALE16 32767.0F
 
 
 /*
diff --git a/src/mesa/swrast/s_alpha.c b/src/mesa/swrast/s_alpha.c
index 5761bb0..ebac562 100644
--- a/src/mesa/swrast/s_alpha.c
+++ b/src/mesa/swrast/s_alpha.c
@@ -146,8 +146,8 @@ _swrast_alpha_test(const GLcontext *ctx, SWspan *span)
          ALPHA_TEST(FixedToInt(alpha), alpha += alphaStep);
       }
       else {
-         const GLfloat alphaStep = span->alphaStep;
-         GLfloat alpha = span->alpha;
+         const GLfloat alphaStep = FIXED_TO_FLOAT(span->alphaStep);
+         GLfloat alpha = FIXED_TO_FLOAT(span->alpha);
          const GLfloat ref = ctx->Color.AlphaRef;
          ALPHA_TEST(alpha, alpha += alphaStep);
       }
diff --git a/src/mesa/swrast/s_atifragshader.c b/src/mesa/swrast/s_atifragshader.c
index 353e999..05da64d 100644
--- a/src/mesa/swrast/s_atifragshader.c
+++ b/src/mesa/swrast/s_atifragshader.c
@@ -82,10 +82,11 @@ apply_swizzle(GLfloat values[4], GLuint swizzle)
       break;
    case GL_SWIZZLE_STQ_DQ_ATI:
 /* make sure q is not 0 to avoid problems later with infinite values (texture lookup)? */
-      if (q == 0.0F) q = 0.000000001;
+      if (q == 0.0F)
+         q = 0.000000001F;
       values[0] = s / q;
       values[1] = t / q;
-      values[2] = 1 / q;
+      values[2] = 1.0 / q;
       break;
    }
    values[3] = 0.0;
@@ -171,27 +172,27 @@ apply_dst_mod(GLuint optype, GLuint mod, GLfloat * val)
 	 val[i] = 8 * val[i];
 	 break;
       case GL_HALF_BIT_ATI:
-	 val[i] = val[i] * 0.5;
+	 val[i] = val[i] * 0.5F;
 	 break;
       case GL_QUARTER_BIT_ATI:
-	 val[i] = val[i] * 0.25;
+	 val[i] = val[i] * 0.25F;
 	 break;
       case GL_EIGHTH_BIT_ATI:
-	 val[i] = val[i] * 0.125;
+	 val[i] = val[i] * 0.125F;
 	 break;
       }
 
       if (has_sat) {
-	 if (val[i] < 0.0)
-	    val[i] = 0;
-	 else if (val[i] > 1.0)
-	    val[i] = 1.0;
+	 if (val[i] < 0.0F)
+	    val[i] = 0.0F;
+	 else if (val[i] > 1.0F)
+	    val[i] = 1.0F;
       }
       else {
-	 if (val[i] < -8.0)
-	    val[i] = -8.0;
-	 else if (val[i] > 8.0)
-	    val[i] = 8.0;
+	 if (val[i] < -8.0F)
+	    val[i] = -8.0F;
+	 else if (val[i] > 8.0F)
+	    val[i] = 8.0F;
       }
    }
 }
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index f9092c2..0d4680d 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -149,26 +149,26 @@ _swrast_update_polygon( GLcontext *ctx )
    if (ctx->Polygon.CullFlag) {
       switch (ctx->Polygon.CullFaceMode) {
       case GL_BACK:
-         backface_sign = -1.0;
+         backface_sign = -1.0F;
 	 break;
       case GL_FRONT:
-         backface_sign = 1.0;
+         backface_sign = 1.0F;
 	 break;
       case GL_FRONT_AND_BACK:
          /* fallthrough */
       default:
-	 backface_sign = 0.0;
+	 backface_sign = 0.0F;
       }
    }
    else {
-      backface_sign = 0.0;
+      backface_sign = 0.0F;
    }
 
    SWRAST_CONTEXT(ctx)->_BackfaceCullSign = backface_sign;
 
    /* This is for front/back-face determination, but not for culling */
    SWRAST_CONTEXT(ctx)->_BackfaceSign
-      = (ctx->Polygon.FrontFace == GL_CW) ? -1.0 : 1.0;
+      = (ctx->Polygon.FrontFace == GL_CW) ? -1.0F : 1.0F;
 }
 
 
diff --git a/src/mesa/swrast/s_fog.c b/src/mesa/swrast/s_fog.c
index 77ed0cf..0472bbf 100644
--- a/src/mesa/swrast/s_fog.c
+++ b/src/mesa/swrast/s_fog.c
@@ -172,14 +172,14 @@ _swrast_fog_rgba_span( const GLcontext *ctx, SWspan *span )
 
    /* compute (scaled) fog color */
    if (span->array->ChanType == GL_UNSIGNED_BYTE) {
-      rFog = ctx->Fog.Color[RCOMP] * 255.0;
-      gFog = ctx->Fog.Color[GCOMP] * 255.0;
-      bFog = ctx->Fog.Color[BCOMP] * 255.0;
+      rFog = ctx->Fog.Color[RCOMP] * 255.0F;
+      gFog = ctx->Fog.Color[GCOMP] * 255.0F;
+      bFog = ctx->Fog.Color[BCOMP] * 255.0F;
    }
    else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
-      rFog = ctx->Fog.Color[RCOMP] * 65535.0;
-      gFog = ctx->Fog.Color[GCOMP] * 65535.0;
-      bFog = ctx->Fog.Color[BCOMP] * 65535.0;
+      rFog = ctx->Fog.Color[RCOMP] * 65535.0F;
+      gFog = ctx->Fog.Color[GCOMP] * 65535.0F;
+      bFog = ctx->Fog.Color[BCOMP] * 65535.0F;
    }
    else {
       rFog = ctx->Fog.Color[RCOMP];
diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c
index 1c6492c..d31da4c 100644
--- a/src/mesa/swrast/s_fragprog.c
+++ b/src/mesa/swrast/s_fragprog.c
@@ -156,8 +156,8 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine,
    if (program->OriginUpperLeft)
       wpos[1] = ctx->DrawBuffer->Height - 1 - wpos[1];
    if (!program->PixelCenterInteger) {
-      wpos[0] += 0.5;
-      wpos[1] += 0.5;
+      wpos[0] += 0.5F;
+      wpos[1] += 0.5F;
    }
 
    /* Setup pointer to input attributes */
@@ -172,7 +172,7 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine,
    /* if running a GLSL program (not ARB_fragment_program) */
    if (ctx->Shader.CurrentProgram) {
       /* Store front/back facing value */
-      machine->Attribs[FRAG_ATTRIB_FACE][col][0] = 1.0 - span->facing;
+      machine->Attribs[FRAG_ATTRIB_FACE][col][0] = 1.0F - span->facing;
    }
 
    machine->CurElement = col;
diff --git a/src/mesa/swrast/s_points.c b/src/mesa/swrast/s_points.c
index 6b95542..a9a704a 100644
--- a/src/mesa/swrast/s_points.c
+++ b/src/mesa/swrast/s_points.c
@@ -125,16 +125,16 @@ sprite_point(GLcontext *ctx, const SWvertex *vert)
       GLfloat s, r, dsdx;
 
       /* texcoord / pointcoord interpolants */
-      s = 0.0;
-      dsdx = 1.0 / size;
+      s = 0.0F;
+      dsdx = 1.0F / size;
       if (ctx->Point.SpriteOrigin == GL_LOWER_LEFT) {
-         dtdy = 1.0 / size;
-         t0 = 0.5 * dtdy;
+         dtdy = 1.0F / size;
+         t0 = 0.5F * dtdy;
       }
       else {
          /* GL_UPPER_LEFT */
-         dtdy = -1.0 / size;
-         t0 = 1.0 + 0.5 * dtdy;
+         dtdy = -1.0F / size;
+         t0 = 1.0F + 0.5F * dtdy;
       }
 
       ATTRIB_LOOP_BEGIN
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 874a37b..905cf3d 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -645,7 +645,7 @@ interpolate_wpos(GLcontext *ctx, SWspan *span)
 {
    GLfloat (*wpos)[4] = span->array->attribs[FRAG_ATTRIB_WPOS];
    GLuint i;
-   const GLfloat zScale = 1.0 / ctx->DrawBuffer->_DepthMaxF;
+   const GLfloat zScale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
    GLfloat w, dw;
 
    if (span->arrayMask & SPAN_XY) {
diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c
index 594b71a..95e2c08 100644
--- a/src/mesa/swrast/s_texcombine.c
+++ b/src/mesa/swrast/s_texcombine.c
@@ -316,18 +316,18 @@ texture_combine( GLcontext *ctx, GLuint unit, GLuint n,
             /* (a * b) + (c * d) - 0.5 */
             for (i = 0; i < n; i++) {
                rgba[i][RCOMP] = (arg0[i][RCOMP] * arg1[i][RCOMP] +
-                                 arg2[i][RCOMP] * arg3[i][RCOMP] - 0.5) * scaleRGB;
+                                 arg2[i][RCOMP] * arg3[i][RCOMP] - 0.5F) * scaleRGB;
                rgba[i][GCOMP] = (arg0[i][GCOMP] * arg1[i][GCOMP] +
-                                 arg2[i][GCOMP] * arg3[i][GCOMP] - 0.5) * scaleRGB;
+                                 arg2[i][GCOMP] * arg3[i][GCOMP] - 0.5F) * scaleRGB;
                rgba[i][BCOMP] = (arg0[i][BCOMP] * arg1[i][BCOMP] +
-                                 arg2[i][BCOMP] * arg3[i][BCOMP] - 0.5) * scaleRGB;
+                                 arg2[i][BCOMP] * arg3[i][BCOMP] - 0.5F) * scaleRGB;
             }
          }
          else {
             for (i = 0; i < n; i++) {
-               rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] - 0.5) * scaleRGB;
-               rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] - 0.5) * scaleRGB;
-               rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP] - 0.5) * scaleRGB;
+               rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] - 0.5F) * scaleRGB;
+               rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] - 0.5F) * scaleRGB;
+               rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP] - 0.5F) * scaleRGB;
             }
          }
          break;
@@ -385,11 +385,11 @@ texture_combine( GLcontext *ctx, GLuint unit, GLuint n,
       case GL_MODULATE_SIGNED_ADD_ATI:
          for (i = 0; i < n; i++) {
             rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) +
-                              arg1[i][RCOMP] - 0.5) * scaleRGB;
+                              arg1[i][RCOMP] - 0.5F) * scaleRGB;
             rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) +
-                              arg1[i][GCOMP] - 0.5) * scaleRGB;
+                              arg1[i][GCOMP] - 0.5F) * scaleRGB;
             rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) +
-                              arg1[i][BCOMP] - 0.5) * scaleRGB;
+                              arg1[i][BCOMP] - 0.5F) * scaleRGB;
 	 }
          break;
       case GL_MODULATE_SUBTRACT_ATI:
@@ -456,7 +456,7 @@ texture_combine( GLcontext *ctx, GLuint unit, GLuint n,
             for (i = 0; i < n; i++) {
                rgba[i][ACOMP] = (arg0[i][ACOMP] * arg1[i][ACOMP] +
                                  arg2[i][ACOMP] * arg3[i][ACOMP] -
-                                 0.5) * scaleA;
+                                 0.5F) * scaleA;
             }
          }
          else {
diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c
index 76b65cc..ff7deec 100644
--- a/src/mesa/swrast/s_texfilter.c
+++ b/src/mesa/swrast/s_texfilter.c
@@ -445,7 +445,7 @@ clamp_rect_coord_linear(GLenum wrapMode, GLfloat coord, GLint max,
    switch (wrapMode) {
    case GL_CLAMP:
       /* Not exactly what the spec says, but it matches NVIDIA output */
-      fcol = CLAMP(coord - 0.5F, 0.0, max-1);
+      fcol = CLAMP(coord - 0.5F, 0.0F, max - 1);
       i0 = IFLOOR(fcol);
       i1 = i0 + 1;
       break;



More information about the mesa-commit mailing list