line->span.array->spec[i][BCOMP] = solve_plane_chan(fx, fy, line->sbPlane);
#endif
#if defined(DO_TEXVAR)
- {
- GLuint attr;
- for (attr = swrast->_MinFragmentAttrib; attr < swrast->_MaxFragmentAttrib; attr++) {
- if (swrast->_FragmentAttribs & (1 << attr)) {
- GLfloat (*attribArray)[4] = line->span.array->attribs[attr];
- GLfloat invQ;
- if (ctx->FragmentProgram._Active) {
- invQ = 1.0F;
- }
- else {
- invQ = solve_plane_recip(fx, fy, line->vPlane[attr]);
- }
- attribArray[i][0] = solve_plane(fx, fy, line->sPlane[attr]) * invQ;
- attribArray[i][1] = solve_plane(fx, fy, line->tPlane[attr]) * invQ;
- attribArray[i][2] = solve_plane(fx, fy, line->uPlane[attr]) * invQ;
- if (attr < FRAG_ATTRIB_VAR0) {
- const GLuint unit = attr - FRAG_ATTRIB_TEX0;
- line->span.array->lambda[unit][i]
- = compute_lambda(line->sPlane[attr],
- line->tPlane[attr], invQ,
- line->texWidth[attr], line->texHeight[attr]);
- }
- }
+ ATTRIB_LOOP_BEGIN
+ GLfloat (*attribArray)[4] = line->span.array->attribs[attr];
+ GLfloat invQ;
+ if (ctx->FragmentProgram._Active) {
+ invQ = 1.0F;
}
- }
+ else {
+ invQ = solve_plane_recip(fx, fy, line->vPlane[attr]);
+ }
+ attribArray[i][0] = solve_plane(fx, fy, line->sPlane[attr]) * invQ;
+ attribArray[i][1] = solve_plane(fx, fy, line->tPlane[attr]) * invQ;
+ attribArray[i][2] = solve_plane(fx, fy, line->uPlane[attr]) * invQ;
+ if (attr < FRAG_ATTRIB_VAR0) {
+ const GLuint unit = attr - FRAG_ATTRIB_TEX0;
+ line->span.array->lambda[unit][i]
+ = compute_lambda(line->sPlane[attr],
+ line->tPlane[attr], invQ,
+ line->texWidth[attr], line->texHeight[attr]);
+ }
+ ATTRIB_LOOP_END
#endif
if (line->span.end == MAX_WIDTH) {
#endif
#if defined(DO_TEXVAR)
{
- GLuint attr;
const GLfloat invW0 = v0->win[3];
const GLfloat invW1 = v1->win[3];
line.span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA | SPAN_VARYING);
- for (attr = swrast->_MinFragmentAttrib; attr < swrast->_MaxFragmentAttrib; attr++) {
- if (swrast->_FragmentAttribs & (1 << attr)) {
- const GLfloat s0 = v0->attrib[attr][0] * invW0;
- const GLfloat s1 = v1->attrib[attr][0] * invW1;
- const GLfloat t0 = v0->attrib[attr][1] * invW0;
- const GLfloat t1 = v1->attrib[attr][1] * invW1;
- const GLfloat r0 = v0->attrib[attr][2] * invW0;
- const GLfloat r1 = v1->attrib[attr][2] * invW1;
- const GLfloat q0 = v0->attrib[attr][3] * invW0;
- const GLfloat q1 = v1->attrib[attr][3] * invW1;
- compute_plane(line.x0, line.y0, line.x1, line.y1, s0, s1, line.sPlane[attr]);
- compute_plane(line.x0, line.y0, line.x1, line.y1, t0, t1, line.tPlane[attr]);
- compute_plane(line.x0, line.y0, line.x1, line.y1, r0, r1, line.uPlane[attr]);
- compute_plane(line.x0, line.y0, line.x1, line.y1, q0, q1, line.vPlane[attr]);
- if (attr < FRAG_ATTRIB_VAR0) {
- const GLuint u = attr - FRAG_ATTRIB_TEX0;
- const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current;
- const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel];
- line.texWidth[attr] = (GLfloat) texImage->Width;
+ ATTRIB_LOOP_BEGIN
+ const GLfloat s0 = v0->attrib[attr][0] * invW0;
+ const GLfloat s1 = v1->attrib[attr][0] * invW1;
+ const GLfloat t0 = v0->attrib[attr][1] * invW0;
+ const GLfloat t1 = v1->attrib[attr][1] * invW1;
+ const GLfloat r0 = v0->attrib[attr][2] * invW0;
+ const GLfloat r1 = v1->attrib[attr][2] * invW1;
+ const GLfloat q0 = v0->attrib[attr][3] * invW0;
+ const GLfloat q1 = v1->attrib[attr][3] * invW1;
+ compute_plane(line.x0, line.y0, line.x1, line.y1, s0, s1, line.sPlane[attr]);
+ compute_plane(line.x0, line.y0, line.x1, line.y1, t0, t1, line.tPlane[attr]);
+ compute_plane(line.x0, line.y0, line.x1, line.y1, r0, r1, line.uPlane[attr]);
+ compute_plane(line.x0, line.y0, line.x1, line.y1, q0, q1, line.vPlane[attr]);
+ if (attr < FRAG_ATTRIB_VAR0) {
+ const GLuint u = attr - FRAG_ATTRIB_TEX0;
+ const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current;
+ const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel];
+ line.texWidth[attr] = (GLfloat) texImage->Width;
line.texHeight[attr] = (GLfloat) texImage->Height;
- }
}
- }
+ ATTRIB_LOOP_END
}
#endif
#endif
#if defined(DO_TEXVAR)
{
- GLuint attr;
const GLfloat invW0 = v0->win[3];
const GLfloat invW1 = v1->win[3];
const GLfloat invW2 = v2->win[3];
- for (attr = swrast->_MinFragmentAttrib; attr < swrast->_MaxFragmentAttrib; attr++) {
- if (swrast->_FragmentAttribs & (1 << attr)) {
- const GLfloat s0 = v0->attrib[attr][0] * invW0;
- const GLfloat s1 = v1->attrib[attr][0] * invW1;
- const GLfloat s2 = v2->attrib[attr][0] * invW2;
- const GLfloat t0 = v0->attrib[attr][1] * invW0;
- const GLfloat t1 = v1->attrib[attr][1] * invW1;
- const GLfloat t2 = v2->attrib[attr][1] * invW2;
- const GLfloat r0 = v0->attrib[attr][2] * invW0;
- const GLfloat r1 = v1->attrib[attr][2] * invW1;
- const GLfloat r2 = v2->attrib[attr][2] * invW2;
- const GLfloat q0 = v0->attrib[attr][3] * invW0;
- const GLfloat q1 = v1->attrib[attr][3] * invW1;
- const GLfloat q2 = v2->attrib[attr][3] * invW2;
- compute_plane(p0, p1, p2, s0, s1, s2, sPlane[attr]);
- compute_plane(p0, p1, p2, t0, t1, t2, tPlane[attr]);
- compute_plane(p0, p1, p2, r0, r1, r2, uPlane[attr]);
- compute_plane(p0, p1, p2, q0, q1, q2, vPlane[attr]);
- if (attr < FRAG_ATTRIB_VAR0) {
- const GLuint u = attr - FRAG_ATTRIB_TEX0;
- const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current;
- const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel];
- texWidth[attr] = (GLfloat) texImage->Width;
- texHeight[attr] = (GLfloat) texImage->Height;
- }
- else {
- texWidth[attr] = texHeight[attr] = 1.0;
- }
+ ATTRIB_LOOP_BEGIN
+ const GLfloat s0 = v0->attrib[attr][0] * invW0;
+ const GLfloat s1 = v1->attrib[attr][0] * invW1;
+ const GLfloat s2 = v2->attrib[attr][0] * invW2;
+ const GLfloat t0 = v0->attrib[attr][1] * invW0;
+ const GLfloat t1 = v1->attrib[attr][1] * invW1;
+ const GLfloat t2 = v2->attrib[attr][1] * invW2;
+ const GLfloat r0 = v0->attrib[attr][2] * invW0;
+ const GLfloat r1 = v1->attrib[attr][2] * invW1;
+ const GLfloat r2 = v2->attrib[attr][2] * invW2;
+ const GLfloat q0 = v0->attrib[attr][3] * invW0;
+ const GLfloat q1 = v1->attrib[attr][3] * invW1;
+ const GLfloat q2 = v2->attrib[attr][3] * invW2;
+ compute_plane(p0, p1, p2, s0, s1, s2, sPlane[attr]);
+ compute_plane(p0, p1, p2, t0, t1, t2, tPlane[attr]);
+ compute_plane(p0, p1, p2, r0, r1, r2, uPlane[attr]);
+ compute_plane(p0, p1, p2, q0, q1, q2, vPlane[attr]);
+ if (attr < FRAG_ATTRIB_VAR0) {
+ const GLuint u = attr - FRAG_ATTRIB_TEX0;
+ const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current;
+ const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel];
+ texWidth[attr] = (GLfloat) texImage->Width;
+ texHeight[attr] = (GLfloat) texImage->Height;
}
- }
+ else {
+ texWidth[attr] = texHeight[attr] = 1.0;
+ }
+ ATTRIB_LOOP_END
}
span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA | SPAN_VARYING);
#endif
array->spec[count][BCOMP] = solve_plane_chan(cx, cy, sbPlane);
#endif
#if defined(DO_TEXVAR)
- {
- GLuint attr;
- for (attr = swrast->_MinFragmentAttrib; attr < swrast->_MaxFragmentAttrib; attr++) {
- if (swrast->_FragmentAttribs & (1 << attr)) {
- GLfloat invQ = solve_plane_recip(cx, cy, vPlane[attr]);
- array->attribs[attr][count][0] = solve_plane(cx, cy, sPlane[attr]) * invQ;
- array->attribs[attr][count][1] = solve_plane(cx, cy, tPlane[attr]) * invQ;
- array->attribs[attr][count][2] = solve_plane(cx, cy, uPlane[attr]) * invQ;
- if (attr < FRAG_ATTRIB_VAR0) {
- const GLuint unit = attr - FRAG_ATTRIB_TEX0;
- array->lambda[unit][count] = compute_lambda(sPlane[attr], tPlane[attr],
- vPlane[attr], cx, cy, invQ,
- texWidth[attr], texHeight[attr]);
- }
- }
+ ATTRIB_LOOP_BEGIN
+ GLfloat invQ = solve_plane_recip(cx, cy, vPlane[attr]);
+ array->attribs[attr][count][0] = solve_plane(cx, cy, sPlane[attr]) * invQ;
+ array->attribs[attr][count][1] = solve_plane(cx, cy, tPlane[attr]) * invQ;
+ array->attribs[attr][count][2] = solve_plane(cx, cy, uPlane[attr]) * invQ;
+ if (attr < FRAG_ATTRIB_VAR0) {
+ const GLuint unit = attr - FRAG_ATTRIB_TEX0;
+ array->lambda[unit][count] = compute_lambda(sPlane[attr], tPlane[attr],
+ vPlane[attr], cx, cy, invQ,
+ texWidth[attr], texHeight[attr]);
}
- }
+ ATTRIB_LOOP_END
#endif
ix++;
count++;
array->spec[ix][BCOMP] = solve_plane_chan(cx, cy, sbPlane);
#endif
#if defined(DO_TEXVAR)
- {
- GLuint attr;
- for (attr = swrast->_MinFragmentAttrib; attr < swrast->_MaxFragmentAttrib; attr++) {
- if (swrast->_FragmentAttribs & (1 << attr)) {
- GLfloat invQ = solve_plane_recip(cx, cy, vPlane[attr]);
- array->attribs[attr][ix][0] = solve_plane(cx, cy, sPlane[attr]) * invQ;
- array->attribs[attr][ix][1] = solve_plane(cx, cy, tPlane[attr]) * invQ;
- array->attribs[attr][ix][2] = solve_plane(cx, cy, uPlane[attr]) * invQ;
- if (attr < FRAG_ATTRIB_VAR0) {
- const GLuint unit = attr - FRAG_ATTRIB_TEX0;
- array->lambda[unit][ix] = compute_lambda(sPlane[attr],
- tPlane[attr],
- vPlane[attr],
- cx, cy, invQ,
- texWidth[attr],
- texHeight[attr]);
- }
- }
+ ATTRIB_LOOP_BEGIN
+ GLfloat invQ = solve_plane_recip(cx, cy, vPlane[attr]);
+ array->attribs[attr][ix][0] = solve_plane(cx, cy, sPlane[attr]) * invQ;
+ array->attribs[attr][ix][1] = solve_plane(cx, cy, tPlane[attr]) * invQ;
+ array->attribs[attr][ix][2] = solve_plane(cx, cy, uPlane[attr]) * invQ;
+ if (attr < FRAG_ATTRIB_VAR0) {
+ const GLuint unit = attr - FRAG_ATTRIB_TEX0;
+ array->lambda[unit][ix] = compute_lambda(sPlane[attr],
+ tPlane[attr],
+ vPlane[attr],
+ cx, cy, invQ,
+ texWidth[attr],
+ texHeight[attr]);
}
- }
+ ATTRIB_LOOP_END
#endif
ix--;
count++;
/* shift texcoords, varying */
{
SWspanarrays *array = span.array;
- GLuint attr;
- for (attr = swrast->_MinFragmentAttrib; attr < swrast->_MaxFragmentAttrib; attr++) {
- if (swrast->_FragmentAttribs & (1 << attr)) {
- GLint j;
- for (j = 0; j < (GLint) n; j++) {
- array->attribs[attr][j][0] = array->attribs[attr][j + left][0];
- array->attribs[attr][j][1] = array->attribs[attr][j + left][1];
- array->attribs[attr][j][2] = array->attribs[attr][j + left][2];
- /*array->lambda[unit][j] = array->lambda[unit][j + left];*/
- }
+ ATTRIB_LOOP_BEGIN
+ GLint j;
+ for (j = 0; j < (GLint) n; j++) {
+ array->attribs[attr][j][0] = array->attribs[attr][j + left][0];
+ array->attribs[attr][j][1] = array->attribs[attr][j + left][1];
+ array->attribs[attr][j][2] = array->attribs[attr][j + left][2];
+ /*array->lambda[unit][j] = array->lambda[unit][j + left];*/
}
- }
+ ATTRIB_LOOP_END
}
#endif
/**
- * Update the swrast->_FragmentAttribs field.
+ * Update swrast->_ActiveAttribs and swrast->_NumActiveAttribs
*/
static void
_swrast_update_fragment_attribs(GLcontext *ctx)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ GLuint attribsMask;
if (ctx->FragmentProgram._Current) {
- swrast->_FragmentAttribs
- = ctx->FragmentProgram._Current->Base.InputsRead;
+ attribsMask = ctx->FragmentProgram._Current->Base.InputsRead;
}
else {
GLuint u;
- swrast->_FragmentAttribs = 0x0;
+ attribsMask = 0x0;
if (ctx->Depth.Test)
- swrast->_FragmentAttribs |= FRAG_BIT_WPOS;
+ attribsMask |= FRAG_BIT_WPOS;
if (NEED_SECONDARY_COLOR(ctx))
- swrast->_FragmentAttribs |= FRAG_BIT_COL1;
+ attribsMask |= FRAG_BIT_COL1;
if (swrast->_FogEnabled)
- swrast->_FragmentAttribs |= FRAG_BIT_FOGC;
+ attribsMask |= FRAG_BIT_FOGC;
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
if (ctx->Texture.Unit[u]._ReallyEnabled) {
- swrast->_FragmentAttribs |= FRAG_BIT_TEX(u);
+ attribsMask |= FRAG_BIT_TEX(u);
}
}
}
- /* Find lowest, highest bit set in _FragmentAttribs */
+ /* Update _ActiveAttribs[] list */
{
- GLuint bits = swrast->_FragmentAttribs;
- GLuint i = 0;;
- while (bits) {
- i++;
- bits = bits >> 1;
+ GLuint i, num = 0;
+ for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
+ if (attribsMask & (1 << i))
+ swrast->_ActiveAttribs[num++] = i;
}
- swrast->_MaxFragmentAttrib = i;
- swrast->_MinFragmentAttrib = FRAG_ATTRIB_TEX0; /* XXX temporary */
+ swrast->_NumActiveAttribs = num;
}
}
GLbitfield _ColorOutputsMask;
GLuint _NumColorOutputs;
- /** Fragment attributes to compute during rasterization.
- * Mask of FRAG_BIT_* flags.
- */
- GLbitfield _FragmentAttribs;
- GLuint _MinFragmentAttrib; /**< Lowest bit set in _FragmentAttribs */
- GLuint _MaxFragmentAttrib; /**< Highest bit set in _FragmentAttribs + 1 */
+ /** List/array of the fragment attributes to interpolate */
+ GLuint _ActiveAttribs[FRAG_ATTRIB_MAX];
+ /** Number of fragment attributes to interpolate */
+ GLuint _NumActiveAttribs;
/* Accum buffer temporaries.
*/
#define FixedToChan(X) FixedToInt(X)
#endif
+
+/**
+ * For looping over fragment attributes in the pointe, line
+ * triangle rasterizers.
+ */
+#define ATTRIB_LOOP_BEGIN \
+ { \
+ GLuint a; \
+ for (a = 0; a < swrast->_NumActiveAttribs; a++) { \
+ const GLuint attr = swrast->_ActiveAttribs[a];
+
+#define ATTRIB_LOOP_END } }
+
+
+
#endif
const GLfloat invLen = 1.0F / numPixels;
const GLfloat invw0 = vert0->win[3];
const GLfloat invw1 = vert1->win[3];
- GLuint attr;
- for (attr = swrast->_MinFragmentAttrib; attr < swrast->_MaxFragmentAttrib; attr++) {
- if (swrast->_FragmentAttribs & (1 << attr)) {
- GLfloat ds, dt, dr, dq;
- span.attrStart[attr][0] = invw0 * vert0->attrib[attr][0];
- span.attrStart[attr][1] = invw0 * vert0->attrib[attr][1];
- span.attrStart[attr][2] = invw0 * vert0->attrib[attr][2];
- span.attrStart[attr][3] = invw0 * vert0->attrib[attr][3];
- ds = (invw1 * vert1->attrib[attr][0]) - span.attrStart[attr][0];
- dt = (invw1 * vert1->attrib[attr][1]) - span.attrStart[attr][1];
- dr = (invw1 * vert1->attrib[attr][2]) - span.attrStart[attr][2];
- dq = (invw1 * vert1->attrib[attr][3]) - span.attrStart[attr][3];
- span.attrStepX[attr][0] = ds * invLen;
- span.attrStepX[attr][1] = dt * invLen;
- span.attrStepX[attr][2] = dr * invLen;
- span.attrStepX[attr][3] = dq * invLen;
- span.attrStepY[attr][0] = 0.0F;
- span.attrStepY[attr][1] = 0.0F;
- span.attrStepY[attr][2] = 0.0F;
- span.attrStepY[attr][3] = 0.0F;
- }
- }
+ ATTRIB_LOOP_BEGIN
+ GLfloat ds, dt, dr, dq;
+ span.attrStart[attr][0] = invw0 * vert0->attrib[attr][0];
+ span.attrStart[attr][1] = invw0 * vert0->attrib[attr][1];
+ span.attrStart[attr][2] = invw0 * vert0->attrib[attr][2];
+ span.attrStart[attr][3] = invw0 * vert0->attrib[attr][3];
+ ds = (invw1 * vert1->attrib[attr][0]) - span.attrStart[attr][0];
+ dt = (invw1 * vert1->attrib[attr][1]) - span.attrStart[attr][1];
+ dr = (invw1 * vert1->attrib[attr][2]) - span.attrStart[attr][2];
+ dq = (invw1 * vert1->attrib[attr][3]) - span.attrStart[attr][3];
+ span.attrStepX[attr][0] = ds * invLen;
+ span.attrStepX[attr][1] = dt * invLen;
+ span.attrStepX[attr][2] = dr * invLen;
+ span.attrStepX[attr][3] = dq * invLen;
+ span.attrStepY[attr][0] = 0.0F;
+ span.attrStepY[attr][1] = 0.0F;
+ span.attrStepY[attr][2] = 0.0F;
+ span.attrStepY[attr][3] = 0.0F;
+ ATTRIB_LOOP_END
}
#endif
*/
-
static void
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);
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;
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
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];
#endif
-#define TEXVAR_LOOP(CODE) \
- { \
- GLuint attr; \
- for (attr = swrast->_MinFragmentAttrib; \
- attr < swrast->_MaxFragmentAttrib; attr++) { \
- if (swrast->_FragmentAttribs & (1 << attr)) { \
- CODE \
- } \
- } \
- }
-
-
-
-
/*
* Some code we unfortunately need to prevent negative interpolated colors.
*/
{
/* win[3] is 1/W */
const GLfloat wMax = vMax->win[3], wMin = vMin->win[3], wMid = vMid->win[3];
- TEXVAR_LOOP(
+ ATTRIB_LOOP_BEGIN
GLfloat eMaj_ds = vMax->attrib[attr][0] * wMax - vMin->attrib[attr][0] * wMin;
GLfloat eBot_ds = vMid->attrib[attr][0] * wMid - vMin->attrib[attr][0] * wMin;
GLfloat eMaj_dt = vMax->attrib[attr][1] * wMax - vMin->attrib[attr][1] * wMin;
span.attrStepY[attr][2] = oneOverArea * (eMaj.dx * eBot_du - eMaj_du * eBot.dx);
span.attrStepX[attr][3] = oneOverArea * (eMaj_dv * eBot.dy - eMaj.dy * eBot_dv);
span.attrStepY[attr][3] = oneOverArea * (eMaj.dx * eBot_dv - eMaj_dv * eBot.dx);
- )
+ ATTRIB_LOOP_END
}
#endif
}
#endif
#ifdef INTERP_TEX
- TEXVAR_LOOP(
+ ATTRIB_LOOP_BEGIN
const GLfloat invW = vLower->win[3];
const GLfloat s0 = vLower->attrib[attr][0] * invW;
const GLfloat t0 = vLower->attrib[attr][1] * invW;
dtOuter[attr] = span.attrStepY[attr][1] + dxOuter * span.attrStepX[attr][1];
duOuter[attr] = span.attrStepY[attr][2] + dxOuter * span.attrStepX[attr][2];
dvOuter[attr] = span.attrStepY[attr][3] + dxOuter * span.attrStepX[attr][3];
- )
+ ATTRIB_LOOP_END
#endif
} /*if setupLeft*/
dtInner = dtOuter + span.intTexStep[1];
#endif
#ifdef INTERP_TEX
- TEXVAR_LOOP(
+ ATTRIB_LOOP_BEGIN
dsInner[attr] = dsOuter[attr] + span.attrStepX[attr][0];
dtInner[attr] = dtOuter[attr] + span.attrStepX[attr][1];
duInner[attr] = duOuter[attr] + span.attrStepX[attr][2];
dvInner[attr] = dvOuter[attr] + span.attrStepX[attr][3];
- )
+ ATTRIB_LOOP_END
#endif
while (lines > 0) {
#endif
#ifdef INTERP_TEX
- TEXVAR_LOOP(
+ ATTRIB_LOOP_BEGIN
span.attrStart[attr][0] = sLeft[attr];
span.attrStart[attr][1] = tLeft[attr];
span.attrStart[attr][2] = uLeft[attr];
span.attrStart[attr][3] = vLeft[attr];
- )
+ ATTRIB_LOOP_END
#endif
/* This is where we actually generate fragments */
tLeft += dtOuter;
#endif
#ifdef INTERP_TEX
- TEXVAR_LOOP(
+ ATTRIB_LOOP_BEGIN
sLeft[attr] += dsOuter[attr];
tLeft[attr] += dtOuter[attr];
uLeft[attr] += duOuter[attr];
vLeft[attr] += dvOuter[attr];
- )
+ ATTRIB_LOOP_END
#endif
}
else {
tLeft += dtInner;
#endif
#ifdef INTERP_TEX
- TEXVAR_LOOP(
+ ATTRIB_LOOP_BEGIN
sLeft[attr] += dsInner[attr];
tLeft[attr] += dtInner[attr];
uLeft[attr] += duInner[attr];
vLeft[attr] += dvInner[attr];
- )
+ ATTRIB_LOOP_END
#endif
}
} /*while lines>0*/