summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast/s_pointtemp.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/swrast/s_pointtemp.h')
-rw-r--r--src/mesa/swrast/s_pointtemp.h72
1 files changed, 39 insertions, 33 deletions
diff --git a/src/mesa/swrast/s_pointtemp.h b/src/mesa/swrast/s_pointtemp.h
index 083f1ebe83c..cc6f999b91b 100644
--- a/src/mesa/swrast/s_pointtemp.h
+++ b/src/mesa/swrast/s_pointtemp.h
@@ -88,8 +88,8 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
const GLuint colorIndex = (GLuint) vert->index; /* XXX round? */
#endif
#if FLAGS & TEXTURE
- GLfloat texcoord[MAX_TEXTURE_COORD_UNITS][4];
- GLuint u;
+ GLfloat attrib[FRAG_ATTRIB_MAX][4]; /* texture & varying */
+ GLuint attr;
#endif
SWcontext *swrast = SWRAST_CONTEXT(ctx);
SWspan *span = &(swrast->PointSpan);
@@ -107,8 +107,9 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
*/
span->interpMask = SPAN_FOG;
span->arrayMask = SPAN_XY | SPAN_Z;
- span->fog = vert->fog;
- span->fogStep = 0.0;
+ span->attrStart[FRAG_ATTRIB_FOGC][0] = vert->fog;
+ span->attrStepX[FRAG_ATTRIB_FOGC][0] = 0.0;
+ span->attrStepY[FRAG_ATTRIB_FOGC][0] = 0.0;
#if FLAGS & RGBA
span->arrayMask |= SPAN_RGBA;
#endif
@@ -120,31 +121,31 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
#endif
#if FLAGS & TEXTURE
span->arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
- if (ctx->FragmentProgram._Active) {
+ if (ctx->FragmentProgram._Current) {
/* Don't divide texture s,t,r by q (use TXP to do that) */
- for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
- if (ctx->Texture._EnabledCoordUnits & (1 << u)) {
- COPY_4V(texcoord[u], vert->texcoord[u]);
+ for (attr = swrast->_MinFragmentAttrib; attr < swrast->_MaxFragmentAttrib; attr++) {
+ if (swrast->_FragmentAttribs & (1 << attr)) {
+ COPY_4V(attrib[attr], vert->attrib[attr]);
}
}
}
else {
/* Divide texture s,t,r by q here */
- for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
- if (ctx->Texture._EnabledCoordUnits & (1 << u)) {
- const GLfloat q = vert->texcoord[u][3];
+ 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);
- texcoord[u][0] = vert->texcoord[u][0] * invQ;
- texcoord[u][1] = vert->texcoord[u][1] * invQ;
- texcoord[u][2] = vert->texcoord[u][2] * invQ;
- texcoord[u][3] = 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;
}
}
}
/* need these for fragment programs */
- span->w = 1.0F;
- span->dwdx = 0.0F;
- span->dwdy = 0.0F;
+ span->attrStart[FRAG_ATTRIB_WPOS][3] = 1.0F;
+ span->attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0F;
+ span->attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0F;
#endif
#if FLAGS & SMOOTH
span->arrayMask |= SPAN_COVERAGE;
@@ -259,7 +260,7 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
count = span->end = 0;
}
for (x = xmin; x <= xmax; x++) {
-#if FLAGS & (SPRITE | TEXTURE)
+#if FLAGS & SPRITE
GLuint u;
#endif
@@ -278,10 +279,13 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
span->array->index[count] = colorIndex;
#endif
#if FLAGS & TEXTURE
- for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
- if (ctx->Texture._EnabledCoordUnits & (1 << u)) {
- COPY_4V(span->array->texcoords[u][count], texcoord[u]);
- span->array->lambda[u][count] = 0.0;
+ 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;
+ }
}
}
#endif
@@ -328,6 +332,7 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
#if FLAGS & SPRITE
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
+ GLuint attr = FRAG_ATTRIB_TEX0 + u;
if (ctx->Texture.Unit[u]._ReallyEnabled) {
if (ctx->Point.CoordReplace[u]) {
GLfloat s = 0.5F + (x + 0.5F - vert->win[0]) / size;
@@ -339,17 +344,18 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
if (ctx->Point.SpriteRMode == GL_ZERO)
r = 0.0F;
else if (ctx->Point.SpriteRMode == GL_S)
- r = vert->texcoord[u][0];
+ r = vert->attrib[attr][0];
else /* GL_R */
- r = vert->texcoord[u][2];
- span->array->texcoords[u][count][0] = s;
- span->array->texcoords[u][count][1] = t;
- span->array->texcoords[u][count][2] = r;
- span->array->texcoords[u][count][3] = 1.0F;
+ r = vert->attrib[attr][2];
+ span->array->attribs[attr][count][0] = s;
+ span->array->attribs[attr][count][1] = t;
+ span->array->attribs[attr][count][2] = r;
+ span->array->attribs[attr][count][3] = 1.0F;
span->array->lambda[u][count] = 0.0; /* XXX fix? */
}
else {
- COPY_4V(span->array->texcoords[u][count], vert->texcoord[u]);
+ COPY_4V(span->array->attribs[attr][count],
+ vert->attrib[attr]);
}
}
}
@@ -400,9 +406,9 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
span->array->index[count] = colorIndex;
#endif
#if FLAGS & TEXTURE
- for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
- if (ctx->Texture.Unit[u]._ReallyEnabled) {
- COPY_4V(span->array->texcoords[u][count], texcoord[u]);
+ for (attr = swrast->_MinFragmentAttrib; attr < swrast->_MaxFragmentAttrib; attr++) {
+ if (swrast->_FragmentAttribs & (1 << attr)) {
+ COPY_4V(span->array->attribs[attr][count], attribs[attr]);
}
}
#endif