More span clean-up, mostly texture-related.
_mesa_rasterize_span() is gone, replaced by new _mesa_write_textured_span(). Removed some unneeded triangle functions - more simplification possible.
This commit is contained in:
parent
2a182a9897
commit
f1e2369878
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_aatritemp.h,v 1.24 2002/01/27 18:32:03 brianp Exp $ */
|
||||
/* $Id: s_aatritemp.h,v 1.25 2002/01/28 00:07:33 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -268,7 +268,7 @@
|
|||
GLint iy;
|
||||
for (iy = iyMin; iy < iyMax; iy++, x += dxdy) {
|
||||
GLint ix, startX = (GLint) (x - xAdj);
|
||||
GLuint count, n;
|
||||
GLuint count;
|
||||
GLfloat coverage = 0.0F;
|
||||
SW_SPAN_RESET(span);
|
||||
|
||||
|
@ -343,42 +343,15 @@
|
|||
if (ix <= startX)
|
||||
continue;
|
||||
|
||||
n = (GLuint) ix - (GLuint) startX;
|
||||
|
||||
#ifdef DO_MULTITEX
|
||||
# ifdef DO_SPEC
|
||||
_old_write_multitexture_span(ctx, n, startX, iy, span.zArray,
|
||||
span.fogArray,
|
||||
span.texcoords,
|
||||
span.lambda, span.color.rgba,
|
||||
span.specArray,
|
||||
span.coverage, GL_POLYGON);
|
||||
# else
|
||||
_old_write_multitexture_span(ctx, n, startX, iy, span.zArray,
|
||||
span.fogArray,
|
||||
span.texcoords,
|
||||
span.lambda, span.color.rgba,
|
||||
NULL, span.coverage,
|
||||
GL_POLYGON);
|
||||
# endif
|
||||
#elif defined(DO_TEX)
|
||||
|
||||
span.x = startX;
|
||||
span.y = iy;
|
||||
span.end = n;
|
||||
_mesa_write_texture_span(ctx, &span, GL_POLYGON);
|
||||
|
||||
#elif defined(DO_RGBA)
|
||||
span.x = startX;
|
||||
span.y = iy;
|
||||
span.end = n;
|
||||
span.end = (GLuint) ix - (GLuint) startX;
|
||||
ASSERT(span.interpMask == 0);
|
||||
#if defined(DO_MULTITEX) || defined(DO_TEX)
|
||||
_mesa_write_texture_span(ctx, &span, GL_POLYGON);
|
||||
#elif defined(DO_RGBA)
|
||||
_mesa_write_rgba_span(ctx, &span, GL_POLYGON);
|
||||
#elif defined(DO_INDEX)
|
||||
span.x = startX;
|
||||
span.y = iy;
|
||||
span.end = n;
|
||||
ASSERT(span.interpMask == 0);
|
||||
_mesa_write_index_span(ctx, &span, GL_POLYGON);
|
||||
#endif
|
||||
}
|
||||
|
@ -479,7 +452,38 @@
|
|||
n = (GLuint) startX - (GLuint) ix;
|
||||
|
||||
left = ix + 1;
|
||||
|
||||
/* shift all values to the left */
|
||||
/* XXX this is temporary */
|
||||
{
|
||||
GLint j;
|
||||
for (j = 0; j < (GLint) n; j++) {
|
||||
#ifdef DO_RGBA
|
||||
COPY_4V(span.color.rgba[j], span.color.rgba[j + left]);
|
||||
#endif
|
||||
#ifdef DO_SPEC
|
||||
COPY_4V(span.specArray[j], span.specArray[j + left]);
|
||||
#endif
|
||||
#ifdef DO_INDEX
|
||||
span.color.index[j] = span.color.index[j + left];
|
||||
#endif
|
||||
#ifdef DO_Z
|
||||
span.zArray[j] = span.zArray[j + left];
|
||||
#endif
|
||||
#ifdef DO_FOG
|
||||
span.fogArray[j] = span.fogArray[j + left];
|
||||
#endif
|
||||
#ifdef DO_TEX
|
||||
COPY_4V(span.texcoords[0][j], span.texcoords[0][j + left]);
|
||||
#endif
|
||||
#if defined(DO_MULTITEX) || defined(DO_TEX)
|
||||
span.lambda[0][j] = span.lambda[0][j + left];
|
||||
#endif
|
||||
span.coverage[j] = span.coverage[j + left];
|
||||
}
|
||||
}
|
||||
#ifdef DO_MULTITEX
|
||||
/* shift texcoords */
|
||||
{
|
||||
GLuint unit;
|
||||
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
|
||||
|
@ -494,73 +498,17 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
# ifdef DO_SPEC
|
||||
_old_write_multitexture_span(ctx, n, left, iy, span.zArray + left,
|
||||
span.fogArray + left,
|
||||
span.texcoords, span.lambda,
|
||||
span.color.rgba + left,
|
||||
span.specArray + left,
|
||||
span.coverage + left,
|
||||
GL_POLYGON);
|
||||
# else
|
||||
_old_write_multitexture_span(ctx, n, left, iy, span.zArray + left,
|
||||
span.fogArray + left,
|
||||
span.texcoords, span.lambda,
|
||||
span.color.rgba + left, NULL,
|
||||
span.coverage + left,
|
||||
GL_POLYGON);
|
||||
# endif
|
||||
#elif defined(DO_TEX)
|
||||
#endif
|
||||
|
||||
/* XXX this is temporary */
|
||||
{
|
||||
GLint j;
|
||||
for (j = 0; j < (GLint) n; j++) {
|
||||
span.fogArray[j] = span.fogArray[j + left];
|
||||
span.zArray[j] = span.zArray[j + left];
|
||||
COPY_4V(span.color.rgba[j], span.color.rgba[j + left]);
|
||||
COPY_4V(span.specArray[j], span.specArray[j + left]);
|
||||
COPY_4V(span.texcoords[0][j], span.texcoords[0][j + left]);
|
||||
span.lambda[0][j] = span.lambda[0][j + left];
|
||||
span.coverage[j] = span.coverage[j + left];
|
||||
}
|
||||
}
|
||||
span.x = left;
|
||||
span.y = iy;
|
||||
span.end = n;
|
||||
_mesa_write_texture_span(ctx, &span, GL_POLYGON);
|
||||
|
||||
#elif defined(DO_RGBA)
|
||||
/* XXX this is temporary */
|
||||
{
|
||||
GLint j;
|
||||
for (j = 0; j < (GLint) n; j++) {
|
||||
span.fogArray[j] = span.fogArray[j + left];
|
||||
span.zArray[j] = span.zArray[j + left];
|
||||
COPY_4V(span.color.rgba[j], span.color.rgba[j + left]);
|
||||
span.coverage[j] = span.coverage[j + left];
|
||||
}
|
||||
}
|
||||
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, GL_POLYGON);
|
||||
#elif defined(DO_RGBA)
|
||||
_mesa_write_rgba_span(ctx, &span, GL_POLYGON);
|
||||
#elif defined(DO_INDEX)
|
||||
/* XXX this is temporary */
|
||||
{
|
||||
GLint j;
|
||||
for (j = 0; j < (GLint) n; j++) {
|
||||
span.fogArray[j] = span.fogArray[j + left];
|
||||
span.zArray[j] = span.zArray[j + left];
|
||||
span.color.index[j] = span.color.index[j + left];
|
||||
span.coverage[j] = span.coverage[j + left];
|
||||
}
|
||||
}
|
||||
span.x = left;
|
||||
span.y = iy;
|
||||
span.end = n;
|
||||
ASSERT(span.interpMask == 0);
|
||||
_mesa_write_index_span(ctx, &span, GL_POLYGON);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_alpha.c,v 1.6 2002/01/27 18:32:03 brianp Exp $ */
|
||||
/* $Id: s_alpha.c,v 1.7 2002/01/28 00:07:33 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -49,7 +49,7 @@ _mesa_alpha_test( const GLcontext *ctx, struct sw_span *span,
|
|||
const GLchan ref = ctx->Color.AlphaRef;
|
||||
GLubyte *mask = span->mask;
|
||||
|
||||
ASSERT (span->filledAlpha == GL_TRUE || (span->arrayMask & SPAN_RGBA));
|
||||
ASSERT(span->arrayMask & SPAN_RGBA);
|
||||
|
||||
/* switch cases ordered from most frequent to less frequent */
|
||||
switch (ctx->Color.AlphaFunc) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_depth.c,v 1.12 2002/01/27 18:32:03 brianp Exp $ */
|
||||
/* $Id: s_depth.c,v 1.13 2002/01/28 00:07:33 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -572,8 +572,7 @@ _mesa_depth_test_span( GLcontext *ctx, struct sw_span *span)
|
|||
{
|
||||
SWcontext *swrast = SWRAST_CONTEXT(ctx);
|
||||
|
||||
ASSERT((span->interpMask & SPAN_Z) || (span->arrayMask & SPAN_Z));
|
||||
ASSERT((span->filledDepth == GL_TRUE) || (span->arrayMask & SPAN_Z));
|
||||
ASSERT(span->arrayMask & SPAN_Z);
|
||||
|
||||
if (swrast->Driver.ReadDepthSpan) {
|
||||
/* hardware-based depth buffer */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_drawpix.c,v 1.26 2002/01/27 18:32:03 brianp Exp $ */
|
||||
/* $Id: s_drawpix.c,v 1.27 2002/01/28 00:07:33 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -634,7 +634,6 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
|
|||
span.x = x;
|
||||
span.y = y;
|
||||
span.end = drawWidth;
|
||||
span.filledDepth = GL_TRUE; /* XXX temporary */
|
||||
_mesa_write_rgba_span(ctx, &span, GL_BITMAP);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_fog.c,v 1.18 2002/01/27 18:32:03 brianp Exp $ */
|
||||
/* $Id: s_fog.c,v 1.19 2002/01/28 00:07:33 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -85,7 +85,6 @@ _mesa_fog_rgba_pixels( const GLcontext *ctx, struct sw_span *span,
|
|||
GLfloat fog = span->fog, Dfog = span->fogStep;
|
||||
GLchan rFog, gFog, bFog;
|
||||
|
||||
/* printf("%s\n", __FUNCTION__);*/
|
||||
ASSERT(ctx->Fog.Enabled);
|
||||
ASSERT(span->interpMask & SPAN_FOG);
|
||||
ASSERT(span->filledColor == GL_TRUE || (span->arrayMask & SPAN_RGBA));
|
||||
|
@ -119,7 +118,6 @@ _mesa_fog_rgba_pixels_with_array( const GLcontext *ctx, struct sw_span *span,
|
|||
GLuint i;
|
||||
GLchan rFog, gFog, bFog;
|
||||
|
||||
/* printf("%s\n", __FUNCTION__);*/
|
||||
ASSERT(fog != NULL);
|
||||
ASSERT(ctx->Fog.Enabled);
|
||||
ASSERT(span->filledColor == GL_TRUE || (span->arrayMask & SPAN_RGBA));
|
||||
|
@ -153,7 +151,6 @@ _old_fog_rgba_pixels( const GLcontext *ctx,
|
|||
GLuint i;
|
||||
GLchan rFog, gFog, bFog;
|
||||
|
||||
/* printf("%s\n", __FUNCTION__);*/
|
||||
UNCLAMPED_FLOAT_TO_CHAN(rFog, ctx->Fog.Color[RCOMP]);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(gFog, ctx->Fog.Color[GCOMP]);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(bFog, ctx->Fog.Color[BCOMP]);
|
||||
|
@ -185,7 +182,7 @@ _mesa_fog_ci_pixels( const GLcontext *ctx, struct sw_span *span,
|
|||
|
||||
ASSERT(ctx->Fog.Enabled);
|
||||
ASSERT(span->interpMask & SPAN_FOG);
|
||||
ASSERT(span->interpMask & SPAN_INDEX);
|
||||
ASSERT(span->arrayMask & SPAN_INDEX);
|
||||
|
||||
for (i = 0; i < span->end; i++) {
|
||||
const GLfloat f = CLAMP(fog, 0.0F, 1.0F);
|
||||
|
@ -396,11 +393,9 @@ _mesa_depth_fog_rgba_pixels(const GLcontext *ctx, struct sw_span *span,
|
|||
{
|
||||
GLfloat fogFact[PB_SIZE];
|
||||
|
||||
/* printf("%s\n", __FUNCTION__);*/
|
||||
ASSERT(ctx->Fog.Enabled);
|
||||
ASSERT(span->arrayMask & SPAN_Z);
|
||||
ASSERT(span->end <= PB_SIZE);
|
||||
ASSERT((span->filledDepth) == GL_TRUE || (span->arrayMask & SPAN_Z));
|
||||
|
||||
compute_fog_factors_from_z(ctx, span->end, span->zArray, fogFact );
|
||||
_mesa_fog_rgba_pixels_with_array( ctx, span, fogFact, rgba );
|
||||
|
@ -420,7 +415,6 @@ _old_depth_fog_rgba_pixels( const GLcontext *ctx,
|
|||
{
|
||||
GLfloat fogFact[PB_SIZE];
|
||||
ASSERT(n <= PB_SIZE);
|
||||
/* printf("%s\n", __FUNCTION__);*/
|
||||
compute_fog_factors_from_z( ctx, n, z, fogFact );
|
||||
_old_fog_rgba_pixels( ctx, n, fogFact, rgba );
|
||||
}
|
||||
|
@ -442,7 +436,6 @@ _mesa_depth_fog_ci_pixels( const GLcontext *ctx, struct sw_span *span,
|
|||
ASSERT(ctx->Fog.Enabled);
|
||||
ASSERT(span->arrayMask & SPAN_Z);
|
||||
ASSERT(span->end <= PB_SIZE);
|
||||
ASSERT((span->filledDepth == GL_TRUE) || (span->arrayMask & SPAN_Z));
|
||||
|
||||
compute_fog_factors_from_z(ctx, span->end, span->zArray, fogFact );
|
||||
_mesa_fog_ci_pixels_with_array( ctx, span, fogFact, index );
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_span.h,v 1.12 2002/01/27 18:32:03 brianp Exp $ */
|
||||
/* $Id: s_span.h,v 1.13 2002/01/28 00:07:33 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -57,30 +57,14 @@ _mesa_write_monocolor_span( GLcontext *ctx, struct sw_span *span,
|
|||
|
||||
extern void
|
||||
_mesa_write_texture_span( GLcontext *ctx, struct sw_span *span,
|
||||
GLenum primitive );
|
||||
|
||||
|
||||
extern void
|
||||
_mesa_rasterize_span(GLcontext *ctx, struct sw_span *span);
|
||||
|
||||
|
||||
extern void
|
||||
_old_write_multitexture_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
|
||||
const GLdepth z[], const GLfloat fog[],
|
||||
GLfloat texcoord[MAX_TEXTURE_UNITS][MAX_WIDTH][4],
|
||||
GLfloat lambda[MAX_TEXTURE_UNITS][MAX_WIDTH],
|
||||
GLchan rgba[][4], GLchan spec[][4],
|
||||
const GLfloat coverage[], GLenum primitive );
|
||||
|
||||
GLenum primitive );
|
||||
|
||||
extern void
|
||||
_mesa_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer,
|
||||
GLuint n, GLint x, GLint y, GLchan rgba[][4] );
|
||||
|
||||
|
||||
extern void
|
||||
_mesa_read_index_span( GLcontext *ctx, GLframebuffer *buffer,
|
||||
GLuint n, GLint x, GLint y, GLuint indx[] );
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_stencil.c,v 1.16 2002/01/27 18:32:03 brianp Exp $ */
|
||||
/* $Id: s_stencil.c,v 1.17 2002/01/28 00:07:33 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -561,7 +561,7 @@ _mesa_stencil_and_ztest_span(GLcontext *ctx, struct sw_span *span)
|
|||
ASSERT(span->end <= MAX_WIDTH);
|
||||
#ifdef DEBUG
|
||||
if (ctx->Depth.Test) {
|
||||
ASSERT((span->filledDepth == GL_TRUE) || (span->arrayMask & SPAN_Z));
|
||||
ASSERT(span->arrayMask & SPAN_Z);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_texture.c,v 1.46 2002/01/27 18:32:03 brianp Exp $ */
|
||||
/* $Id: s_texture.c,v 1.47 2002/01/28 00:07:33 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -3100,10 +3100,6 @@ _swrast_texture_fragments( GLcontext *ctx, GLuint texUnit,
|
|||
|
||||
lambda = (span->arrayMask & SPAN_LAMBDA) ? span->lambda[texUnit] : NULL;
|
||||
|
||||
/* XXXX
|
||||
ASSERT(span->filledTex[texUnit] == GL_TRUE);
|
||||
*/
|
||||
|
||||
if (textureUnit->_Current) { /* XXX need this? */
|
||||
const struct gl_texture_object *curObj = textureUnit->_Current;
|
||||
GLchan texel[PB_SIZE][4];
|
||||
|
@ -3149,3 +3145,49 @@ _swrast_texture_fragments( GLcontext *ctx, GLuint texUnit,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Apply multiple texture stages (or just unit 0) to the span.
|
||||
* At some point in the future we'll probably modify this so that
|
||||
* texels from any texture unit are available in any combiner unit.
|
||||
* That'll require doing all the texture sampling first, and then
|
||||
* all the application (blending) afterward.
|
||||
*/
|
||||
void
|
||||
_swrast_multitexture_fragments( GLcontext *ctx, struct sw_span *span )
|
||||
{
|
||||
if (ctx->Texture._ReallyEnabled & ~TEXTURE0_ANY) {
|
||||
/* multitexture */
|
||||
GLchan primary_rgba[PB_SIZE][4];
|
||||
GLuint unit;
|
||||
|
||||
ASSERT(span->end < PB_SIZE);
|
||||
|
||||
/* save copy of the span colors (the GL_PRIMARY_COLOR) */
|
||||
MEMCPY(primary_rgba, span->color.rgba, 4 * span->end * sizeof(GLchan));
|
||||
|
||||
/* loop over texture units, modifying the span->color.rgba values */
|
||||
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
|
||||
if (ctx->Texture.Unit[unit]._ReallyEnabled) {
|
||||
_old_swrast_texture_fragments( ctx, unit, span->end,
|
||||
span->texcoords[unit],
|
||||
(span->arrayMask & SPAN_LAMBDA) ?
|
||||
span->lambda[unit] : NULL,
|
||||
(CONST GLchan (*)[4]) primary_rgba,
|
||||
span->color.rgba );
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Just unit 0 enabled */
|
||||
ASSERT(ctx->Texture._ReallyEnabled & TEXTURE0_ANY);
|
||||
|
||||
_old_swrast_texture_fragments( ctx, 0, span->end,
|
||||
span->texcoords[0],
|
||||
(span->arrayMask & SPAN_LAMBDA) ?
|
||||
span->lambda[0] : NULL,
|
||||
(CONST GLchan (*)[4]) span->color.rgba,
|
||||
span->color.rgba );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_texture.h,v 1.9 2002/01/27 18:32:03 brianp Exp $ */
|
||||
/* $Id: s_texture.h,v 1.10 2002/01/28 00:07:33 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -50,4 +50,7 @@ _old_swrast_texture_fragments( GLcontext *ctx, GLuint texSet, GLuint n,
|
|||
CONST GLchan primary_rgba[][4],
|
||||
GLchan rgba[][4] );
|
||||
|
||||
extern void
|
||||
_swrast_multitexture_fragments( GLcontext *ctx, struct sw_span *span );
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_triangle.c,v 1.49 2002/01/27 18:32:03 brianp Exp $ */
|
||||
/* $Id: s_triangle.c,v 1.50 2002/01/28 00:07:33 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -131,6 +131,17 @@ static void flat_rgba_triangle( GLcontext *ctx,
|
|||
#define INTERP_FOG 1
|
||||
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
|
||||
|
||||
#define SETUP_CODE \
|
||||
span.interpMask |= SPAN_RGBA; \
|
||||
span.red = ChanToFixed(v2->color[0]); \
|
||||
span.green = ChanToFixed(v2->color[1]); \
|
||||
span.blue = ChanToFixed(v2->color[2]); \
|
||||
span.alpha = ChanToFixed(v2->color[3]); \
|
||||
span.redStep = 0; \
|
||||
span.greenStep = 0; \
|
||||
span.blueStep = 0; \
|
||||
span.alphaStep = 0;
|
||||
|
||||
#define RENDER_SPAN( span ) \
|
||||
_mesa_write_monocolor_span(ctx, &span, v2->color, GL_POLYGON );
|
||||
|
||||
|
@ -274,7 +285,6 @@ static void simple_z_textured_triangle( GLcontext *ctx,
|
|||
span.intTex[0] -= FIXED_HALF; /* off-by-one error? */ \
|
||||
span.intTex[1] -= FIXED_HALF; \
|
||||
SW_SPAN_SET_FLAG(span.filledColor); \
|
||||
SW_SPAN_SET_FLAG(span.filledDepth); \
|
||||
for (i = 0; i < span.end; i++) { \
|
||||
const GLdepth z = FixedToDepth(span.z); \
|
||||
if (z < zRow[i]) { \
|
||||
|
@ -940,63 +950,6 @@ static void general_textured_triangle( GLcontext *ctx,
|
|||
#define INTERP_FOG 1
|
||||
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
|
||||
#define INTERP_RGB 1
|
||||
#define INTERP_ALPHA 1
|
||||
#define INTERP_TEX 1
|
||||
|
||||
#define SETUP_CODE \
|
||||
const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current; \
|
||||
const struct gl_texture_image *texImage = obj->Image[obj->BaseLevel];\
|
||||
span.texWidth[0] = (GLfloat) texImage->Width; \
|
||||
span.texHeight[0] = (GLfloat) texImage->Height; \
|
||||
(void) fixedToDepthShift;
|
||||
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
SW_SPAN_SET_FLAG(span.filledColor); \
|
||||
SW_SPAN_SET_FLAG(span.filledAlpha); \
|
||||
SW_SPAN_SET_FLAG(span.filledTex[0]); \
|
||||
SW_SPAN_SET_FLAG(span.filledDepth); \
|
||||
/* NOTE: we could just call rasterize_span() here instead */ \
|
||||
for (i = 0; i < span.end; i++) { \
|
||||
GLdouble invQ = span.tex[0][3] ? (1.0 / span.tex[0][3]) : 1.0; \
|
||||
span.zArray[i] = FixedToDepth(span.z); \
|
||||
span.z += span.zStep; \
|
||||
span.color.rgba[i][RCOMP] = FixedToChan(span.red); \
|
||||
span.color.rgba[i][GCOMP] = FixedToChan(span.green); \
|
||||
span.color.rgba[i][BCOMP] = FixedToChan(span.blue); \
|
||||
span.color.rgba[i][ACOMP] = FixedToChan(span.alpha); \
|
||||
span.red += span.redStep; \
|
||||
span.green += span.greenStep; \
|
||||
span.blue += span.blueStep; \
|
||||
span.alpha += span.alphaStep; \
|
||||
span.texcoords[0][i][0] = (GLfloat) (span.tex[0][0] * invQ); \
|
||||
span.texcoords[0][i][1] = (GLfloat) (span.tex[0][1] * invQ); \
|
||||
span.texcoords[0][i][2] = (GLfloat) (span.tex[0][2] * invQ); \
|
||||
span.tex[0][0] += span.texStep[0][0]; \
|
||||
span.tex[0][1] += span.texStep[0][1]; \
|
||||
span.tex[0][2] += span.texStep[0][2]; \
|
||||
span.tex[0][3] += span.texStep[0][3]; \
|
||||
} \
|
||||
_mesa_write_texture_span( ctx, &span, GL_POLYGON );
|
||||
|
||||
#include "s_tritemp.h"
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Render a smooth-shaded, textured, RGBA triangle with separate specular
|
||||
* color interpolation.
|
||||
* Interpolate texcoords with perspective correction, w/out mipmapping.
|
||||
*/
|
||||
static void general_textured_spec_triangle( GLcontext *ctx,
|
||||
const SWvertex *v0,
|
||||
const SWvertex *v1,
|
||||
const SWvertex *v2 )
|
||||
{
|
||||
#define INTERP_Z 1
|
||||
#define INTERP_FOG 1
|
||||
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
|
||||
#define INTERP_RGB 1
|
||||
#define INTERP_SPEC 1
|
||||
#define INTERP_ALPHA 1
|
||||
#define INTERP_TEX 1
|
||||
|
@ -1008,12 +961,13 @@ static void general_textured_spec_triangle( GLcontext *ctx,
|
|||
span.texHeight[0] = (GLfloat) texImage->Height; \
|
||||
(void) fixedToDepthShift;
|
||||
|
||||
#define RENDER_SPAN( span ) _mesa_rasterize_span(ctx, &span);
|
||||
#define RENDER_SPAN( span ) _mesa_write_texture_span(ctx, &span, GL_POLYGON);
|
||||
|
||||
#include "s_tritemp.h"
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Render a smooth-shaded, textured, RGBA triangle.
|
||||
* Interpolate S,T,R with perspective correction and compute lambda for
|
||||
|
@ -1030,40 +984,6 @@ static void lambda_textured_triangle( GLcontext *ctx,
|
|||
#define INTERP_FOG 1
|
||||
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
|
||||
#define INTERP_RGB 1
|
||||
#define INTERP_ALPHA 1
|
||||
#define INTERP_TEX 1
|
||||
#define INTERP_LAMBDA 1
|
||||
|
||||
#define SETUP_CODE \
|
||||
const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current; \
|
||||
const struct gl_texture_image *texImage = obj->Image[obj->BaseLevel];\
|
||||
span.texWidth[0] = (GLfloat) texImage->Width; \
|
||||
span.texHeight[0] = (GLfloat) texImage->Height; \
|
||||
(void) fixedToDepthShift;
|
||||
|
||||
#define RENDER_SPAN( span ) _mesa_rasterize_span(ctx, &span);
|
||||
|
||||
#include "s_tritemp.h"
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Render a smooth-shaded, textured, RGBA triangle with separate specular
|
||||
* interpolation.
|
||||
* Interpolate S,T,R with perspective correction and compute lambda for
|
||||
* each fragment. Lambda is used to determine whether to use the
|
||||
* minification or magnification filter. If minification and using
|
||||
* mipmaps, lambda is also used to select the texture level of detail.
|
||||
*/
|
||||
static void lambda_textured_spec_triangle( GLcontext *ctx,
|
||||
const SWvertex *v0,
|
||||
const SWvertex *v1,
|
||||
const SWvertex *v2 )
|
||||
{
|
||||
#define INTERP_Z 1
|
||||
#define INTERP_FOG 1
|
||||
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
|
||||
#define INTERP_RGB 1
|
||||
#define INTERP_SPEC 1
|
||||
#define INTERP_ALPHA 1
|
||||
#define INTERP_TEX 1
|
||||
|
@ -1076,7 +996,7 @@ static void lambda_textured_spec_triangle( GLcontext *ctx,
|
|||
span.texHeight[0] = (GLfloat) texImage->Height; \
|
||||
(void) fixedToDepthShift;
|
||||
|
||||
#define RENDER_SPAN( span ) _mesa_rasterize_span(ctx, &span);
|
||||
#define RENDER_SPAN( span ) _mesa_write_texture_span(ctx, &span, GL_POLYGON);
|
||||
|
||||
#include "s_tritemp.h"
|
||||
}
|
||||
|
@ -1118,7 +1038,7 @@ lambda_multitextured_triangle( GLcontext *ctx,
|
|||
} \
|
||||
(void) fixedToDepthShift;
|
||||
|
||||
#define RENDER_SPAN( span ) _mesa_rasterize_span(ctx, &span);
|
||||
#define RENDER_SPAN( span ) _mesa_write_texture_span(ctx, &span, GL_POLYGON);
|
||||
|
||||
#include "s_tritemp.h"
|
||||
|
||||
|
@ -1347,15 +1267,6 @@ _swrast_choose_triangle( GLcontext *ctx )
|
|||
if (ctx->Texture._ReallyEnabled > TEXTURE0_ANY) {
|
||||
USE(lambda_multitextured_triangle);
|
||||
}
|
||||
else if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) {
|
||||
/* separate specular color interpolation */
|
||||
if (needLambda) {
|
||||
USE(lambda_textured_spec_triangle);
|
||||
}
|
||||
else {
|
||||
USE(general_textured_spec_triangle);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (needLambda) {
|
||||
USE(lambda_textured_triangle);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_zoom.c,v 1.9 2002/01/27 18:32:03 brianp Exp $ */
|
||||
/* $Id: s_zoom.c,v 1.10 2002/01/28 00:07:33 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -86,7 +86,7 @@ _mesa_write_zoomed_rgba_span( GLcontext *ctx,
|
|||
struct sw_span zoomed;
|
||||
const GLint maxwidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH );
|
||||
|
||||
SW_SPAN_RESET (zoomed);
|
||||
SW_SPAN_RESET(zoomed);
|
||||
INIT_SPAN(zoomed);
|
||||
|
||||
/* compute width of output row */
|
||||
|
@ -150,7 +150,6 @@ _mesa_write_zoomed_rgba_span( GLcontext *ctx,
|
|||
if (ctx->Pixel.ZoomX==-1.0F) {
|
||||
SW_SPAN_SET_FLAG(zoomed.filledColor);
|
||||
SW_SPAN_SET_FLAG(zoomed.filledAlpha);
|
||||
SW_SPAN_SET_FLAG(zoomed.filledDepth);
|
||||
/* n==m */
|
||||
for (j=zoomed.start; j<zoomed.end; j++) {
|
||||
i = n - j - 1;
|
||||
|
@ -168,7 +167,6 @@ _mesa_write_zoomed_rgba_span( GLcontext *ctx,
|
|||
const GLfloat xscale = 1.0F / ctx->Pixel.ZoomX;
|
||||
SW_SPAN_SET_FLAG(zoomed.filledColor);
|
||||
SW_SPAN_SET_FLAG(zoomed.filledAlpha);
|
||||
SW_SPAN_SET_FLAG(zoomed.filledDepth);
|
||||
for (j=zoomed.start; j<zoomed.end; j++) {
|
||||
i = (GLint) (j * xscale);
|
||||
if (i<0) i = n + i - 1;
|
||||
|
@ -184,6 +182,7 @@ _mesa_write_zoomed_rgba_span( GLcontext *ctx,
|
|||
}
|
||||
}
|
||||
|
||||
zoomed.arrayMask |= SPAN_RGBA;
|
||||
zoomed.arrayMask |= SPAN_Z;
|
||||
if (fog)
|
||||
zoomed.arrayMask |= SPAN_FOG;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: swrast.h,v 1.16 2002/01/27 18:32:03 brianp Exp $ */
|
||||
/* $Id: swrast.h,v 1.17 2002/01/28 00:07:33 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -162,9 +162,7 @@ struct sw_span {
|
|||
GLubyte mask[MAX_WIDTH];
|
||||
|
||||
#ifdef DEBUG
|
||||
GLboolean filledDepth, filledAlpha;
|
||||
GLboolean filledColor, filledSpecular;
|
||||
GLboolean filledLambda[MAX_TEXTURE_UNITS], filledTex[MAX_TEXTURE_UNITS];
|
||||
GLboolean filledAlpha, filledColor;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -180,12 +178,7 @@ do { \
|
|||
#ifdef DEBUG
|
||||
#define SW_SPAN_SET_FLAG(flag) {ASSERT((flag) == GL_FALSE);(flag) = GL_TRUE;}
|
||||
#define SW_SPAN_RESET(span) { \
|
||||
(span).filledDepth = (span).filledAlpha \
|
||||
= (span).filledColor = (span).filledSpecular = GL_FALSE; \
|
||||
MEMSET((span).filledTex, GL_FALSE, \
|
||||
MAX_TEXTURE_UNITS*sizeof(GLboolean)); \
|
||||
MEMSET((span).filledLambda, GL_FALSE, \
|
||||
MAX_TEXTURE_UNITS*sizeof(GLboolean)); \
|
||||
(span).filledAlpha = (span).filledColor = GL_FALSE; \
|
||||
(span).start = 0; (span).writeAll = GL_TRUE;}
|
||||
#else
|
||||
#define SW_SPAN_SET_FLAG(flag) ;
|
||||
|
|
Loading…
Reference in New Issue