summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian <[email protected]>2006-12-21 17:50:22 -0700
committerBrian <[email protected]>2006-12-21 17:50:22 -0700
commit392d9701e30f4c7b4cbd25cb8714a42ba2512bd4 (patch)
tree40cfb9b5549a5b5d2b06797c70580424ba150764 /src/mesa
parenteb2a6d62f9353d90be757fc1617040c7ccddac39 (diff)
added INTERP_VARYING code
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/swrast/s_linetemp.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/mesa/swrast/s_linetemp.h b/src/mesa/swrast/s_linetemp.h
index f5b2d95653f..61c338ac69a 100644
--- a/src/mesa/swrast/s_linetemp.h
+++ b/src/mesa/swrast/s_linetemp.h
@@ -37,6 +37,7 @@
* INTERP_INDEX - if defined, interpolate color index values
* INTERP_TEX - if defined, interpolate unit 0 texcoords
* INTERP_MULTITEX - if defined, interpolate multi-texcoords
+ * INTERP_VARYING - if defined, interpolate GLSL varyings
*
* When one can directly address pixels in the color buffer the following
* macros can be defined and used to directly compute pixel addresses during
@@ -333,6 +334,34 @@ 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;
+ 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;
+ }
+ }
+#endif
INIT_SPAN(span, GL_LINE, numPixels, interpFlags, SPAN_XY);