summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast/s_aatritemp.h
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2002-08-07 00:45:07 +0000
committerBrian Paul <[email protected]>2002-08-07 00:45:07 +0000
commit77df88727cb0a423dd5cb41498c2302d9df4fce7 (patch)
tree98234cef23e87e196b3628095196daed47bf6dce /src/mesa/swrast/s_aatritemp.h
parent2353e96c320d4bd26d10dc29b57df3e9f882e6d3 (diff)
struct sw_span is again allocated on the stack, but the arrays of span
data are broken out into a new struct span_arrays which is allocated per-context (to avoid huge stack allocations - a problem on Windows). This lets us use span.redStep instead of span->redStep (for example) to hopefully get slightly better performance in the triangle functions.
Diffstat (limited to 'src/mesa/swrast/s_aatritemp.h')
-rw-r--r--src/mesa/swrast/s_aatritemp.h154
1 files changed, 79 insertions, 75 deletions
diff --git a/src/mesa/swrast/s_aatritemp.h b/src/mesa/swrast/s_aatritemp.h
index 18c611e0176..0a70cf184f2 100644
--- a/src/mesa/swrast/s_aatritemp.h
+++ b/src/mesa/swrast/s_aatritemp.h
@@ -1,4 +1,4 @@
-/* $Id: s_aatritemp.h,v 1.29 2002/04/19 14:05:50 brianp Exp $ */
+/* $Id: s_aatritemp.h,v 1.30 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -53,7 +53,7 @@
GLboolean ltor;
GLfloat majDx, majDy; /* major (i.e. long) edge dx and dy */
- struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+ struct sw_span span;
#ifdef DO_Z
GLfloat zPlane[4];
@@ -140,11 +140,11 @@
*/
#ifdef DO_Z
compute_plane(p0, p1, p2, p0[2], p1[2], p2[2], zPlane);
- span->arrayMask |= SPAN_Z;
+ span.arrayMask |= SPAN_Z;
#endif
#ifdef DO_FOG
compute_plane(p0, p1, p2, v0->fog, v1->fog, v2->fog, fogPlane);
- span->arrayMask |= SPAN_FOG;
+ span.arrayMask |= SPAN_FOG;
#endif
#ifdef DO_RGBA
if (ctx->Light.ShadeModel == GL_SMOOTH) {
@@ -159,7 +159,7 @@
constant_plane(v2->color[BCOMP], bPlane);
constant_plane(v2->color[ACOMP], aPlane);
}
- span->arrayMask |= SPAN_RGBA;
+ span.arrayMask |= SPAN_RGBA;
#endif
#ifdef DO_INDEX
if (ctx->Light.ShadeModel == GL_SMOOTH) {
@@ -169,7 +169,7 @@
else {
constant_plane((GLfloat) v2->index, iPlane);
}
- span->arrayMask |= SPAN_INDEX;
+ span.arrayMask |= SPAN_INDEX;
#endif
#ifdef DO_SPEC
if (ctx->Light.ShadeModel == GL_SMOOTH) {
@@ -182,7 +182,7 @@
constant_plane(v2->specular[GCOMP], sgPlane);
constant_plane(v2->specular[BCOMP], sbPlane);
}
- span->arrayMask |= SPAN_SPEC;
+ span.arrayMask |= SPAN_SPEC;
#endif
#ifdef DO_TEX
{
@@ -210,7 +210,7 @@
texWidth = (GLfloat) texImage->Width;
texHeight = (GLfloat) texImage->Height;
}
- span->arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
+ span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
#elif defined(DO_MULTITEX)
{
GLuint u;
@@ -242,7 +242,7 @@
}
}
}
- span->arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
+ span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
#endif
/* Begin bottom-to-top scan over the triangle.
@@ -284,38 +284,39 @@
while (coverage > 0.0F) {
/* (cx,cy) = center of fragment */
const GLfloat cx = ix + 0.5F, cy = iy + 0.5F;
+ struct span_arrays *array = span.array;
#ifdef DO_INDEX
- span->coverage[count] = (GLfloat) compute_coveragei(pMin, pMid, pMax, ix, iy);
+ array->coverage[count] = (GLfloat) compute_coveragei(pMin, pMid, pMax, ix, iy);
#else
- span->coverage[count] = coverage;
+ array->coverage[count] = coverage;
#endif
#ifdef DO_Z
- span->zArray[count] = (GLdepth) solve_plane(cx, cy, zPlane);
+ array->z[count] = (GLdepth) solve_plane(cx, cy, zPlane);
#endif
#ifdef DO_FOG
- span->fogArray[count] = solve_plane(cx, cy, fogPlane);
+ array->fog[count] = solve_plane(cx, cy, fogPlane);
#endif
#ifdef DO_RGBA
- span->color.rgba[count][RCOMP] = solve_plane_chan(cx, cy, rPlane);
- span->color.rgba[count][GCOMP] = solve_plane_chan(cx, cy, gPlane);
- span->color.rgba[count][BCOMP] = solve_plane_chan(cx, cy, bPlane);
- span->color.rgba[count][ACOMP] = solve_plane_chan(cx, cy, aPlane);
+ array->rgba[count][RCOMP] = solve_plane_chan(cx, cy, rPlane);
+ array->rgba[count][GCOMP] = solve_plane_chan(cx, cy, gPlane);
+ array->rgba[count][BCOMP] = solve_plane_chan(cx, cy, bPlane);
+ array->rgba[count][ACOMP] = solve_plane_chan(cx, cy, aPlane);
#endif
#ifdef DO_INDEX
- span->color.index[count] = (GLint) solve_plane(cx, cy, iPlane);
+ array->index[count] = (GLint) solve_plane(cx, cy, iPlane);
#endif
#ifdef DO_SPEC
- span->specArray[count][RCOMP] = solve_plane_chan(cx, cy, srPlane);
- span->specArray[count][GCOMP] = solve_plane_chan(cx, cy, sgPlane);
- span->specArray[count][BCOMP] = solve_plane_chan(cx, cy, sbPlane);
+ array->spec[count][RCOMP] = solve_plane_chan(cx, cy, srPlane);
+ array->spec[count][GCOMP] = solve_plane_chan(cx, cy, sgPlane);
+ array->spec[count][BCOMP] = solve_plane_chan(cx, cy, sbPlane);
#endif
#ifdef DO_TEX
{
const GLfloat invQ = solve_plane_recip(cx, cy, vPlane);
- span->texcoords[0][count][0] = solve_plane(cx, cy, sPlane) * invQ;
- span->texcoords[0][count][1] = solve_plane(cx, cy, tPlane) * invQ;
- span->texcoords[0][count][2] = solve_plane(cx, cy, uPlane) * invQ;
- span->lambda[0][count] = compute_lambda(sPlane, tPlane, vPlane,
+ array->texcoords[0][count][0] = solve_plane(cx, cy, sPlane) * invQ;
+ array->texcoords[0][count][1] = solve_plane(cx, cy, tPlane) * invQ;
+ array->texcoords[0][count][2] = solve_plane(cx, cy, uPlane) * invQ;
+ array->lambda[0][count] = compute_lambda(sPlane, tPlane, vPlane,
cx, cy, invQ,
texWidth, texHeight);
}
@@ -325,10 +326,10 @@
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
if (ctx->Texture.Unit[unit]._ReallyEnabled) {
GLfloat invQ = solve_plane_recip(cx, cy, vPlane[unit]);
- span->texcoords[unit][count][0] = solve_plane(cx, cy, sPlane[unit]) * invQ;
- span->texcoords[unit][count][1] = solve_plane(cx, cy, tPlane[unit]) * invQ;
- span->texcoords[unit][count][2] = solve_plane(cx, cy, uPlane[unit]) * invQ;
- span->lambda[unit][count] = compute_lambda(sPlane[unit],
+ array->texcoords[unit][count][0] = solve_plane(cx, cy, sPlane[unit]) * invQ;
+ array->texcoords[unit][count][1] = solve_plane(cx, cy, tPlane[unit]) * invQ;
+ array->texcoords[unit][count][2] = solve_plane(cx, cy, uPlane[unit]) * invQ;
+ array->lambda[unit][count] = compute_lambda(sPlane[unit],
tPlane[unit], vPlane[unit], cx, cy, invQ,
texWidth[unit], texHeight[unit]);
}
@@ -343,16 +344,16 @@
if (ix <= startX)
continue;
- span->x = startX;
- span->y = iy;
- span->end = (GLuint) ix - (GLuint) startX;
- ASSERT(span->interpMask == 0);
+ span.x = startX;
+ span.y = iy;
+ span.end = (GLuint) ix - (GLuint) startX;
+ ASSERT(span.interpMask == 0);
#if defined(DO_MULTITEX) || defined(DO_TEX)
- _mesa_write_texture_span(ctx, span);
+ _mesa_write_texture_span(ctx, &span);
#elif defined(DO_RGBA)
- _mesa_write_rgba_span(ctx, span);
+ _mesa_write_rgba_span(ctx, &span);
#elif defined(DO_INDEX)
- _mesa_write_index_span(ctx, span);
+ _mesa_write_index_span(ctx, &span);
#endif
}
}
@@ -389,38 +390,39 @@
while (coverage > 0.0F) {
/* (cx,cy) = center of fragment */
const GLfloat cx = ix + 0.5F, cy = iy + 0.5F;
+ struct span_arrays *array = span.array;
#ifdef DO_INDEX
- span->coverage[ix] = (GLfloat) compute_coveragei(pMin, pMax, pMid, ix, iy);
+ array->coverage[ix] = (GLfloat) compute_coveragei(pMin, pMax, pMid, ix, iy);
#else
- span->coverage[ix] = coverage;
+ array->coverage[ix] = coverage;
#endif
#ifdef DO_Z
- span->zArray[ix] = (GLdepth) solve_plane(cx, cy, zPlane);
+ array->z[ix] = (GLdepth) solve_plane(cx, cy, zPlane);
#endif
#ifdef DO_FOG
- span->fogArray[ix] = solve_plane(cx, cy, fogPlane);
+ array->fog[ix] = solve_plane(cx, cy, fogPlane);
#endif
#ifdef DO_RGBA
- span->color.rgba[ix][RCOMP] = solve_plane_chan(cx, cy, rPlane);
- span->color.rgba[ix][GCOMP] = solve_plane_chan(cx, cy, gPlane);
- span->color.rgba[ix][BCOMP] = solve_plane_chan(cx, cy, bPlane);
- span->color.rgba[ix][ACOMP] = solve_plane_chan(cx, cy, aPlane);
+ array->rgba[ix][RCOMP] = solve_plane_chan(cx, cy, rPlane);
+ array->rgba[ix][GCOMP] = solve_plane_chan(cx, cy, gPlane);
+ array->rgba[ix][BCOMP] = solve_plane_chan(cx, cy, bPlane);
+ array->rgba[ix][ACOMP] = solve_plane_chan(cx, cy, aPlane);
#endif
#ifdef DO_INDEX
- span->color.index[ix] = (GLint) solve_plane(cx, cy, iPlane);
+ array->index[ix] = (GLint) solve_plane(cx, cy, iPlane);
#endif
#ifdef DO_SPEC
- span->specArray[ix][RCOMP] = solve_plane_chan(cx, cy, srPlane);
- span->specArray[ix][GCOMP] = solve_plane_chan(cx, cy, sgPlane);
- span->specArray[ix][BCOMP] = solve_plane_chan(cx, cy, sbPlane);
+ array->spec[ix][RCOMP] = solve_plane_chan(cx, cy, srPlane);
+ array->spec[ix][GCOMP] = solve_plane_chan(cx, cy, sgPlane);
+ array->spec[ix][BCOMP] = solve_plane_chan(cx, cy, sbPlane);
#endif
#ifdef DO_TEX
{
const GLfloat invQ = solve_plane_recip(cx, cy, vPlane);
- span->texcoords[0][ix][0] = solve_plane(cx, cy, sPlane) * invQ;
- span->texcoords[0][ix][1] = solve_plane(cx, cy, tPlane) * invQ;
- span->texcoords[0][ix][2] = solve_plane(cx, cy, uPlane) * invQ;
- span->lambda[0][ix] = compute_lambda(sPlane, tPlane, vPlane,
+ array->texcoords[0][ix][0] = solve_plane(cx, cy, sPlane) * invQ;
+ array->texcoords[0][ix][1] = solve_plane(cx, cy, tPlane) * invQ;
+ array->texcoords[0][ix][2] = solve_plane(cx, cy, uPlane) * invQ;
+ array->lambda[0][ix] = compute_lambda(sPlane, tPlane, vPlane,
cx, cy, invQ, texWidth, texHeight);
}
#elif defined(DO_MULTITEX)
@@ -429,10 +431,10 @@
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
if (ctx->Texture.Unit[unit]._ReallyEnabled) {
GLfloat invQ = solve_plane_recip(cx, cy, vPlane[unit]);
- span->texcoords[unit][ix][0] = solve_plane(cx, cy, sPlane[unit]) * invQ;
- span->texcoords[unit][ix][1] = solve_plane(cx, cy, tPlane[unit]) * invQ;
- span->texcoords[unit][ix][2] = solve_plane(cx, cy, uPlane[unit]) * invQ;
- span->lambda[unit][ix] = compute_lambda(sPlane[unit],
+ array->texcoords[unit][ix][0] = solve_plane(cx, cy, sPlane[unit]) * invQ;
+ array->texcoords[unit][ix][1] = solve_plane(cx, cy, tPlane[unit]) * invQ;
+ array->texcoords[unit][ix][2] = solve_plane(cx, cy, uPlane[unit]) * invQ;
+ array->lambda[unit][ix] = compute_lambda(sPlane[unit],
tPlane[unit],
vPlane[unit],
cx, cy, invQ,
@@ -457,60 +459,62 @@
/* shift all values to the left */
/* XXX this is temporary */
{
+ struct span_arrays *array = span.array;
GLint j;
for (j = 0; j < (GLint) n; j++) {
#ifdef DO_RGBA
- COPY_4V(span->color.rgba[j], span->color.rgba[j + left]);
+ COPY_4V(array->rgba[j], array->rgba[j + left]);
#endif
#ifdef DO_SPEC
- COPY_4V(span->specArray[j], span->specArray[j + left]);
+ COPY_4V(array->spec[j], array->spec[j + left]);
#endif
#ifdef DO_INDEX
- span->color.index[j] = span->color.index[j + left];
+ array->index[j] = array->index[j + left];
#endif
#ifdef DO_Z
- span->zArray[j] = span->zArray[j + left];
+ array->z[j] = array->z[j + left];
#endif
#ifdef DO_FOG
- span->fogArray[j] = span->fogArray[j + left];
+ array->fog[j] = array->fog[j + left];
#endif
#ifdef DO_TEX
- COPY_4V(span->texcoords[0][j], span->texcoords[0][j + left]);
+ COPY_4V(array->texcoords[0][j], array->texcoords[0][j + left]);
#endif
#if defined(DO_MULTITEX) || defined(DO_TEX)
- span->lambda[0][j] = span->lambda[0][j + left];
+ array->lambda[0][j] = array->lambda[0][j + left];
#endif
- span->coverage[j] = span->coverage[j + left];
+ array->coverage[j] = array->coverage[j + left];
}
}
#ifdef DO_MULTITEX
/* shift texcoords */
{
+ struct span_arrays *array = span.array;
GLuint unit;
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
if (ctx->Texture.Unit[unit]._ReallyEnabled) {
GLint j;
for (j = 0; j < (GLint) n; j++) {
- span->texcoords[unit][j][0] = span->texcoords[unit][j + left][0];
- span->texcoords[unit][j][1] = span->texcoords[unit][j + left][1];
- span->texcoords[unit][j][2] = span->texcoords[unit][j + left][2];
- span->lambda[unit][j] = span->lambda[unit][j + left];
+ array->texcoords[unit][j][0] = array->texcoords[unit][j + left][0];
+ array->texcoords[unit][j][1] = array->texcoords[unit][j + left][1];
+ array->texcoords[unit][j][2] = array->texcoords[unit][j + left][2];
+ array->lambda[unit][j] = array->lambda[unit][j + left];
}
}
}
}
#endif
- span->x = left;
- span->y = iy;
- span->end = n;
- ASSERT(span->interpMask == 0);
+ span.x = left;
+ span.y = iy;
+ span.end = n;
+ ASSERT(span.interpMask == 0);
#if defined(DO_MULTITEX) || defined(DO_TEX)
- _mesa_write_texture_span(ctx, span);
+ _mesa_write_texture_span(ctx, &span);
#elif defined(DO_RGBA)
- _mesa_write_rgba_span(ctx, span);
+ _mesa_write_rgba_span(ctx, &span);
#elif defined(DO_INDEX)
- _mesa_write_index_span(ctx, span);
+ _mesa_write_index_span(ctx, &span);
#endif
}
}