summaryrefslogtreecommitdiff
path: root/src/mesa/swrast/s_pointtemp.h
diff options
context:
space:
mode:
authorBrian <brian@nostromo.localnet.net>2007-04-23 21:21:52 -0600
committerBrian <brian@nostromo.localnet.net>2007-04-23 21:21:52 -0600
commit0bdf216dd06d5136b8529297297aa962bab548c2 (patch)
treebb7c516d3d6f2e818f2cbb0f8865a45fecf053c6 /src/mesa/swrast/s_pointtemp.h
parentd59e6f233b02ffe2c36c2fb89ec26c208a421540 (diff)
Improve the code for interpolating fragment attributes a little. More to come...
Diffstat (limited to 'src/mesa/swrast/s_pointtemp.h')
-rw-r--r--src/mesa/swrast/s_pointtemp.h50
1 files changed, 20 insertions, 30 deletions
diff --git a/src/mesa/swrast/s_pointtemp.h b/src/mesa/swrast/s_pointtemp.h
index 1956eeba50..23ac571236 100644
--- a/src/mesa/swrast/s_pointtemp.h
+++ b/src/mesa/swrast/s_pointtemp.h
@@ -63,7 +63,6 @@
*/
-
static void
NAME ( GLcontext *ctx, const SWvertex *vert )
{
@@ -89,7 +88,6 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
#endif
#if FLAGS & TEXTURE
GLfloat attrib[FRAG_ATTRIB_MAX][4]; /* texture & varying */
- GLuint attr;
#endif
SWcontext *swrast = SWRAST_CONTEXT(ctx);
SWspan *span = &(swrast->PointSpan);
@@ -123,24 +121,20 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
span->arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
if (ctx->FragmentProgram._Active) {
/* Don't divide texture s,t,r by q (use TXP to do that) */
- for (attr = swrast->_MinFragmentAttrib; attr < swrast->_MaxFragmentAttrib; attr++) {
- if (swrast->_FragmentAttribs & (1 << attr)) {
- COPY_4V(attrib[attr], vert->attrib[attr]);
- }
- }
+ ATTRIB_LOOP_BEGIN
+ COPY_4V(attrib[attr], vert->attrib[attr]);
+ ATTRIB_LOOP_END
}
else {
/* Divide texture s,t,r by q here */
- for (attr = swrast->_MinFragmentAttrib; attr < swrast->_MaxFragmentAttrib; attr++) {
- if (swrast->_FragmentAttribs & (1 << attr)) {
- const GLfloat q = vert->attrib[attr][3];
- const GLfloat invQ = (q == 0.0F || q == 1.0F) ? 1.0F : (1.0F / q);
- attrib[attr][0] = vert->attrib[attr][0] * invQ;
- attrib[attr][1] = vert->attrib[attr][1] * invQ;
- attrib[attr][2] = vert->attrib[attr][2] * invQ;
- attrib[attr][3] = q;
- }
- }
+ ATTRIB_LOOP_BEGIN
+ const GLfloat q = vert->attrib[attr][3];
+ const GLfloat invQ = (q == 0.0F || q == 1.0F) ? 1.0F : (1.0F / q);
+ attrib[attr][0] = vert->attrib[attr][0] * invQ;
+ attrib[attr][1] = vert->attrib[attr][1] * invQ;
+ attrib[attr][2] = vert->attrib[attr][2] * invQ;
+ attrib[attr][3] = q;
+ ATTRIB_LOOP_END
}
/* need these for fragment programs */
span->attrStart[FRAG_ATTRIB_WPOS][3] = 1.0F;
@@ -279,15 +273,13 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
span->array->index[count] = colorIndex;
#endif
#if FLAGS & TEXTURE
- for (attr = swrast->_MinFragmentAttrib; attr < swrast->_MaxFragmentAttrib; attr++) {
- if (swrast->_FragmentAttribs & (1 << attr)) {
- COPY_4V(span->array->attribs[attr][count], attrib[attr]);
- if (attr < FRAG_ATTRIB_VAR0) {
- const GLuint u = attr - FRAG_ATTRIB_TEX0;
- span->array->lambda[u][count] = 0.0;
- }
+ ATTRIB_LOOP_BEGIN
+ COPY_4V(span->array->attribs[attr][count], attrib[attr]);
+ if (attr < FRAG_ATTRIB_VAR0) {
+ const GLuint u = attr - FRAG_ATTRIB_TEX0;
+ span->array->lambda[u][count] = 0.0;
}
- }
+ ATTRIB_LOOP_END
#endif
#if FLAGS & SMOOTH
@@ -406,11 +398,9 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
span->array->index[count] = colorIndex;
#endif
#if FLAGS & TEXTURE
- for (attr = swrast->_MinFragmentAttrib; attr < swrast->_MaxFragmentAttrib; attr++) {
- if (swrast->_FragmentAttribs & (1 << attr)) {
- COPY_4V(span->array->attribs[attr][count], attribs[attr]);
- }
- }
+ ATTRIB_LOOP_BEGIN
+ COPY_4V(span->array->attribs[attr][count], attribs[attr]);
+ ATTRIB_LOOP_END
#endif
span->array->x[count] = (GLint) vert->win[0];