New span attrStart/attrStepX/attrStepY fields to replace fog, specular, etc. fields...
authorBrian <brian@yutani.localnet.net>
Fri, 2 Feb 2007 16:46:43 +0000 (09:46 -0700)
committerBrian <brian@yutani.localnet.net>
Fri, 2 Feb 2007 16:46:43 +0000 (09:46 -0700)
src/mesa/swrast/s_fog.c
src/mesa/swrast/s_fragprog.c
src/mesa/swrast/s_linetemp.h
src/mesa/swrast/s_pointtemp.h
src/mesa/swrast/s_span.c
src/mesa/swrast/s_span.h
src/mesa/swrast/s_tritemp.h
src/mesa/swrast/s_zoom.c

index 93d2ab469f614294f5f296eb72aa1c9922fb4af1..a2bf4c620cc98325dbc4eca77d13a036ff9157fb 100644 (file)
@@ -72,8 +72,8 @@ _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 fogStep = span->attrStepX[FRAG_ATTRIB_FOGC][0];       \
+   GLfloat fogCoord = span->attrStart[FRAG_ATTRIB_FOGC][0];            \
    const GLfloat wStep = haveW ? span->dwdx : 0.0F;                    \
    GLfloat w = haveW ? span->w : 1.0F;                                 \
    GLuint i;                                                           \
@@ -293,8 +293,8 @@ _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 fogStep = span->attrStepX[FRAG_ATTRIB_FOGC][0];
+            GLfloat fogCoord = span->attrStart[FRAG_ATTRIB_FOGC][0];
             const GLfloat wStep = haveW ? span->dwdx : 0.0F;
             GLfloat w = haveW ? span->w : 1.0F;
             GLuint i;
@@ -310,8 +310,8 @@ _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 fogStep = span->attrStepX[FRAG_ATTRIB_FOGC][0];
+            GLfloat fogCoord = span->attrStart[FRAG_ATTRIB_FOGC][0];
             const GLfloat wStep = haveW ? span->dwdx : 0.0F;
             GLfloat w = haveW ? span->w : 1.0F;
             GLuint i;
@@ -327,8 +327,8 @@ _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 fogStep = span->attrStepX[FRAG_ATTRIB_FOGC][0];
+            GLfloat fogCoord = span->attrStart[FRAG_ATTRIB_FOGC][0];
             const GLfloat wStep = haveW ? span->dwdx : 0.0F;
             GLfloat w = haveW ? span->w : 1.0F;
             GLuint i;
@@ -368,8 +368,8 @@ _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 fogStep = span->attrStepX[FRAG_ATTRIB_FOGC][0];
+      GLfloat fog = span->attrStart[FRAG_ATTRIB_FOGC][0];
       const GLfloat wStep = haveW ? span->dwdx : 0.0F;
       GLfloat w = haveW ? span->w : 1.0F;
       GLuint i;
index 9ae423dde92a5b5df1d0948c7039536c05738d6a..22483c56a670719386050da246fc30b498d88e45 100644 (file)
@@ -287,27 +287,27 @@ fetch_vector4_deriv( GLcontext *ctx,
       break;
    case FRAG_ATTRIB_COL1:
       if (xOrY == 'X') {
-         src[0] = span->dsrdx * (1.0F / CHAN_MAXF);
-         src[1] = span->dsgdx * (1.0F / CHAN_MAXF);
-         src[2] = span->dsbdx * (1.0F / CHAN_MAXF);
-         src[3] = 0.0; /* XXX need this */
+         src[0] = span->attrStepX[FRAG_ATTRIB_COL1][0] * (1.0F / CHAN_MAXF);
+         src[1] = span->attrStepX[FRAG_ATTRIB_COL1][1] * (1.0F / CHAN_MAXF);
+         src[2] = span->attrStepX[FRAG_ATTRIB_COL1][2] * (1.0F / CHAN_MAXF);
+         src[3] = span->attrStepX[FRAG_ATTRIB_COL1][3] * (1.0F / CHAN_MAXF);
       }
       else {
-         src[0] = span->dsrdy * (1.0F / CHAN_MAXF);
-         src[1] = span->dsgdy * (1.0F / CHAN_MAXF);
-         src[2] = span->dsbdy * (1.0F / CHAN_MAXF);
-         src[3] = 0.0; /* XXX need this */
+         src[0] = span->attrStepY[FRAG_ATTRIB_COL1][0] * (1.0F / CHAN_MAXF);
+         src[1] = span->attrStepY[FRAG_ATTRIB_COL1][1] * (1.0F / CHAN_MAXF);
+         src[2] = span->attrStepY[FRAG_ATTRIB_COL1][2] * (1.0F / CHAN_MAXF);
+         src[3] = span->attrStepY[FRAG_ATTRIB_COL1][3] * (1.0F / CHAN_MAXF);
       }
       break;
    case FRAG_ATTRIB_FOGC:
       if (xOrY == 'X') {
-         src[0] = span->dfogdx;
+         src[0] = span->attrStepX[FRAG_ATTRIB_FOGC][0] * (1.0F / CHAN_MAXF);
          src[1] = 0.0;
          src[2] = 0.0;
          src[3] = 0.0;
       }
       else {
-         src[0] = span->dfogdy;
+         src[0] = span->attrStepY[FRAG_ATTRIB_FOGC][0] * (1.0F / CHAN_MAXF);
          src[1] = 0.0;
          src[2] = 0.0;
          src[3] = 0.0;
@@ -589,25 +589,25 @@ init_machine_deriv( GLcontext *ctx,
    if (program->Base.InputsRead & FRAG_BIT_COL1) {
       GLfloat *col1 = machine->Attribs[FRAG_ATTRIB_COL1][machine->CurFrag];
       if (xOrY == 'X') {
-         col1[0] += span->dsrdx * (1.0F / CHAN_MAXF);
-         col1[1] += span->dsgdx * (1.0F / CHAN_MAXF);
-         col1[2] += span->dsbdx * (1.0F / CHAN_MAXF);
-         col1[3] += 0.0; /*XXX fix */
+         col1[0] += span->attrStepX[FRAG_ATTRIB_COL1][0] * (1.0F / CHAN_MAXF);
+         col1[1] += span->attrStepX[FRAG_ATTRIB_COL1][1] * (1.0F / CHAN_MAXF);
+         col1[2] += span->attrStepX[FRAG_ATTRIB_COL1][2] * (1.0F / CHAN_MAXF);
+         col1[3] += span->attrStepX[FRAG_ATTRIB_COL1][3] * (1.0F / CHAN_MAXF);
       }
       else {
-         col1[0] += span->dsrdy * (1.0F / CHAN_MAXF);
-         col1[1] += span->dsgdy * (1.0F / CHAN_MAXF);
-         col1[2] += span->dsbdy * (1.0F / CHAN_MAXF);
-         col1[3] += 0.0; /*XXX fix */
+         col1[0] += span->attrStepY[FRAG_ATTRIB_COL1][0] * (1.0F / CHAN_MAXF);
+         col1[1] += span->attrStepY[FRAG_ATTRIB_COL1][1] * (1.0F / CHAN_MAXF);
+         col1[2] += span->attrStepY[FRAG_ATTRIB_COL1][2] * (1.0F / CHAN_MAXF);
+         col1[3] += span->attrStepY[FRAG_ATTRIB_COL1][3] * (1.0F / CHAN_MAXF);
       }
    }
    if (program->Base.InputsRead & FRAG_BIT_FOGC) {
       GLfloat *fogc = machine->Attribs[FRAG_ATTRIB_FOGC][machine->CurFrag];
       if (xOrY == 'X') {
-         fogc[0] += span->dfogdx;
+         fogc[0] += span->attrStepX[FRAG_ATTRIB_FOGC][0];
       }
       else {
-         fogc[0] += span->dfogdy;
+         fogc[0] += span->attrStepY[FRAG_ATTRIB_FOGC][0];
       }
    }
    for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) {
@@ -632,17 +632,18 @@ init_machine_deriv( GLcontext *ctx,
    for (v = 0; v < ctx->Const.MaxVarying; v++) {
       if (program->Base.InputsRead & FRAG_BIT_VAR(v)) {
          GLfloat *var = machine->Attribs[FRAG_ATTRIB_VAR0 + v][machine->CurFrag];
+         GLuint attr = FRAG_ATTRIB_VAR0 + v;
          if (xOrY == 'X') {
-            var[0] += span->varStepX[v][0];
-            var[1] += span->varStepX[v][1];
-            var[2] += span->varStepX[v][2];
-            var[3] += span->varStepX[v][3];
+            var[0] += span->attrStepX[attr][0];
+            var[1] += span->attrStepX[attr][1];
+            var[2] += span->attrStepX[attr][2];
+            var[3] += span->attrStepX[attr][3];
          }
          else {
-            var[0] += span->varStepY[v][0];
-            var[1] += span->varStepY[v][1];
-            var[2] += span->varStepY[v][2];
-            var[3] += span->varStepY[v][3];
+            var[0] += span->attrStepY[attr][0];
+            var[1] += span->attrStepY[attr][1];
+            var[2] += span->attrStepY[attr][2];
+            var[3] += span->attrStepY[attr][3];
          }
       }
    }
index b7b434771ee26ac5c3b7910996b68fb9dc470d7b..d68868ded983064499fb9eedec81754b1829d6f4 100644 (file)
@@ -276,8 +276,8 @@ NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 )
 #endif
 #ifdef INTERP_FOG
    interpFlags |= SPAN_FOG;
-   span.fog = vert0->fog;
-   span.fogStep = (vert1->fog - vert0->fog) / numPixels;
+   span.attrStart[FRAG_ATTRIB_FOGC][0] = vert0->fog;
+   span.attrStepX[FRAG_ATTRIB_FOGC][0] = (vert1->fog - vert0->fog) / numPixels;
 #endif
 #ifdef INTERP_TEX
    interpFlags |= SPAN_TEXTURE;
@@ -345,23 +345,24 @@ NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 )
       GLuint v;
       for (v = 0; v < MAX_VARYING; v++) {
          if (inputsUsed & FRAG_BIT_VAR(v)) {
+            GLuint attr = FRAG_ATTRIB_VAR0 + v;
             GLfloat ds, dt, dr, dq;
-            span.var[v][0] = invw0 * vert0->varying[v][0];
-            span.var[v][1] = invw0 * vert0->varying[v][1];
-            span.var[v][2] = invw0 * vert0->varying[v][2];
-            span.var[v][3] = invw0 * vert0->varying[v][3];
-            ds = (invw1 * vert1->varying[v][0]) - span.var[v][0];
-            dt = (invw1 * vert1->varying[v][1]) - span.var[v][1];
-            dr = (invw1 * vert1->varying[v][2]) - span.var[v][2];
-            dq = (invw1 * vert1->varying[v][3]) - span.var[v][3];
-            span.varStepX[v][0] = ds * invLen;
-            span.varStepX[v][1] = dt * invLen;
-            span.varStepX[v][2] = dr * invLen;
-            span.varStepX[v][3] = dq * invLen;
-            span.varStepY[v][0] = 0.0F;
-            span.varStepY[v][1] = 0.0F;
-            span.varStepY[v][2] = 0.0F;
-            span.varStepY[v][3] = 0.0F;
+            span.attrStart[attr][0] = invw0 * vert0->varying[v][0];
+            span.attrStart[attr][1] = invw0 * vert0->varying[v][1];
+            span.attrStart[attr][2] = invw0 * vert0->varying[v][2];
+            span.attrStart[attr][3] = invw0 * vert0->varying[v][3];
+            ds = (invw1 * vert1->varying[v][0]) - span.attrStart[attr][0];
+            dt = (invw1 * vert1->varying[v][1]) - span.attrStart[attr][1];
+            dr = (invw1 * vert1->varying[v][2]) - span.attrStart[attr][2];
+            dq = (invw1 * vert1->varying[v][3]) - span.attrStart[attr][3];
+            span.attrStepX[attr][0] = ds * invLen;
+            span.attrStepX[attr][1] = dt * invLen;
+            span.attrStepX[attr][2] = dr * invLen;
+            span.attrStepX[attr][3] = dq * invLen;
+            span.attrStepY[attr][0] = 0.0F;
+            span.attrStepY[attr][1] = 0.0F;
+            span.attrStepY[attr][2] = 0.0F;
+            span.attrStepY[attr][3] = 0.0F;
          }
       }
    }
index f68630af93a54c5498480fec702215f347003e09..f769f524a0a93f78474b909c80afb8ac14b01a3d 100644 (file)
@@ -107,8 +107,9 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
     */
    span->interpMask = SPAN_FOG;
    span->arrayMask = SPAN_XY | SPAN_Z;
-   span->fog = vert->fog;
-   span->fogStep = 0.0;
+   span->attrStart[FRAG_ATTRIB_FOGC][0] = vert->fog;
+   span->attrStepX[FRAG_ATTRIB_FOGC][0] = 0.0;
+   span->attrStepY[FRAG_ATTRIB_FOGC][0] = 0.0;
 #if FLAGS & RGBA
    span->arrayMask |= SPAN_RGBA;
 #endif
index 4a562752a80a728e6ea4251e4781d0a766060791..52c7501df840a024a54ce25bed9ebde3535204bc 100644 (file)
@@ -75,8 +75,9 @@ _swrast_span_default_z( GLcontext *ctx, SWspan *span )
 void
 _swrast_span_default_fog( GLcontext *ctx, SWspan *span )
 {
-   span->fog = _swrast_z_to_fogfactor(ctx, ctx->Current.RasterDistance);
-   span->fogStep = span->dfogdx = span->dfogdy = 0.0F;
+   span->attrStart[FRAG_ATTRIB_FOGC][0] = _swrast_z_to_fogfactor(ctx, ctx->Current.RasterDistance);
+   span->attrStepX[FRAG_ATTRIB_FOGC][0] = 0.0;
+   span->attrStepY[FRAG_ATTRIB_FOGC][0] = 0.0;
    span->interpMask |= SPAN_FOG;
 }
 
@@ -431,8 +432,8 @@ static INLINE void
 interpolate_fog(const GLcontext *ctx, SWspan *span)
 {
    GLfloat (*fog)[4] = span->array->attribs[FRAG_ATTRIB_FOGC];
-   const GLfloat fogStep = span->fogStep;
-   GLfloat fogCoord = span->fog;
+   const GLfloat fogStep = span->attrStepX[FRAG_ATTRIB_FOGC][0];
+   GLfloat fogCoord = span->attrStart[FRAG_ATTRIB_FOGC][0];
    const GLuint haveW = (span->interpMask & SPAN_W);
    const GLfloat wStep = haveW ? span->dwdx : 0.0F;
    GLfloat w = haveW ? span->w : 1.0F;
@@ -834,16 +835,17 @@ interpolate_varying(GLcontext *ctx, SWspan *span)
 
    for (var = 0; var < MAX_VARYING; var++) {
       if (inputsUsed & FRAG_BIT_VAR(var)) {
+         const GLuint attr = FRAG_ATTRIB_VAR0 + var;
          GLuint j;
          for (j = 0; j < 4; j++) {
-            const GLfloat dvdx = span->varStepX[var][j];
-            GLfloat v = span->var[var][j];
+            const GLfloat dvdx = span->attrStepX[attr][j];
+            GLfloat v = span->attrStart[attr][j];
             const GLfloat dwdx = span->dwdx;
             GLfloat w = span->w;
             GLuint k;
             for (k = 0; k < span->end; k++) {
                GLfloat invW = 1.0f / w;
-               span->array->attribs[FRAG_ATTRIB_VAR0 + var][k][j] = v * invW;
+               span->array->attribs[attr][k][j] = v * invW;
                v += dvdx;
                w += dwdx;
             }
index c5f79871f1ba97b1d0ea2ba2873d2351d1d6225c..f60d4279e152184d8d87d8d4328a206777236bc0 100644 (file)
@@ -169,14 +169,15 @@ typedef struct sw_span
 #endif
    GLfixed index, indexStep;
    GLfixed z, zStep;    /* XXX z should probably be GLuint */
-   GLfloat fog, fogStep;
    GLfloat tex[MAX_TEXTURE_COORD_UNITS][4];  /* s, t, r, q */
    GLfloat texStepX[MAX_TEXTURE_COORD_UNITS][4];
    GLfloat texStepY[MAX_TEXTURE_COORD_UNITS][4];
    GLfixed intTex[2], intTexStep[2];  /* s, t only */
-   GLfloat var[MAX_VARYING][4];
-   GLfloat varStepX[MAX_VARYING][4];
-   GLfloat varStepY[MAX_VARYING][4];
+
+   /** Fragment attribute interpolants */
+   GLfloat attrStart[FRAG_ATTRIB_MAX][4];   /**< initial value */
+   GLfloat attrStepX[FRAG_ATTRIB_MAX][4];   /**< dvalue/dx */
+   GLfloat attrStepY[FRAG_ATTRIB_MAX][4];   /**< dvalue/dy */
 
    /* partial derivatives wrt X and Y. */
    GLfloat dzdx, dzdy;
@@ -185,10 +186,6 @@ typedef struct sw_span
    GLfloat dgdx, dgdy;
    GLfloat dbdx, dbdy;
    GLfloat dadx, dady;
-   GLfloat dsrdx, dsrdy;
-   GLfloat dsgdx, dsgdy;
-   GLfloat dsbdx, dsbdy;
-   GLfloat dfogdx, dfogdy;
 
    /**
     * This bitmask (of \link SpanFlags SPAN_* flags\endlink) indicates
index 6ff52b5e4a0a80e635ba0b184441f27499edf919..c8fe4b6e9e557dee5d4973502a7cb8d2273f23ef 100644 (file)
       GLuint iv, ic;                           \
       for (iv = 0; iv < MAX_VARYING; iv++) {   \
          if (inputsUsed & FRAG_BIT_VAR(iv)) {  \
+            GLuint attr = FRAG_ATTRIB_VAR0 + iv; \
             for (ic = 0; ic < 4; ic++) {       \
                CODE                            \
             }                                  \
@@ -507,9 +508,8 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
          const GLfloat eMaj_dfog = vMax->fog - vMin->fog;
          const GLfloat eBot_dfog = vMid->fog - vMin->fog;
 #  endif
-         span.dfogdx = oneOverArea * (eMaj_dfog * eBot.dy - eMaj.dy * eBot_dfog);
-         span.dfogdy = oneOverArea * (eMaj.dx * eBot_dfog - eMaj_dfog * eBot.dx);
-         span.fogStep = span.dfogdx;
+         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);
       }
 #endif
 #ifdef INTERP_RGB
@@ -584,26 +584,26 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
          GLfloat eBot_dsg = (GLfloat) ((ColorTemp) vMid->specular[GCOMP] - (ColorTemp) vMin->specular[GCOMP]);
          GLfloat eMaj_dsb = (GLfloat) ((ColorTemp) vMax->specular[BCOMP] - (ColorTemp) vMin->specular[BCOMP]);
          GLfloat eBot_dsb = (GLfloat) ((ColorTemp) vMid->specular[BCOMP] - (ColorTemp) vMin->specular[BCOMP]);
-         span.dsrdx = oneOverArea * (eMaj_dsr * eBot.dy - eMaj.dy * eBot_dsr);
-         span.dsrdy = oneOverArea * (eMaj.dx * eBot_dsr - eMaj_dsr * eBot.dx);
-         span.dsgdx = oneOverArea * (eMaj_dsg * eBot.dy - eMaj.dy * eBot_dsg);
-         span.dsgdy = oneOverArea * (eMaj.dx * eBot_dsg - eMaj_dsg * eBot.dx);
-         span.dsbdx = oneOverArea * (eMaj_dsb * eBot.dy - eMaj.dy * eBot_dsb);
-         span.dsbdy = oneOverArea * (eMaj.dx * eBot_dsb - eMaj_dsb * eBot.dx);
+         span.attrStepX[FRAG_ATTRIB_COL1][0] = oneOverArea * (eMaj_dsr * eBot.dy - eMaj.dy * eBot_dsr);
+         span.attrStepY[FRAG_ATTRIB_COL1][0] = oneOverArea * (eMaj.dx * eBot_dsr - eMaj_dsr * eBot.dx);
+         span.attrStepX[FRAG_ATTRIB_COL1][1] = oneOverArea * (eMaj_dsg * eBot.dy - eMaj.dy * eBot_dsg);
+         span.attrStepY[FRAG_ATTRIB_COL1][1] = oneOverArea * (eMaj.dx * eBot_dsg - eMaj_dsg * eBot.dx);
+         span.attrStepX[FRAG_ATTRIB_COL1][2] = oneOverArea * (eMaj_dsb * eBot.dy - eMaj.dy * eBot_dsb);
+         span.attrStepY[FRAG_ATTRIB_COL1][2] = oneOverArea * (eMaj.dx * eBot_dsb - eMaj_dsb * eBot.dx);
 #  if CHAN_TYPE == GL_FLOAT
-         span.specRedStep   = span.dsrdx;
+         span.specRedStep   = span.attrStep[FRAG_ATTRIB_COL1][0];
          span.specGreenStep = span.dsgdx;
          span.specBlueStep  = span.dsbdx;
 #  else
-         span.specRedStep   = SignedFloatToFixed(span.dsrdx);
-         span.specGreenStep = SignedFloatToFixed(span.dsgdx);
-         span.specBlueStep  = SignedFloatToFixed(span.dsbdx);
+         span.specRedStep   = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL1][0]);
+         span.specGreenStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL1][1]);
+         span.specBlueStep  = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL1][2]);
 #  endif
       }
       else {
-         span.dsrdx = span.dsrdy = 0.0F;
-         span.dsgdx = span.dsgdy = 0.0F;
-         span.dsbdx = span.dsbdy = 0.0F;
+         span.attrStepX[FRAG_ATTRIB_COL1][0] = span.attrStepY[FRAG_ATTRIB_COL1][0] = 0.0F;
+         span.attrStepX[FRAG_ATTRIB_COL1][1] = span.attrStepY[FRAG_ATTRIB_COL1][1] = 0.0F;
+         span.attrStepX[FRAG_ATTRIB_COL1][2] = span.attrStepY[FRAG_ATTRIB_COL1][2] = 0.0F;
 #  if CHAN_TYPE == GL_FLOAT
         span.specRedStep   = 0.0F;
         span.specGreenStep = 0.0F;
@@ -678,8 +678,8 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
          VARYING_LOOP(
             GLfloat eMaj_dvar = vMax->varying[iv][ic] * wMax - vMin->varying[iv][ic] * wMin;
             GLfloat eBot_dvar = vMid->varying[iv][ic] * wMid - vMin->varying[iv][ic] * wMin;
-            span.varStepX[iv][ic] = oneOverArea * (eMaj_dvar * eBot.dy - eMaj.dy * eBot_dvar);
-            span.varStepY[iv][ic] = oneOverArea * (eMaj.dx * eBot_dvar - eMaj_dvar * eBot.dx);
+            span.attrStepX[attr][ic] = oneOverArea * (eMaj_dvar * eBot.dy - eMaj.dy * eBot_dvar);
+            span.attrStepY[attr][ic] = oneOverArea * (eMaj.dx * eBot_dvar - eMaj_dvar * eBot.dx);
          )
       }
 #endif
@@ -928,11 +928,11 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
 #endif
 #ifdef INTERP_FOG
 #  ifdef INTERP_W
-               fogLeft = vLower->fog * vLower->win[3] + (span.dfogdx * adjx + span.dfogdy * adjy) * (1.0F/FIXED_SCALE);
+               fogLeft = vLower->fog * 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.dfogdx * adjx + span.dfogdy * adjy) * (1.0F/FIXED_SCALE);
+               fogLeft = vLower->fog + (span.attrStepX[FRAG_ATTRIB_FOGC][0] * adjx + span.attrStepY[FRAG_ATTRIB_FOGC][0] * adjy) * (1.0F/FIXED_SCALE);
 #  endif
-               dfogOuter = span.dfogdy + dxOuter * span.dfogdx;
+               dfogOuter = span.attrStepY[FRAG_ATTRIB_FOGC][0] + dxOuter * span.attrStepX[FRAG_ATTRIB_FOGC][0];
 #endif
 #ifdef INTERP_RGB
                if (ctx->Light.ShadeModel == GL_SMOOTH) {
@@ -990,19 +990,19 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
 #ifdef INTERP_SPEC
                if (ctx->Light.ShadeModel == GL_SMOOTH) {
 #  if CHAN_TYPE == GL_FLOAT
-                  srLeft = vLower->specular[RCOMP] + (span.dsrdx * adjx + span.dsrdy * adjy) * (1.0F / FIXED_SCALE);
-                  sgLeft = vLower->specular[GCOMP] + (span.dsgdx * adjx + span.dsgdy * adjy) * (1.0F / FIXED_SCALE);
-                  sbLeft = vLower->specular[BCOMP] + (span.dsbdx * adjx + span.dsbdy * adjy) * (1.0F / FIXED_SCALE);
-                  dsrOuter = span.dsrdy + dxOuter * span.dsrdx;
-                  dsgOuter = span.dsgdy + dxOuter * span.dsgdx;
-                  dsbOuter = span.dsbdy + dxOuter * span.dsbdx;
+                  srLeft = vLower->specular[RCOMP] + (span.attrStepX[FRAG_ATTRIB_COL1][0] * adjx + span.attrStepY[FRAG_ATTRIB_COL1][0] * adjy) * (1.0F / FIXED_SCALE);
+                  sgLeft = vLower->specular[GCOMP] + (span.attrStepX[FRAG_ATTRIB_COL1][1] * adjx + span.attrStepY[FRAG_ATTRIB_COL1][1] * adjy) * (1.0F / FIXED_SCALE);
+                  sbLeft = vLower->specular[BCOMP] + (span.attrStepX[FRAG_ATTRIB_COL1][2] * adjx + span.attrStepY[FRAG_ATTRIB_COL1][2] * adjy) * (1.0F / FIXED_SCALE);
+                  dsrOuter = span.attrStepY[FRAG_ATTRIB_COL1][0] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL1][0];
+                  dsgOuter = span.attrStepY[FRAG_ATTRIB_COL1][1] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL1][1];
+                  dsbOuter = span.attrStepY[FRAG_ATTRIB_COL1][2] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL1][2];
 #  else
-                  srLeft = (GLfixed) (ChanToFixed(vLower->specular[RCOMP]) + span.dsrdx * adjx + span.dsrdy * adjy) + FIXED_HALF;
-                  sgLeft = (GLfixed) (ChanToFixed(vLower->specular[GCOMP]) + span.dsgdx * adjx + span.dsgdy * adjy) + FIXED_HALF;
-                  sbLeft = (GLfixed) (ChanToFixed(vLower->specular[BCOMP]) + span.dsbdx * adjx + span.dsbdy * adjy) + FIXED_HALF;
-                  dsrOuter = SignedFloatToFixed(span.dsrdy + dxOuter * span.dsrdx);
-                  dsgOuter = SignedFloatToFixed(span.dsgdy + dxOuter * span.dsgdx);
-                  dsbOuter = SignedFloatToFixed(span.dsbdy + dxOuter * span.dsbdx);
+                  srLeft = (GLfixed) (ChanToFixed(vLower->specular[RCOMP]) + span.attrStepX[FRAG_ATTRIB_COL1][0] * adjx + span.attrStepY[FRAG_ATTRIB_COL1][0] * adjy) + FIXED_HALF;
+                  sgLeft = (GLfixed) (ChanToFixed(vLower->specular[GCOMP]) + span.attrStepX[FRAG_ATTRIB_COL1][1] * adjx + span.attrStepY[FRAG_ATTRIB_COL1][1] * adjy) + FIXED_HALF;
+                  sbLeft = (GLfixed) (ChanToFixed(vLower->specular[BCOMP]) + span.attrStepX[FRAG_ATTRIB_COL1][2] * adjx + span.attrStepY[FRAG_ATTRIB_COL1][2] * adjy) + FIXED_HALF;
+                  dsrOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL1][0] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL1][0]);
+                  dsgOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL1][1] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL1][1]);
+                  dsbOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL1][2] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL1][2]);
 #  endif
                }
                else {
@@ -1068,9 +1068,9 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
                VARYING_LOOP(
                   const GLfloat invW = vLower->win[3];
                   const GLfloat var0 = vLower->varying[iv][ic] * invW;
-                  varLeft[iv][ic] = var0 + (span.varStepX[iv][ic] * adjx +
-                     span.varStepY[iv][ic] * adjy) * (1.0f / FIXED_SCALE);
-                  dvarOuter[iv][ic] = span.varStepY[iv][ic] + dxOuter * span.varStepX[iv][ic];
+                  varLeft[iv][ic] = var0 + (span.attrStepX[attr][ic] * adjx +
+                     span.attrStepY[attr][ic] * adjy) * (1.0f / FIXED_SCALE);
+                  dvarOuter[iv][ic] = span.attrStepY[attr][ic] + dxOuter * span.attrStepX[attr][ic];
                )
 #endif
             } /*if setupLeft*/
@@ -1105,7 +1105,7 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
             dwInner = dwOuter + span.dwdx;
 #endif
 #ifdef INTERP_FOG
-            dfogInner = dfogOuter + span.dfogdx;
+            dfogInner = dfogOuter + span.attrStepX[FRAG_ATTRIB_FOGC][0];
 #endif
 #ifdef INTERP_RGB
             fdrInner = fdrOuter + span.redStep;
@@ -1137,7 +1137,7 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
 #endif
 #ifdef INTERP_VARYING
             VARYING_LOOP(
-               dvarInner[iv][ic] = dvarOuter[iv][ic] + span.varStepX[iv][ic];
+               dvarInner[iv][ic] = dvarOuter[iv][ic] + span.attrStepX[attr][ic];
             )
 #endif
 
@@ -1158,7 +1158,7 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
                span.w = wLeft;
 #endif
 #ifdef INTERP_FOG
-               span.fog = fogLeft;
+               span.attrStart[FRAG_ATTRIB_FOGC][0] = fogLeft;
 #endif
 #ifdef INTERP_RGB
                span.red = rLeft;
@@ -1191,7 +1191,7 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
 #endif
 #ifdef INTERP_VARYING
                VARYING_LOOP(
-                  span.var[iv][ic] = varLeft[iv][ic];
+                  span.attrStart[attr][ic] = varLeft[iv][ic];
                )
 #endif
 
index 34732a67e6d0aa2bbfa7fdbbc30f209e7b186583..a4e8d9a36fe6d300115f0aca41d25d46f45b2248 100644 (file)
@@ -159,8 +159,9 @@ zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span,
 
 
    /* copy fog interp info */
-   zoomed.fog = span->fog;
-   zoomed.fogStep = span->fogStep;
+   zoomed.attrStart[FRAG_ATTRIB_FOGC][0] = span->attrStart[FRAG_ATTRIB_FOGC][0];
+   zoomed.attrStepX[FRAG_ATTRIB_FOGC][0] = span->attrStepX[FRAG_ATTRIB_FOGC][0];
+   zoomed.attrStepY[FRAG_ATTRIB_FOGC][0] = span->attrStepY[FRAG_ATTRIB_FOGC][0];
    /* XXX copy texcoord info? */
 
    if (format == GL_RGBA || format == GL_RGB) {