r300: Further reduced the radeon_span.c diff.
[mesa.git] / src / mesa / swrast / s_context.c
index 55b835bf85cebd4eb319bb608711f2056dbc0a0f..2f25edbd811c589e36c3d4939b8109d94da97318 100644 (file)
@@ -505,45 +505,52 @@ _swrast_update_texture_samplers(GLcontext *ctx)
 
 
 /**
- * Update the swrast->_FragmentAttribs field.
+ * Update swrast->_ActiveAttribs and swrast->_NumActiveAttribs
  */
 static void
 _swrast_update_fragment_attribs(GLcontext *ctx)
 {
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   GLuint attribsMask;
    
    if (ctx->FragmentProgram._Current) {
-      swrast->_FragmentAttribs
-         = ctx->FragmentProgram._Current->Base.InputsRead;
+      attribsMask = ctx->FragmentProgram._Current->Base.InputsRead;
    }
    else {
       GLuint u;
-      swrast->_FragmentAttribs = 0x0;
+      attribsMask = 0x0;
 
+#if 0 /* not yet */
       if (ctx->Depth.Test)
-         swrast->_FragmentAttribs |= FRAG_BIT_WPOS;
+         attribsMask |= FRAG_BIT_WPOS;
       if (NEED_SECONDARY_COLOR(ctx))
-         swrast->_FragmentAttribs |= FRAG_BIT_COL1;
+         attribsMask |= FRAG_BIT_COL1;
+#endif
       if (swrast->_FogEnabled)
-         swrast->_FragmentAttribs |= FRAG_BIT_FOGC;
+         attribsMask |= FRAG_BIT_FOGC;
 
       for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
          if (ctx->Texture.Unit[u]._ReallyEnabled) {
-            swrast->_FragmentAttribs |= FRAG_BIT_TEX(u);
+            attribsMask |= FRAG_BIT_TEX(u);
          }
       }
    }
 
-   /* Find lowest, highest bit set in _FragmentAttribs */
+   /* don't want to interpolate these generic attribs just yet */
+   /* XXX temporary */
+   attribsMask &= ~(FRAG_BIT_WPOS |
+                    FRAG_BIT_COL0 |
+                    FRAG_BIT_COL1 |
+                    FRAG_BIT_FOGC);
+
+   /* Update _ActiveAttribs[] list */
    {
-      GLuint bits = swrast->_FragmentAttribs;
-      GLuint i = 0;;
-      while (bits) {
-         i++;
-         bits = bits >> 1;
+      GLuint i, num = 0;
+      for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
+         if (attribsMask & (1 << i))
+            swrast->_ActiveAttribs[num++] = i;
       }
-      swrast->_MaxFragmentAttrib = i;
-      swrast->_MinFragmentAttrib = FRAG_ATTRIB_TEX0; /* XXX temporary */
+      swrast->_NumActiveAttribs = num;
    }
 }
 
@@ -912,7 +919,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");