remove SWvertex->fog field, use attrib field
authorBrian <brian@nostromo.localnet.net>
Tue, 24 Apr 2007 04:01:34 +0000 (22:01 -0600)
committerBrian <brian@nostromo.localnet.net>
Tue, 24 Apr 2007 04:01:34 +0000 (22:01 -0600)
src/mesa/swrast/s_aalinetemp.h
src/mesa/swrast/s_aatritemp.h
src/mesa/swrast/s_context.c
src/mesa/swrast/s_linetemp.h
src/mesa/swrast/s_pointtemp.h
src/mesa/swrast/s_tritemp.h
src/mesa/swrast/swrast.h

index b0b73e8..ef26e9e 100644 (file)
@@ -153,7 +153,9 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
 #ifdef DO_FOG
    line.span.arrayMask |= SPAN_FOG;
    compute_plane(line.x0, line.y0, line.x1, line.y1,
-                 v0->fog, v1->fog, line.fPlane);
+                 v0->attrib[FRAG_ATTRIB_FOGC][0],
+                 v1->attrib[FRAG_ATTRIB_FOGC][0],
+                 line.fPlane);
 #endif
 #ifdef DO_RGBA
    line.span.arrayMask |= SPAN_RGBA;
index f6c8e68..8ff52cb 100644 (file)
    span.arrayMask |= SPAN_Z;
 #endif
 #ifdef DO_FOG
-   compute_plane(p0, p1, p2, v0->fog, v1->fog, v2->fog, fogPlane);
+   compute_plane(p0, p1, p2,
+                 v0->attrib[FRAG_ATTRIB_FOGC][0],
+                 v1->attrib[FRAG_ATTRIB_FOGC][0],
+                 v2->attrib[FRAG_ATTRIB_FOGC][0],
+                 fogPlane);
    span.arrayMask |= SPAN_FOG;
 #endif
 #ifdef DO_RGBA
index d4782aa..522a66f 100644 (file)
@@ -910,7 +910,7 @@ _swrast_print_vertex( GLcontext *ctx, const SWvertex *v )
                   v->specular[0], v->specular[1],
                   v->specular[2], v->specular[3]);
 #endif
-      _mesa_debug(ctx, "fog %f\n", v->fog);
+      _mesa_debug(ctx, "fog %f\n", v->attrib[FRAG_ATTRIB_FOGC][0]);
       _mesa_debug(ctx, "index %d\n", v->index);
       _mesa_debug(ctx, "pointsize %f\n", v->pointSize);
       _mesa_debug(ctx, "\n");
index 6c52e8d..76da446 100644 (file)
@@ -280,8 +280,9 @@ NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 )
 #endif
 #ifdef INTERP_FOG
    interpFlags |= SPAN_FOG;
-   span.attrStart[FRAG_ATTRIB_FOGC][0] = vert0->fog;
-   span.attrStepX[FRAG_ATTRIB_FOGC][0] = (vert1->fog - vert0->fog) / numPixels;
+   span.attrStart[FRAG_ATTRIB_FOGC][0] = vert0->attrib[FRAG_ATTRIB_FOGC][0];
+   span.attrStepX[FRAG_ATTRIB_FOGC][0] = (vert1->attrib[FRAG_ATTRIB_FOGC][0]
+                                          - vert0->attrib[FRAG_ATTRIB_FOGC][0]) / numPixels;
 #endif
 #ifdef INTERP_TEX
    interpFlags |= SPAN_TEXTURE;
index 23ac571..500b3fe 100644 (file)
@@ -105,7 +105,7 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
     */
    span->interpMask = SPAN_FOG;
    span->arrayMask = SPAN_XY | SPAN_Z;
-   span->attrStart[FRAG_ATTRIB_FOGC][0] = vert->fog;
+   span->attrStart[FRAG_ATTRIB_FOGC][0] = vert->attrib[FRAG_ATTRIB_FOGC][0];
    span->attrStepX[FRAG_ATTRIB_FOGC][0] = 0.0;
    span->attrStepY[FRAG_ATTRIB_FOGC][0] = 0.0;
 #if FLAGS & RGBA
index deab7ed..97c7942 100644 (file)
@@ -458,11 +458,11 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
       {
 #  ifdef INTERP_W
          const GLfloat wMax = vMax->win[3], wMin = vMin->win[3], wMid = vMid->win[3];
-         const GLfloat eMaj_dfog = vMax->fog * wMax - vMin->fog * wMin;
-         const GLfloat eBot_dfog = vMid->fog * wMid - vMin->fog * wMin;
+         const GLfloat eMaj_dfog = vMax->attrib[FRAG_ATTRIB_FOGC][0] * wMax - vMin->attrib[FRAG_ATTRIB_FOGC][0] * wMin;
+         const GLfloat eBot_dfog = vMid->attrib[FRAG_ATTRIB_FOGC][0] * wMid - vMin->attrib[FRAG_ATTRIB_FOGC][0] * wMin;
 #  else
-         const GLfloat eMaj_dfog = vMax->fog - vMin->fog;
-         const GLfloat eBot_dfog = vMid->fog - vMin->fog;
+         const GLfloat eMaj_dfog = vMax->attrib[FRAG_ATTRIB_FOGC][0] - vMin->attrib[FRAG_ATTRIB_FOGC][0];
+         const GLfloat eBot_dfog = vMid->attrib[FRAG_ATTRIB_FOGC][0] - vMin->attrib[FRAG_ATTRIB_FOGC][0];
 #  endif
          span.attrStepX[FRAG_ATTRIB_FOGC][0] = oneOverArea * (eMaj_dfog * eBot.dy - eMaj.dy * eBot_dfog);
          span.attrStepY[FRAG_ATTRIB_FOGC][0] = oneOverArea * (eMaj.dx * eBot_dfog - eMaj_dfog * eBot.dx);
@@ -867,9 +867,9 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
 #endif
 #ifdef INTERP_FOG
 #  ifdef INTERP_W
-               fogLeft = vLower->fog * vLower->win[3] + (span.attrStepX[FRAG_ATTRIB_FOGC][0] * adjx + span.attrStepY[FRAG_ATTRIB_FOGC][0] * adjy) * (1.0F/FIXED_SCALE);
+               fogLeft = vLower->attrib[FRAG_ATTRIB_FOGC][0] * vLower->win[3] + (span.attrStepX[FRAG_ATTRIB_FOGC][0] * adjx + span.attrStepY[FRAG_ATTRIB_FOGC][0] * adjy) * (1.0F/FIXED_SCALE);
 #  else
-               fogLeft = vLower->fog + (span.attrStepX[FRAG_ATTRIB_FOGC][0] * adjx + span.attrStepY[FRAG_ATTRIB_FOGC][0] * adjy) * (1.0F/FIXED_SCALE);
+               fogLeft = vLower->attrib[FRAG_ATTRIB_FOGC][0] + (span.attrStepX[FRAG_ATTRIB_FOGC][0] * adjx + span.attrStepY[FRAG_ATTRIB_FOGC][0] * adjy) * (1.0F/FIXED_SCALE);
 #  endif
                dfogOuter = span.attrStepY[FRAG_ATTRIB_FOGC][0] + dxOuter * span.attrStepX[FRAG_ATTRIB_FOGC][0];
 #endif
index 9e1fe24..12264a1 100644 (file)
@@ -69,7 +69,6 @@ typedef struct {
    GLfloat win[4];
    GLchan color[4];
    GLchan specular[4];
-   GLfloat fog;
    GLfloat index;
    GLfloat pointSize;
    GLfloat attrib[FRAG_ATTRIB_MAX][4]; /**< texcoords & varying, more to come */