Drop GLcontext typedef and use struct gl_context instead
[mesa.git] / src / mesa / swrast / s_atifragshader.c
index e88ff1912392eb349c1f8e9dcf21bab2cb698d26..1eb026e0092052cf73a4eeafa4cfc3a345b863ba 100644 (file)
 
 #include "main/glheader.h"
 #include "main/colormac.h"
-#include "main/context.h"
 #include "main/macros.h"
-#include "shader/program.h"
-#include "shader/atifragshader.h"
+#include "main/atifragshader.h"
 #include "swrast/s_atifragshader.h"
+#include "swrast/s_context.h"
 
 
 /**
@@ -44,7 +43,7 @@ struct atifs_machine
  * Fetch a texel.
  */
 static void
-fetch_texel(GLcontext * ctx, const GLfloat texcoord[4], GLfloat lambda,
+fetch_texel(struct gl_context * ctx, const GLfloat texcoord[4], GLfloat lambda,
            GLuint unit, GLfloat color[4])
 {
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
@@ -83,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.0F / q;
       break;
    }
    values[3] = 0.0;
@@ -138,7 +138,7 @@ apply_src_mod(GLint optype, GLuint mod, GLfloat * val)
         val[i] = 1 - val[i];
 
       if (mod & GL_BIAS_BIT_ATI)
-        val[i] = val[i] - 0.5;
+        val[i] = val[i] - 0.5F;
 
       if (mod & GL_2X_BIT_ATI)
         val[i] = 2 * val[i];
@@ -172,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;
       }
    }
 }
@@ -272,7 +272,7 @@ handle_pass_op(struct atifs_machine *machine, struct atifs_setupinst *texinst,
 }
 
 static void
-handle_sample_op(GLcontext * ctx, struct atifs_machine *machine,
+handle_sample_op(struct gl_context * ctx, struct atifs_machine *machine,
                 struct atifs_setupinst *texinst, const SWspan *span,
                 GLuint column, GLuint idx)
 {
@@ -311,7 +311,7 @@ do {                                                \
  * \param column - which pixel [i] we're operating on in the span
  */
 static void
-execute_shader(GLcontext *ctx, const struct ati_fragment_shader *shader,
+execute_shader(struct gl_context *ctx, const struct ati_fragment_shader *shader,
               struct atifs_machine *machine, const SWspan *span,
                GLuint column)
 {
@@ -555,7 +555,7 @@ execute_shader(GLcontext *ctx, const struct ati_fragment_shader *shader,
  * Init fragment shader virtual machine state.
  */
 static void
-init_machine(GLcontext * ctx, struct atifs_machine *machine,
+init_machine(struct gl_context * ctx, struct atifs_machine *machine,
             const struct ati_fragment_shader *shader,
             const SWspan *span, GLuint col)
 {
@@ -577,7 +577,7 @@ init_machine(GLcontext * ctx, struct atifs_machine *machine,
  * Execute the current ATI shader program, operating on the given span.
  */
 void
-_swrast_exec_fragment_shader(GLcontext * ctx, SWspan *span)
+_swrast_exec_fragment_shader(struct gl_context * ctx, SWspan *span)
 {
    const struct ati_fragment_shader *shader = ctx->ATIFragmentShader.Current;
    struct atifs_machine machine;