swrast: Remove remaining color-index state tracking infrastructure
authorIan Romanick <ian.d.romanick@intel.com>
Thu, 25 Feb 2010 00:02:38 +0000 (16:02 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 3 Mar 2010 20:37:04 +0000 (12:37 -0800)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/swrast/s_context.c
src/mesa/swrast/s_span.c

index 0d4680db9f7f6d696d91b8c0c4f37f7533e9b811..751966348b1f2802efb8259fb1ea8e3f1e1ce344 100644 (file)
@@ -63,24 +63,17 @@ _swrast_update_rasterflags( GLcontext *ctx )
    if (swrast->_FogEnabled)               rasterMask |= FOG_BIT;
    if (ctx->Scissor.Enabled)              rasterMask |= CLIP_BIT;
    if (ctx->Stencil._Enabled)             rasterMask |= STENCIL_BIT;
-   if (ctx->Visual.rgbMode) {
-      for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
-         if (!ctx->Color.ColorMask[i][0] ||
-             !ctx->Color.ColorMask[i][1] ||
-             !ctx->Color.ColorMask[i][2] ||
-             !ctx->Color.ColorMask[i][3]) {
-            rasterMask |= MASKING_BIT;
-            break;
-         }
+   for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
+      if (!ctx->Color.ColorMask[i][0] ||
+          !ctx->Color.ColorMask[i][1] ||
+          !ctx->Color.ColorMask[i][2] ||
+          !ctx->Color.ColorMask[i][3]) {
+         rasterMask |= MASKING_BIT;
+         break;
       }
-      if (ctx->Color._LogicOpEnabled)     rasterMask |= LOGIC_OP_BIT;
-      if (ctx->Texture._EnabledUnits)     rasterMask |= TEXTURE_BIT;
-   }
-   else {
-      if (ctx->Color.IndexMask != 0xffffffff) rasterMask |= MASKING_BIT;
-      if (ctx->Color.IndexLogicOpEnabled)     rasterMask |= LOGIC_OP_BIT;
    }
-
+   if (ctx->Color._LogicOpEnabled)     rasterMask |= LOGIC_OP_BIT;
+   if (ctx->Texture._EnabledUnits)     rasterMask |= TEXTURE_BIT;
    if (   ctx->Viewport.X < 0
        || ctx->Viewport.X + ctx->Viewport.Width > (GLint) ctx->DrawBuffer->Width
        || ctx->Viewport.Y < 0
@@ -100,19 +93,14 @@ _swrast_update_rasterflags( GLcontext *ctx )
       /* more than one color buffer designated for writing (or zero buffers) */
       rasterMask |= MULTI_DRAW_BIT;
    }
-   else if (!ctx->Visual.rgbMode && ctx->Color.IndexMask==0) {
-      rasterMask |= MULTI_DRAW_BIT; /* all color index bits disabled */
-   }
 
-   if (ctx->Visual.rgbMode) {
-      for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
-         if (ctx->Color.ColorMask[i][0] +
-             ctx->Color.ColorMask[i][1] +
-             ctx->Color.ColorMask[i][2] +
-             ctx->Color.ColorMask[i][3] == 0) {
-            rasterMask |= MULTI_DRAW_BIT; /* all RGBA channels disabled */
-            break;
-         }
+   for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
+      if (ctx->Color.ColorMask[i][0] +
+          ctx->Color.ColorMask[i][1] +
+          ctx->Color.ColorMask[i][2] +
+          ctx->Color.ColorMask[i][3] == 0) {
+         rasterMask |= MULTI_DRAW_BIT; /* all RGBA channels disabled */
+         break;
       }
    }
 
@@ -892,12 +880,7 @@ _swrast_flush( GLcontext *ctx )
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
    /* flush any pending fragments from rendering points */
    if (swrast->PointSpan.end > 0) {
-      if (ctx->Visual.rgbMode) {
-         _swrast_write_rgba_span(ctx, &(swrast->PointSpan));
-      }
-      else {
-         _swrast_write_index_span(ctx, &(swrast->PointSpan));
-      }
+      _swrast_write_rgba_span(ctx, &(swrast->PointSpan));
       swrast->PointSpan.end = 0;
    }
 }
index dada36436068e0bdb442d3c88093dee3caf76a7e..dd67f633210bd2520e24c1e8cc58e1ef90163af5 100644 (file)
@@ -80,41 +80,34 @@ _swrast_span_default_attribs(GLcontext *ctx, SWspan *span)
    span->attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0;
 
    /* primary color, or color index */
-   if (ctx->Visual.rgbMode) {
-      GLchan r, g, b, a;
-      UNCLAMPED_FLOAT_TO_CHAN(r, ctx->Current.RasterColor[0]);
-      UNCLAMPED_FLOAT_TO_CHAN(g, ctx->Current.RasterColor[1]);
-      UNCLAMPED_FLOAT_TO_CHAN(b, ctx->Current.RasterColor[2]);
-      UNCLAMPED_FLOAT_TO_CHAN(a, ctx->Current.RasterColor[3]);
+   GLchan r, g, b, a;
+   UNCLAMPED_FLOAT_TO_CHAN(r, ctx->Current.RasterColor[0]);
+   UNCLAMPED_FLOAT_TO_CHAN(g, ctx->Current.RasterColor[1]);
+   UNCLAMPED_FLOAT_TO_CHAN(b, ctx->Current.RasterColor[2]);
+   UNCLAMPED_FLOAT_TO_CHAN(a, ctx->Current.RasterColor[3]);
 #if CHAN_TYPE == GL_FLOAT
-      span->red = r;
-      span->green = g;
-      span->blue = b;
-      span->alpha = a;
+   span->red = r;
+   span->green = g;
+   span->blue = b;
+   span->alpha = a;
 #else
-      span->red   = IntToFixed(r);
-      span->green = IntToFixed(g);
-      span->blue  = IntToFixed(b);
-      span->alpha = IntToFixed(a);
+   span->red   = IntToFixed(r);
+   span->green = IntToFixed(g);
+   span->blue  = IntToFixed(b);
+   span->alpha = IntToFixed(a);
 #endif
-      span->redStep = 0;
-      span->greenStep = 0;
-      span->blueStep = 0;
-      span->alphaStep = 0;
-      span->interpMask |= SPAN_RGBA;
+   span->redStep = 0;
+   span->greenStep = 0;
+   span->blueStep = 0;
+   span->alphaStep = 0;
+   span->interpMask |= SPAN_RGBA;
 
-      COPY_4V(span->attrStart[FRAG_ATTRIB_COL0], ctx->Current.RasterColor);
-      ASSIGN_4V(span->attrStepX[FRAG_ATTRIB_COL0], 0.0, 0.0, 0.0, 0.0);
-      ASSIGN_4V(span->attrStepY[FRAG_ATTRIB_COL0], 0.0, 0.0, 0.0, 0.0);
-   }
-   else {
-      span->index = FloatToFixed(ctx->Current.RasterIndex);
-      span->indexStep = 0;
-      span->interpMask |= SPAN_INDEX;
-   }
+   COPY_4V(span->attrStart[FRAG_ATTRIB_COL0], ctx->Current.RasterColor);
+   ASSIGN_4V(span->attrStepX[FRAG_ATTRIB_COL0], 0.0, 0.0, 0.0, 0.0);
+   ASSIGN_4V(span->attrStepY[FRAG_ATTRIB_COL0], 0.0, 0.0, 0.0, 0.0);
 
    /* Secondary color */
-   if (ctx->Visual.rgbMode && (ctx->Light.Enabled || ctx->Fog.ColorSumEnabled))
+   if (ctx->Light.Enabled || ctx->Fog.ColorSumEnabled)
    {
       COPY_4V(span->attrStart[FRAG_ATTRIB_COL1], ctx->Current.RasterSecondaryColor);
       ASSIGN_4V(span->attrStepX[FRAG_ATTRIB_COL1], 0.0, 0.0, 0.0, 0.0);