summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast/s_pointtemp.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_pointtemp.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_pointtemp.h')
-rw-r--r--src/mesa/swrast/s_pointtemp.h122
1 files changed, 61 insertions, 61 deletions
diff --git a/src/mesa/swrast/s_pointtemp.h b/src/mesa/swrast/s_pointtemp.h
index 1fc8ba39f4c..be8783b6949 100644
--- a/src/mesa/swrast/s_pointtemp.h
+++ b/src/mesa/swrast/s_pointtemp.h
@@ -1,4 +1,4 @@
-/* $Id: s_pointtemp.h,v 1.17 2002/06/15 03:03:11 brianp Exp $ */
+/* $Id: s_pointtemp.h,v 1.18 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -77,7 +77,7 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
const GLchan alpha = vert->color[3];
#endif
- struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+ struct sw_span span;
/* Cull primitives with malformed coordinates.
*/
@@ -88,58 +88,58 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
}
INIT_SPAN(span, GL_POINT, 0, SPAN_FOG, SPAN_XY | SPAN_Z);
- span->fog = vert->fog;
- span->fogStep = 0.0;
+ span.fog = vert->fog;
+ span.fogStep = 0.0;
#if (FLAGS & RGBA)
#if (FLAGS & SMOOTH)
/* because we need per-fragment alpha values */
- span->arrayMask |= SPAN_RGBA;
+ span.arrayMask |= SPAN_RGBA;
#else
/* same RGBA for all fragments */
- span->interpMask |= SPAN_RGBA;
- span->red = ChanToFixed(vert->color[0]);
- span->green = ChanToFixed(vert->color[1]);
- span->blue = ChanToFixed(vert->color[2]);
- span->alpha = ChanToFixed(vert->color[3]);
- span->redStep = span->greenStep = span->blueStep = span->alphaStep = 0;
+ span.interpMask |= SPAN_RGBA;
+ span.red = ChanToFixed(vert->color[0]);
+ span.green = ChanToFixed(vert->color[1]);
+ span.blue = ChanToFixed(vert->color[2]);
+ span.alpha = ChanToFixed(vert->color[3]);
+ span.redStep = span.greenStep = span.blueStep = span.alphaStep = 0;
#endif /*SMOOTH*/
#endif /*RGBA*/
#if FLAGS & SPECULAR
- span->interpMask |= SPAN_SPEC;
- span->specRed = ChanToFixed(vert->specular[0]);
- span->specGreen = ChanToFixed(vert->specular[1]);
- span->specBlue = ChanToFixed(vert->specular[2]);
- span->specRedStep = span->specGreenStep = span->specBlueStep = 0;
+ span.interpMask |= SPAN_SPEC;
+ span.specRed = ChanToFixed(vert->specular[0]);
+ span.specGreen = ChanToFixed(vert->specular[1]);
+ span.specBlue = ChanToFixed(vert->specular[2]);
+ span.specRedStep = span.specGreenStep = span.specBlueStep = 0;
#endif
#if FLAGS & INDEX
- span->interpMask |= SPAN_INDEX;
- span->index = IntToFixed(vert->index);
- span->indexStep = 0;
+ span.interpMask |= SPAN_INDEX;
+ span.index = IntToFixed(vert->index);
+ span.indexStep = 0;
#endif
#if FLAGS & TEXTURE
/* but not used for sprite mode */
- span->interpMask |= SPAN_TEXTURE;
+ span.interpMask |= SPAN_TEXTURE;
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
if (ctx->Texture.Unit[u]._ReallyEnabled) {
const GLfloat q = vert->texcoord[u][3];
const GLfloat invQ = (q == 0.0 || q == 1.0) ? 1.0 : (1.0 / q);
- span->tex[u][0] = vert->texcoord[u][0] * invQ;
- span->tex[u][1] = vert->texcoord[u][1] * invQ;
- span->tex[u][2] = vert->texcoord[u][2] * invQ;
- span->tex[u][3] = q;
- span->texStepX[u][0] = span->texStepY[u][0] = 0.0;
- span->texStepX[u][1] = span->texStepY[u][1] = 0.0;
- span->texStepX[u][2] = span->texStepY[u][2] = 0.0;
- span->texStepX[u][3] = span->texStepY[u][3] = 0.0;
+ span.tex[u][0] = vert->texcoord[u][0] * invQ;
+ span.tex[u][1] = vert->texcoord[u][1] * invQ;
+ span.tex[u][2] = vert->texcoord[u][2] * invQ;
+ span.tex[u][3] = q;
+ span.texStepX[u][0] = span.texStepY[u][0] = 0.0;
+ span.texStepX[u][1] = span.texStepY[u][1] = 0.0;
+ span.texStepX[u][2] = span.texStepY[u][2] = 0.0;
+ span.texStepX[u][3] = span.texStepY[u][3] = 0.0;
}
}
#endif
#if FLAGS & SMOOTH
- span->arrayMask |= SPAN_COVERAGE;
+ span.arrayMask |= SPAN_COVERAGE;
#endif
#if FLAGS & SPRITE
- span->arrayMask |= SPAN_TEXTURE;
+ span.arrayMask |= SPAN_TEXTURE;
#endif
#if FLAGS & ATTENUATE
@@ -209,55 +209,55 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
if (dist2 < rmax2) {
if (dist2 >= rmin2) {
/* compute partial coverage */
- span->coverage[count] = 1.0F - (dist2 - rmin2) * cscale;
+ span.array->coverage[count] = 1.0F - (dist2 - rmin2) * cscale;
#if FLAGS & INDEX
- span->coverage[count] *= 15.0; /* coverage in [0,15] */
+ span.array->coverage[count] *= 15.0; /* coverage in [0,15] */
#endif
}
else {
/* full coverage */
- span->coverage[count] = 1.0F;
+ span.array->coverage[count] = 1.0F;
}
- span->xArray[count] = x;
- span->yArray[count] = y;
- span->zArray[count] = z;
+ span.array->x[count] = x;
+ span.array->y[count] = y;
+ span.array->z[count] = z;
#if FLAGS & RGBA
- span->color.rgba[count][RCOMP] = red;
- span->color.rgba[count][GCOMP] = green;
- span->color.rgba[count][BCOMP] = blue;
+ span.array->rgba[count][RCOMP] = red;
+ span.array->rgba[count][GCOMP] = green;
+ span.array->rgba[count][BCOMP] = blue;
#if FLAGS & ATTENUATE
- span->color.rgba[count][ACOMP] = (GLchan) (alpha * alphaAtten);
+ span.array->rgba[count][ACOMP] = (GLchan) (alpha * alphaAtten);
#else
- span->color.rgba[count][ACOMP] = alpha;
+ span.array->rgba[count][ACOMP] = alpha;
#endif /*ATTENUATE*/
#endif /*RGBA*/
count++;
} /*if*/
#else /*SMOOTH*/
/* not smooth (square points) */
- span->xArray[count] = x;
- span->yArray[count] = y;
- span->zArray[count] = z;
+ span.array->x[count] = x;
+ span.array->y[count] = y;
+ span.array->z[count] = z;
#if FLAGS & SPRITE
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
if (ctx->Texture.Unit[u]._ReallyEnabled) {
if (ctx->Point.CoordReplace[u]) {
GLfloat s = 0.5F + (x + 0.5F - vert->win[0]) / size;
GLfloat t = 0.5F - (y + 0.5F - vert->win[1]) / size;
- span->texcoords[u][count][0] = s;
- span->texcoords[u][count][1] = t;
- span->texcoords[u][count][3] = 1.0F;
+ span.array->texcoords[u][count][0] = s;
+ span.array->texcoords[u][count][1] = t;
+ span.array->texcoords[u][count][3] = 1.0F;
if (ctx->Point.SpriteRMode == GL_ZERO)
- span->texcoords[u][count][2] = 0.0F;
+ span.array->texcoords[u][count][2] = 0.0F;
else if (ctx->Point.SpriteRMode == GL_S)
- span->texcoords[u][count][2] = vert->texcoord[u][0];
+ span.array->texcoords[u][count][2] = vert->texcoord[u][0];
else /* GL_R */
- span->texcoords[u][count][2] = vert->texcoord[u][2];
+ span.array->texcoords[u][count][2] = vert->texcoord[u][2];
}
else {
- COPY_4V(span->texcoords[u][count], vert->texcoord[u]);
+ COPY_4V(span.array->texcoords[u][count], vert->texcoord[u]);
}
}
}
@@ -266,32 +266,32 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
#endif /*SMOOTH*/
} /*for x*/
} /*for y*/
- span->end = count;
+ span.end = count;
}
#else /* LARGE | ATTENUATE | SMOOTH | SPRITE */
{
/* size == 1 */
- span->xArray[0] = (GLint) vert->win[0];
- span->yArray[0] = (GLint) vert->win[1];
- span->zArray[0] = (GLint) vert->win[2];
- span->end = 1;
+ span.array->x[0] = (GLint) vert->win[0];
+ span.array->y[0] = (GLint) vert->win[1];
+ span.array->z[0] = (GLint) vert->win[2];
+ span.end = 1;
}
#endif /* LARGE || ATTENUATE || SMOOTH */
- ASSERT(span->end > 0);
+ ASSERT(span.end > 0);
#if FLAGS & (TEXTURE | SPRITE)
if (ctx->Texture._EnabledUnits)
- _mesa_write_texture_span(ctx, span);
+ _mesa_write_texture_span(ctx, &span);
else
- _mesa_write_rgba_span(ctx, span);
+ _mesa_write_rgba_span(ctx, &span);
#elif FLAGS & RGBA
- _mesa_write_rgba_span(ctx, span);
+ _mesa_write_rgba_span(ctx, &span);
#else
- _mesa_write_index_span(ctx, span);
+ _mesa_write_index_span(ctx, &span);
#endif
}