r300: Further reduced the radeon_span.c diff.
[mesa.git] / src / mesa / swrast / s_fog.c
index 93d2ab469f614294f5f296eb72aa1c9922fb4af1..433fc4a4d0cfb5978f2b625d2f983d52ad17e8b8 100644 (file)
@@ -72,10 +72,10 @@ _swrast_z_to_fogfactor(GLcontext *ctx, GLfloat z)
  */
 #define FOG_LOOP(TYPE, COMPUTE_F)                                      \
 do {                                                                   \
-   const GLfloat fogStep = span->fogStep;                              \
-   GLfloat fogCoord = span->fog;                                       \
-   const GLfloat wStep = haveW ? span->dwdx : 0.0F;                    \
-   GLfloat w = haveW ? span->w : 1.0F;                                 \
+   const GLfloat fogStep = span->attrStepX[FRAG_ATTRIB_FOGC][0];       \
+   GLfloat fogCoord = span->attrStart[FRAG_ATTRIB_FOGC][0];            \
+   const GLfloat wStep = haveW ? span->attrStepX[FRAG_ATTRIB_WPOS][3] : 0.0F;\
+   GLfloat w = haveW ? span->attrStart[FRAG_ATTRIB_WPOS][3] : 1.0F;    \
    GLuint i;                                                           \
    for (i = 0; i < span->end; i++) {                                   \
       GLfloat f, oneMinusF;                                            \
@@ -293,10 +293,10 @@ _swrast_fog_ci_span( const GLcontext *ctx, SWspan *span )
             const GLfloat fogEnd = ctx->Fog.End;
             const GLfloat fogScale = (ctx->Fog.Start == ctx->Fog.End)
                ? 1.0F : 1.0F / (ctx->Fog.End - ctx->Fog.Start);
-            const GLfloat fogStep = span->fogStep;
-            GLfloat fogCoord = span->fog;
-            const GLfloat wStep = haveW ? span->dwdx : 0.0F;
-            GLfloat w = haveW ? span->w : 1.0F;
+            const GLfloat fogStep = span->attrStepX[FRAG_ATTRIB_FOGC][0];
+            GLfloat fogCoord = span->attrStart[FRAG_ATTRIB_FOGC][0];
+            const GLfloat wStep = haveW ? span->attrStepX[FRAG_ATTRIB_WPOS][3] : 0.0F;
+            GLfloat w = haveW ? span->attrStart[FRAG_ATTRIB_WPOS][3] : 1.0F;
             GLuint i;
             for (i = 0; i < span->end; i++) {
                GLfloat f = (fogEnd - fogCoord / w) * fogScale;
@@ -310,10 +310,10 @@ _swrast_fog_ci_span( const GLcontext *ctx, SWspan *span )
       case GL_EXP:
          {
             const GLfloat density = -ctx->Fog.Density;
-            const GLfloat fogStep = span->fogStep;
-            GLfloat fogCoord = span->fog;
-            const GLfloat wStep = haveW ? span->dwdx : 0.0F;
-            GLfloat w = haveW ? span->w : 1.0F;
+            const GLfloat fogStep = span->attrStepX[FRAG_ATTRIB_FOGC][0];
+            GLfloat fogCoord = span->attrStart[FRAG_ATTRIB_FOGC][0];
+            const GLfloat wStep = haveW ? span->attrStepX[FRAG_ATTRIB_WPOS][3] : 0.0F;
+            GLfloat w = haveW ? span->attrStart[FRAG_ATTRIB_WPOS][3] : 1.0F;
             GLuint i;
             for (i = 0; i < span->end; i++) {
                GLfloat f = EXPF(density * fogCoord / w);
@@ -327,10 +327,10 @@ _swrast_fog_ci_span( const GLcontext *ctx, SWspan *span )
       case GL_EXP2:
          {
             const GLfloat negDensitySquared = -ctx->Fog.Density * ctx->Fog.Density;
-            const GLfloat fogStep = span->fogStep;
-            GLfloat fogCoord = span->fog;
-            const GLfloat wStep = haveW ? span->dwdx : 0.0F;
-            GLfloat w = haveW ? span->w : 1.0F;
+            const GLfloat fogStep = span->attrStepX[FRAG_ATTRIB_FOGC][0];
+            GLfloat fogCoord = span->attrStart[FRAG_ATTRIB_FOGC][0];
+            const GLfloat wStep = haveW ? span->attrStepX[FRAG_ATTRIB_WPOS][3] : 0.0F;
+            GLfloat w = haveW ? span->attrStart[FRAG_ATTRIB_WPOS][3] : 1.0F;
             GLuint i;
             for (i = 0; i < span->end; i++) {
                const GLfloat coord = fogCoord / w;
@@ -368,10 +368,10 @@ _swrast_fog_ci_span( const GLcontext *ctx, SWspan *span )
       /* The span's fog start/step values are blend factors.
        * They were previously computed per-vertex.
        */
-      const GLfloat fogStep = span->fogStep;
-      GLfloat fog = span->fog;
-      const GLfloat wStep = haveW ? span->dwdx : 0.0F;
-      GLfloat w = haveW ? span->w : 1.0F;
+      const GLfloat fogStep = span->attrStepX[FRAG_ATTRIB_FOGC][0];
+      GLfloat fog = span->attrStart[FRAG_ATTRIB_FOGC][0];
+      const GLfloat wStep = haveW ? span->attrStepX[FRAG_ATTRIB_WPOS][3] : 0.0F;
+      GLfloat w = haveW ? span->attrStart[FRAG_ATTRIB_WPOS][3] : 1.0F;
       GLuint i;
       ASSERT(span->interpMask & SPAN_FOG);
       for (i = 0; i < span->end; i++) {