swrast: silence double->float assignment warnings
authorBrian Paul <brianp@vmware.com>
Thu, 28 Jan 2010 00:00:32 +0000 (17:00 -0700)
committerBrian Paul <brianp@vmware.com>
Thu, 28 Jan 2010 00:04:30 +0000 (17:04 -0700)
Reported by Karl Schultz.

src/mesa/swrast/s_aatritemp.h
src/mesa/swrast/s_accum.c
src/mesa/swrast/s_alpha.c
src/mesa/swrast/s_atifragshader.c
src/mesa/swrast/s_context.c
src/mesa/swrast/s_fog.c
src/mesa/swrast/s_fragprog.c
src/mesa/swrast/s_points.c
src/mesa/swrast/s_span.c
src/mesa/swrast/s_texcombine.c
src/mesa/swrast/s_texfilter.c

index 0827b3db9eb90e54491b56461a9aa0fb3a89a1c4..a8b22c548f3df0a7c0719007c753068135d09833 100644 (file)
 
 #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
          
 #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
index cf53f01b7c14b8bdb639bb8b1606f1813429f714..2dd9ca6348b32cdec1d44b34f31bc3d300fc24d0 100644 (file)
@@ -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
 
 
 /*
index 5761bb00b4e55482205f321cb8e6cba47191474c..ebac562272fcc53d10a8a4ae7adfc074b98c33f1 100644 (file)
@@ -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);
       }
index 353e9999d61d8df4a507ea816ca12fb990227ff6..05da64de3acea2f7b91289d7ea44f1305f8e3eb4 100644 (file)
@@ -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;
       }
    }
 }
index f9092c215a720d4916fdd47aaa2f9866ff52905b..0d4680db9f7f6d696d91b8c0c4f37f7533e9b811 100644 (file)
@@ -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;
 }
 
 
index 77ed0cfef9611a2f27137eaf3733156686ffc950..0472bbf553cbf8bbe0ef610d4ffefb7e7c6a33c0 100644 (file)
@@ -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];
index 1c6492cc8fa81dbe7f926aa50e8c38da7b737892..d31da4c4022ba634e50dbed072fe1e4ffea6ee95 100644 (file)
@@ -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;
index 6b955429e9473d7341687faa227652444d9a8801..a9a704a16eea1565d82b50f6851468e6b70ad4fc 100644 (file)
@@ -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
index 874a37b2241abe83a29977992a6bacfdb4199a7f..905cf3d55010d363a60cd573631e3dbfa1aee836 100644 (file)
@@ -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) {
index 594b71a03c6f1b8923775f1a2b8416884247903f..95e2c082ba721055813881de7fa739a8a9922de4 100644 (file)
@@ -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 {
index 76b65cc755e4c9bb1f058a3e2d2228ebb6be9bd6..ff7deecc39217b4f91a4d6c66af6aa35ad601d3d 100644 (file)
@@ -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;