only setup varying vars that will be used
authorBrian <brian@nostromo.localnet.net>
Wed, 24 Jan 2007 21:13:02 +0000 (14:13 -0700)
committerBrian <brian@nostromo.localnet.net>
Wed, 24 Jan 2007 21:13:02 +0000 (14:13 -0700)
src/mesa/swrast/s_linetemp.h
src/mesa/swrast/s_tritemp.h

index 61c338a..b7b4347 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.5
+ * Version:  6.5.3
  *
- * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -336,29 +336,33 @@ NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 )
 #endif
 #ifdef INTERP_VARYING
    interpFlags |= SPAN_VARYING;
-   { /* XXX review this */
+   {
       const GLfloat invLen = 1.0F / numPixels;
+      const GLbitfield inputsUsed = ctx->FragmentProgram._Current ?
+         ctx->FragmentProgram._Current->Base.InputsRead : 0x0;
+      const GLfloat invw0 = vert0->win[3];
+      const GLfloat invw1 = vert1->win[3];
       GLuint v;
       for (v = 0; v < MAX_VARYING; v++) {
-         const GLfloat invw0 = vert0->win[3];
-         const GLfloat invw1 = vert1->win[3];
-         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;
+         if (inputsUsed & FRAG_BIT_VAR(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;
+         }
       }
    }
 #endif
index c85379b..6ff52b5 100644 (file)
 
 
 #ifdef INTERP_VARYING
-/* XXX need a varyingEnabled[] check */
+
 #define VARYING_LOOP(CODE)                     \
    {                                           \
       GLuint iv, ic;                           \
       for (iv = 0; iv < MAX_VARYING; iv++) {   \
-         for (ic = 0; ic < 4; ic++) {          \
-            CODE                               \
+         if (inputsUsed & FRAG_BIT_VAR(iv)) {  \
+            for (ic = 0; ic < 4; ic++) {       \
+               CODE                            \
+            }                                  \
          }                                     \
       }                                        \
    }
@@ -216,6 +218,10 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
    const GLint snapMask = ~((FIXED_ONE / (1 << SUB_PIXEL_BITS)) - 1); /* for x/y coord snapping */
 #endif
    GLinterp vMin_fx, vMin_fy, vMid_fx, vMid_fy, vMax_fx, vMax_fy;
+#ifdef INTERP_VARYING
+   const GLbitfield inputsUsed = ctx->FragmentProgram._Current ?
+      ctx->FragmentProgram._Current->Base.InputsRead : 0x0;
+#endif
 
    SWspan span;