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.h64
1 files changed, 27 insertions, 37 deletions
diff --git a/src/mesa/swrast/s_pointtemp.h b/src/mesa/swrast/s_pointtemp.h
index 1956eeba50b..dddc2f7f40c 100644
--- a/src/mesa/swrast/s_pointtemp.h
+++ b/src/mesa/swrast/s_pointtemp.h
@@ -39,14 +39,14 @@
*
* RGBA = do rgba instead of color index
* SMOOTH = do antialiasing
- * TEXTURE = do texture coords
+ * ATTRIBS = general attributes (texcoords, etc)
* SPECULAR = do separate specular color
* LARGE = do points with diameter > 1 pixel
* ATTENUATE = compute point size attenuation
* SPRITE = GL_ARB_point_sprite / GL_NV_point_sprite
*
* Notes: LARGE and ATTENUATE are exclusive of each other.
- * TEXTURE requires RGBA
+ * ATTRIBS requires RGBA
*/
@@ -63,7 +63,6 @@
*/
-
static void
NAME ( GLcontext *ctx, const SWvertex *vert )
{
@@ -87,9 +86,8 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
#if FLAGS & INDEX
const GLuint colorIndex = (GLuint) vert->index; /* XXX round? */
#endif
-#if FLAGS & TEXTURE
+#if FLAGS & ATTRIBS
GLfloat attrib[FRAG_ATTRIB_MAX][4]; /* texture & varying */
- GLuint attr;
#endif
SWcontext *swrast = SWRAST_CONTEXT(ctx);
SWspan *span = &(swrast->PointSpan);
@@ -107,7 +105,7 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
*/
span->interpMask = SPAN_FOG;
span->arrayMask = SPAN_XY | SPAN_Z;
- span->attrStart[FRAG_ATTRIB_FOGC][0] = vert->fog;
+ span->attrStart[FRAG_ATTRIB_FOGC][0] = vert->attrib[FRAG_ATTRIB_FOGC][0];
span->attrStepX[FRAG_ATTRIB_FOGC][0] = 0.0;
span->attrStepY[FRAG_ATTRIB_FOGC][0] = 0.0;
#if FLAGS & RGBA
@@ -119,28 +117,24 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
#if FLAGS & INDEX
span->arrayMask |= SPAN_INDEX;
#endif
-#if FLAGS & TEXTURE
+#if FLAGS & ATTRIBS
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;
@@ -278,16 +272,14 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
#if FLAGS & INDEX
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;
- }
+#if FLAGS & ATTRIBS
+ ATTRIB_LOOP_BEGIN
+ COPY_4V(span->array->attribs[attr][count], attrib[attr]);
+ if (attr < FRAG_ATTRIB_VAR0 && attr >= FRAG_ATTRIB_TEX0) {
+ const GLuint u = attr - FRAG_ATTRIB_TEX0;
+ span->array->lambda[u][count] = 0.0;
}
- }
+ ATTRIB_LOOP_END
#endif
#if FLAGS & SMOOTH
@@ -405,12 +397,10 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
#if FLAGS & INDEX
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]);
- }
- }
+#if FLAGS & ATTRIBS
+ ATTRIB_LOOP_BEGIN
+ COPY_4V(span->array->attribs[attr][count], attribs[attr]);
+ ATTRIB_LOOP_END
#endif
span->array->x[count] = (GLint) vert->win[0];