swrast: silence double->float assignment warnings
[mesa.git] / src / mesa / swrast / s_atifragshader.c
index 55ec757ee069b67f8aa1ce1c999da90e819709cb..05da64de3acea2f7b91289d7ea44f1305f8e3eb4 100644 (file)
@@ -1,5 +1,4 @@
 /*
- *
  * Copyright (C) 2004  David Airlie   All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#include "glheader.h"
-#include "colormac.h"
-#include "context.h"
-#include "macros.h"
-#include "shader/program.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/context.h"
+#include "main/macros.h"
 #include "shader/atifragshader.h"
 #include "swrast/s_atifragshader.h"
 
@@ -48,17 +46,12 @@ static void
 fetch_texel(GLcontext * ctx, const GLfloat texcoord[4], GLfloat lambda,
            GLuint unit, GLfloat color[4])
 {
-   GLchan rgba[4];
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
 
    /* XXX use a float-valued TextureSample routine here!!! */
    swrast->TextureSample[unit](ctx, ctx->Texture.Unit[unit]._Current,
                                1, (const GLfloat(*)[4]) texcoord,
-                               &lambda, &rgba);
-   color[0] = CHAN_TO_FLOAT(rgba[0]);
-   color[1] = CHAN_TO_FLOAT(rgba[1]);
-   color[2] = CHAN_TO_FLOAT(rgba[2]);
-   color[3] = CHAN_TO_FLOAT(rgba[3]);
+                               &lambda, (GLfloat (*)[4]) color);
 }
 
 static void
@@ -89,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;
@@ -178,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;
       }
    }
 }
@@ -285,7 +279,7 @@ handle_sample_op(GLcontext * ctx, struct atifs_machine *machine,
 /* sample from unit idx using texinst->src as coords */
    GLuint swizzle = texinst->swizzle;
    GLuint coord_source = texinst->src;
-   GLfloat tex_coords[4];
+   GLfloat tex_coords[4] = { 0 };
 
    if (coord_source >= GL_TEXTURE0_ARB && coord_source <= GL_TEXTURE7_ARB) {
       coord_source -= GL_TEXTURE0_ARB;
@@ -592,8 +586,6 @@ _swrast_exec_fragment_shader(GLcontext * ctx, SWspan *span)
    /* incoming colors should be floats */
    ASSERT(span->array->ChanType == GL_FLOAT);
 
-   ctx->_CurrentProgram = GL_FRAGMENT_SHADER_ATI;
-
    for (i = 0; i < span->end; i++) {
       if (span->array->mask[i]) {
         init_machine(ctx, &machine, shader, span, i);
@@ -609,6 +601,4 @@ _swrast_exec_fragment_shader(GLcontext * ctx, SWspan *span)
         }
       }
    }
-
-   ctx->_CurrentProgram = 0;
 }