swrast: fix span color array pointer assignment for 32-bit/channel rendering
[mesa.git] / src / mesa / swrast / s_tritemp.h
index c609210c0ec9f7bc0ee33edce200dddd901ff872..0aa8739f4f2558f33829b97d7df5f4dbd2eab4fc 100644 (file)
@@ -32,7 +32,6 @@
  *    INTERP_Z        - if defined, interpolate integer Z values
  *    INTERP_RGB      - if defined, interpolate integer RGB values
  *    INTERP_ALPHA    - if defined, interpolate integer Alpha values
- *    INTERP_INDEX    - if defined, interpolate color index values
  *    INTERP_INT_TEX  - if defined, interpolate integer ST texcoords
  *                         (fast, simple 2-D texture mapping, without
  *                         perspective correction)
@@ -136,7 +135,7 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
    EdgeT eMaj, eTop, eBot;
    GLfloat oneOverArea;
    const SWvertex *vMin, *vMid, *vMax;  /* Y(vMin)<=Y(vMid)<=Y(vMax) */
-   GLfloat bf = SWRAST_CONTEXT(ctx)->_BackfaceCullSign;
+   GLfloat bf = SWRAST_CONTEXT(ctx)->_BackfaceSign;
    const GLint snapMask = ~((FIXED_ONE / (1 << SUB_PIXEL_BITS)) - 1); /* for x/y coord snapping */
    GLfixed vMin_fx, vMin_fy, vMid_fx, vMid_fy, vMax_fx, vMax_fy;
 
@@ -234,18 +233,17 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
    /* compute area, oneOverArea and perform backface culling */
    {
       const GLfloat area = eMaj.dx * eBot.dy - eBot.dx * eMaj.dy;
-      /* Do backface culling */
 
-      if (area * bf < 0.0)
+      if (IS_INF_OR_NAN(area) || area == 0.0F)
          return;
 
-      if (IS_INF_OR_NAN(area) || area == 0.0F)
+      if (area * bf * swrast->_BackfaceCullSign < 0.0)
          return;
 
       oneOverArea = 1.0F / area;
 
       /* 0 = front, 1 = back */
-      span.facing = oneOverArea * swrast->_BackfaceSign > 0.0F;
+      span.facing = oneOverArea * bf > 0.0F;
    }
 
    /* Edge setup.  For a triangle strip these could be reused... */
@@ -320,9 +318,6 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
 
    {
       GLint scan_from_left_to_right;  /* true if scanning left-to-right */
-#ifdef INTERP_INDEX
-      GLfloat didx, didy;
-#endif
 
       /*
        * Execute user-supplied setup code
@@ -399,21 +394,6 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
 #  endif
       }
 #endif /* INTERP_RGB */
-#ifdef INTERP_INDEX
-      span.interpMask |= SPAN_INDEX;
-      if (ctx->Light.ShadeModel == GL_SMOOTH) {
-         GLfloat eMaj_di = vMax->attrib[FRAG_ATTRIB_CI][0] - vMin->attrib[FRAG_ATTRIB_CI][0];
-         GLfloat eBot_di = vMid->attrib[FRAG_ATTRIB_CI][0] - vMin->attrib[FRAG_ATTRIB_CI][0];
-         didx = oneOverArea * (eMaj_di * eBot.dy - eMaj.dy * eBot_di);
-         didy = oneOverArea * (eMaj.dx * eBot_di - eMaj_di * eBot.dx);
-         span.indexStep = SignedFloatToFixed(didx);
-      }
-      else {
-         span.interpMask |= SPAN_FLAT;
-         didx = didy = 0.0F;
-         span.indexStep = 0;
-      }
-#endif
 #ifdef INTERP_INT_TEX
       {
          GLfloat eMaj_ds = (vMax->attrib[FRAG_ATTRIB_TEX0][0] - vMin->attrib[FRAG_ATTRIB_TEX0][0]) * S_SCALE;
@@ -532,9 +512,6 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
 #ifdef INTERP_ALPHA
          GLint aLeft = 0, fdaOuter = 0, fdaInner;
 #endif
-#ifdef INTERP_INDEX
-         GLfixed iLeft=0, diOuter=0, diInner;
-#endif
 #ifdef INTERP_INT_TEX
          GLfixed sLeft=0, dsOuter=0, dsInner;
          GLfixed tLeft=0, dtOuter=0, dtInner;
@@ -698,18 +675,6 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
 #endif /* INTERP_RGB */
 
 
-#ifdef INTERP_INDEX
-               if (ctx->Light.ShadeModel == GL_SMOOTH) {
-                  iLeft = (GLfixed)(vLower->attrib[FRAG_ATTRIB_CI][0] * FIXED_SCALE
-                                 + didx * adjx + didy * adjy) + FIXED_HALF;
-                  diOuter = SignedFloatToFixed(didy + dxOuter * didx);
-               }
-               else {
-                  ASSERT(ctx->Light.ShadeModel == GL_FLAT);
-                  iLeft = FloatToFixed(v2->attrib[FRAG_ATTRIB_CI][0]);
-                  diOuter = 0;
-               }
-#endif
 #ifdef INTERP_INT_TEX
                {
                   GLfloat s0, t0;
@@ -785,9 +750,6 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
 #ifdef INTERP_ALPHA
             fdaInner = fdaOuter + span.alphaStep;
 #endif
-#ifdef INTERP_INDEX
-            diInner = diOuter + span.indexStep;
-#endif
 #ifdef INTERP_INT_TEX
             dsInner = dsOuter + span.intTexStep[0];
             dtInner = dtOuter + span.intTexStep[1];
@@ -823,9 +785,6 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
 #ifdef INTERP_ALPHA
                span.alpha = aLeft;
 #endif
-#ifdef INTERP_INDEX
-               span.index = iLeft;
-#endif
 #ifdef INTERP_INT_TEX
                span.intTex[0] = sLeft;
                span.intTex[1] = tLeft;
@@ -855,9 +814,6 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
 #endif
 #ifdef INTERP_ALPHA
                   CLAMP_INTERPOLANT(alpha, alphaStep, len);
-#endif
-#ifdef INTERP_INDEX
-                  CLAMP_INTERPOLANT(index, indexStep, len);
 #endif
                   {
                      RENDER_SPAN( span );
@@ -897,9 +853,6 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
 #ifdef INTERP_ALPHA
                   aLeft += fdaOuter;
 #endif
-#ifdef INTERP_INDEX
-                  iLeft += diOuter;
-#endif
 #ifdef INTERP_INT_TEX
                   sLeft += dsOuter;
                   tLeft += dtOuter;
@@ -932,9 +885,6 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
 #ifdef INTERP_ALPHA
                   aLeft += fdaInner;
 #endif
-#ifdef INTERP_INDEX
-                  iLeft += diInner;
-#endif
 #ifdef INTERP_INT_TEX
                   sLeft += dsInner;
                   tLeft += dtInner;
@@ -968,7 +918,6 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
 #undef INTERP_Z
 #undef INTERP_RGB
 #undef INTERP_ALPHA
-#undef INTERP_INDEX
 #undef INTERP_INT_TEX
 #undef INTERP_ATTRIBS