type, width, interp mask and array mask.tags/mesa_4_1
@@ -1,4 +1,4 @@ | |||
/* $Id: s_aalinetemp.h,v 1.18 2002/03/28 16:24:14 brianp Exp $ */ | |||
/* $Id: s_aalinetemp.h,v 1.19 2002/04/12 15:39:58 brianp Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -101,11 +101,11 @@ NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy) | |||
if (line->span.end == MAX_WIDTH) { | |||
#if defined(DO_TEX) || defined(DO_MULTITEX) | |||
_mesa_write_texture_span(ctx, &line->span, GL_LINE); | |||
_mesa_write_texture_span(ctx, &line->span); | |||
#elif defined(DO_RGBA) | |||
_mesa_write_rgba_span(ctx, &line->span, GL_LINE); | |||
_mesa_write_rgba_span(ctx, &line->span); | |||
#else | |||
_mesa_write_index_span(ctx, &line->span, GL_LINE); | |||
_mesa_write_index_span(ctx, &line->span); | |||
#endif | |||
line->span.end = 0; /* reset counter */ | |||
} | |||
@@ -138,8 +138,8 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) | |||
if (line.len == 0.0 || IS_INF_OR_NAN(line.len)) | |||
return; | |||
INIT_SPAN(line.span); | |||
line.span.arrayMask |= (SPAN_XY | SPAN_COVERAGE); | |||
INIT_SPAN(line.span, GL_LINE, 0, 0, SPAN_XY | SPAN_COVERAGE); | |||
/*line.span.arrayMask |= (SPAN_XY | SPAN_COVERAGE);*/ | |||
line.xAdj = line.dx / line.len * line.halfWidth; | |||
line.yAdj = line.dy / line.len * line.halfWidth; | |||
@@ -295,11 +295,11 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) | |||
} | |||
#if defined(DO_TEX) || defined(DO_MULTITEX) | |||
_mesa_write_texture_span(ctx, &line.span, GL_LINE); | |||
_mesa_write_texture_span(ctx, &line.span); | |||
#elif defined(DO_RGBA) | |||
_mesa_write_rgba_span(ctx, &line.span, GL_LINE); | |||
_mesa_write_rgba_span(ctx, &line.span); | |||
#else | |||
_mesa_write_index_span(ctx, &line.span, GL_LINE); | |||
_mesa_write_index_span(ctx, &line.span); | |||
#endif | |||
} | |||
@@ -1,4 +1,4 @@ | |||
/* $Id: s_aatritemp.h,v 1.27 2002/03/16 18:02:07 brianp Exp $ */ | |||
/* $Id: s_aatritemp.h,v 1.28 2002/04/12 15:39:58 brianp Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -85,8 +85,8 @@ | |||
GLfloat bf = SWRAST_CONTEXT(ctx)->_backface_sign; | |||
INIT_SPAN(span); | |||
span.arrayMask |= SPAN_COVERAGE; | |||
INIT_SPAN(span, GL_POLYGON, 0, 0, SPAN_COVERAGE); | |||
/*span.arrayMask |= SPAN_COVERAGE;*/ | |||
/* determine bottom to top order of vertices */ | |||
{ | |||
@@ -349,11 +349,11 @@ | |||
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); | |||
_mesa_write_texture_span(ctx, &span); | |||
#elif defined(DO_RGBA) | |||
_mesa_write_rgba_span(ctx, &span, GL_POLYGON); | |||
_mesa_write_rgba_span(ctx, &span); | |||
#elif defined(DO_INDEX) | |||
_mesa_write_index_span(ctx, &span, GL_POLYGON); | |||
_mesa_write_index_span(ctx, &span); | |||
#endif | |||
} | |||
} | |||
@@ -507,11 +507,11 @@ | |||
span.end = n; | |||
ASSERT(span.interpMask == 0); | |||
#if defined(DO_MULTITEX) || defined(DO_TEX) | |||
_mesa_write_texture_span(ctx, &span, GL_POLYGON); | |||
_mesa_write_texture_span(ctx, &span); | |||
#elif defined(DO_RGBA) | |||
_mesa_write_rgba_span(ctx, &span, GL_POLYGON); | |||
_mesa_write_rgba_span(ctx, &span); | |||
#elif defined(DO_INDEX) | |||
_mesa_write_index_span(ctx, &span, GL_POLYGON); | |||
_mesa_write_index_span(ctx, &span); | |||
#endif | |||
} | |||
} |
@@ -1,4 +1,4 @@ | |||
/* $Id: s_bitmap.c,v 1.16 2002/02/17 17:30:23 brianp Exp $ */ | |||
/* $Id: s_bitmap.c,v 1.17 2002/04/12 15:39:59 brianp Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -63,9 +63,9 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, | |||
if (SWRAST_CONTEXT(ctx)->NewState) | |||
_swrast_validate_derived( ctx ); | |||
INIT_SPAN(span); | |||
span.arrayMask |= SPAN_XY; | |||
span.end = width; | |||
INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_XY); | |||
/*span.arrayMask |= SPAN_XY; | |||
span.end = width;*/ | |||
if (ctx->Visual.rgbMode) { | |||
span.interpMask |= SPAN_RGBA; | |||
span.red = FloatToFixed(ctx->Current.RasterColor[0] * CHAN_MAXF); | |||
@@ -138,9 +138,9 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, | |||
/* flush the span */ | |||
span.end = count; | |||
if (ctx->Visual.rgbMode) | |||
_mesa_write_rgba_span(ctx, &span, GL_BITMAP); | |||
_mesa_write_rgba_span(ctx, &span); | |||
else | |||
_mesa_write_index_span(ctx, &span, GL_BITMAP); | |||
_mesa_write_index_span(ctx, &span); | |||
span.end = 0; | |||
count = 0; | |||
} | |||
@@ -175,11 +175,11 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, | |||
if (SWRAST_CONTEXT(ctx)->NewState) | |||
_swrast_validate_derived( ctx ); | |||
INIT_SPAN(span); | |||
span.arrayMask |= SPAN_MASK; /* we'll init span.mask[] */ | |||
INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_MASK); | |||
/*span.arrayMask |= SPAN_MASK;*/ /* we'll init span.mask[] */ | |||
span.x = px; | |||
span.y = py; | |||
span.end = width; | |||
/*span.end = width;*/ | |||
if (ctx->Visual.rgbMode) { | |||
span.interpMask |= SPAN_RGBA; | |||
span.red = FloatToFixed(ctx->Current.RasterColor[0] * CHAN_MAXF); | |||
@@ -218,9 +218,9 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, | |||
} | |||
if (ctx->Visual.rgbMode) | |||
_mesa_write_rgba_span(ctx, &span, GL_BITMAP); | |||
_mesa_write_rgba_span(ctx, &span); | |||
else | |||
_mesa_write_index_span(ctx, &span, GL_BITMAP); | |||
_mesa_write_index_span(ctx, &span); | |||
/* get ready for next row */ | |||
if (mask != 1) | |||
@@ -241,9 +241,9 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, | |||
} | |||
if (ctx->Visual.rgbMode) | |||
_mesa_write_rgba_span(ctx, &span, GL_BITMAP); | |||
_mesa_write_rgba_span(ctx, &span); | |||
else | |||
_mesa_write_index_span(ctx, &span, GL_BITMAP); | |||
_mesa_write_index_span(ctx, &span); | |||
/* get ready for next row */ | |||
if (mask != 128) |
@@ -1,4 +1,4 @@ | |||
/* $Id: s_copypix.c,v 1.34 2002/03/14 22:09:25 brianp Exp $ */ | |||
/* $Id: s_copypix.c,v 1.35 2002/04/12 15:39:59 brianp Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -109,8 +109,8 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, | |||
GLfloat *dest, *tmpImage, *convImage; | |||
struct sw_span span; | |||
INIT_SPAN(span); | |||
span.arrayMask |= SPAN_RGBA; | |||
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); | |||
/*span.arrayMask |= SPAN_RGBA;*/ | |||
if (ctx->Depth.Test) | |||
_mesa_span_default_z(ctx, &span); | |||
@@ -282,7 +282,7 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, | |||
span.x = destx; | |||
span.y = dy; | |||
span.end = width; | |||
_mesa_write_rgba_span(ctx, &span, GL_BITMAP); | |||
_mesa_write_rgba_span(ctx, &span); | |||
} | |||
} | |||
@@ -308,8 +308,8 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, | |||
const GLuint transferOps = ctx->_ImageTransferState; | |||
struct sw_span span; | |||
INIT_SPAN(span); | |||
span.arrayMask |= SPAN_RGBA; | |||
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); | |||
/*span.arrayMask |= SPAN_RGBA;*/ | |||
if (ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) { | |||
copy_conv_rgba_pixels(ctx, srcx, srcy, width, height, destx, desty); | |||
@@ -523,7 +523,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, | |||
span.x = destx; | |||
span.y = dy; | |||
span.end = width; | |||
_mesa_write_rgba_span(ctx, &span, GL_BITMAP); | |||
_mesa_write_rgba_span(ctx, &span); | |||
} | |||
} | |||
@@ -550,8 +550,8 @@ static void copy_ci_pixels( GLcontext *ctx, | |||
GLint overlapping; | |||
struct sw_span span; | |||
INIT_SPAN(span); | |||
span.arrayMask |= SPAN_INDEX; | |||
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_INDEX); | |||
/*span.arrayMask |= SPAN_INDEX;*/ | |||
/* Determine if copy should be bottom-to-top or top-to-bottom */ | |||
if (srcy<desty) { | |||
@@ -638,7 +638,7 @@ static void copy_ci_pixels( GLcontext *ctx, | |||
if (zoom) | |||
_mesa_write_zoomed_index_span(ctx, &span, desty); | |||
else | |||
_mesa_write_index_span(ctx, &span, GL_BITMAP); | |||
_mesa_write_index_span(ctx, &span); | |||
} | |||
/* Restore pixel source to be the draw buffer (for blending, etc) */ | |||
@@ -666,8 +666,8 @@ static void copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy, | |||
GLint overlapping; | |||
struct sw_span span; | |||
INIT_SPAN(span); | |||
span.arrayMask |= SPAN_Z; | |||
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_Z); | |||
/*span.arrayMask |= SPAN_Z;*/ | |||
if (!ctx->Visual.depthBits) { | |||
_mesa_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" ); | |||
@@ -737,13 +737,13 @@ static void copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy, | |||
(const GLchan (*)[4])span.color.rgba, | |||
desty ); | |||
else | |||
_mesa_write_rgba_span(ctx, &span, GL_BITMAP); | |||
_mesa_write_rgba_span(ctx, &span); | |||
} | |||
else { | |||
if (zoom) | |||
_mesa_write_zoomed_index_span( ctx, &span, desty ); | |||
else | |||
_mesa_write_index_span(ctx, &span, GL_BITMAP); | |||
_mesa_write_index_span(ctx, &span); | |||
} | |||
} | |||
@@ -1,4 +1,4 @@ | |||
/* $Id: s_depth.c,v 1.19 2002/03/19 16:47:05 brianp Exp $ */ | |||
/* $Id: s_depth.c,v 1.20 2002/04/12 15:39:59 brianp Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -567,8 +567,18 @@ depth_test_span( GLcontext *ctx, struct sw_span *span) | |||
GLuint *zptr = (GLuint *) Z_ADDRESS32(ctx, x, y); | |||
passed = depth_test_span32(ctx, n, zptr, span->zArray, span->mask); | |||
} | |||
if (passed < span->end) | |||
span->writeAll = GL_FALSE; | |||
#if 0 | |||
/* this causes a glDrawPixels(GL_DEPTH_COMPONENT) conformance failure */ | |||
if (passed < span->end) { | |||
span->writeAll = GL_FALSE; | |||
if (passed == 0) { | |||
span->end = 0; | |||
return 0; | |||
} | |||
while (span->end > 0 && span->mask[span->end - 1] == 0) | |||
span->end --; | |||
} | |||
#endif | |||
return passed; | |||
} | |||
} |
@@ -1,4 +1,4 @@ | |||
/* $Id: s_drawpix.c,v 1.31 2002/02/17 17:30:23 brianp Exp $ */ | |||
/* $Id: s_drawpix.c,v 1.32 2002/04/12 15:39:59 brianp Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -104,8 +104,8 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, | |||
const struct gl_pixelstore_attrib *unpack = &ctx->Unpack; | |||
struct sw_span span; | |||
INIT_SPAN(span); | |||
span.arrayMask |= SPAN_RGBA; | |||
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); | |||
/*span.arrayMask |= SPAN_RGBA;*/ | |||
if (!ctx->Current.RasterPosValid) { | |||
return GL_TRUE; /* no-op */ | |||
@@ -511,8 +511,8 @@ draw_index_pixels( GLcontext *ctx, GLint x, GLint y, | |||
GLint row, drawWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width; | |||
struct sw_span span; | |||
INIT_SPAN(span); | |||
span.arrayMask |= SPAN_INDEX; | |||
INIT_SPAN(span, GL_BITMAP, drawWidth, 0, SPAN_INDEX); | |||
/*span.arrayMask |= SPAN_INDEX;*/ | |||
if (ctx->Depth.Test) | |||
_mesa_span_default_z(ctx, &span); | |||
@@ -535,7 +535,7 @@ draw_index_pixels( GLcontext *ctx, GLint x, GLint y, | |||
if (zoom) | |||
_mesa_write_zoomed_index_span(ctx, &span, desty); | |||
else | |||
_mesa_write_index_span(ctx, &span, GL_BITMAP); | |||
_mesa_write_index_span(ctx, &span); | |||
} | |||
} | |||
@@ -614,9 +614,9 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, | |||
GLint drawWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width; | |||
struct sw_span span; | |||
INIT_SPAN(span); | |||
span.arrayMask |= SPAN_Z; | |||
span.end = drawWidth; | |||
INIT_SPAN(span, GL_BITMAP, drawWidth, 0, SPAN_Z); | |||
/*span.arrayMask |= SPAN_Z; | |||
span.end = drawWidth;*/ | |||
if (type != GL_BYTE | |||
&& type != GL_UNSIGNED_BYTE | |||
@@ -648,7 +648,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, | |||
GLint i; | |||
for (i = 0; i < drawWidth; i++) | |||
span.zArray[i] = zptr[i]; | |||
_mesa_write_rgba_span(ctx, &span, GL_BITMAP); | |||
_mesa_write_rgba_span(ctx, &span); | |||
} | |||
} | |||
else if (type==GL_UNSIGNED_INT && ctx->Visual.depthBits == 32 | |||
@@ -663,7 +663,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, | |||
_mesa_image_address(&ctx->Unpack, pixels, width, height, | |||
GL_DEPTH_COMPONENT, type, 0, row, 0); | |||
MEMCPY(span.zArray, zptr, drawWidth * sizeof(GLdepth)); | |||
_mesa_write_rgba_span(ctx, &span, GL_BITMAP); | |||
_mesa_write_rgba_span(ctx, &span); | |||
} | |||
} | |||
else { | |||
@@ -691,13 +691,13 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, | |||
_mesa_write_zoomed_rgba_span(ctx, &span, | |||
(const GLchan (*)[4]) span.color.rgba, desty); | |||
else | |||
_mesa_write_rgba_span(ctx, &span, GL_BITMAP); | |||
_mesa_write_rgba_span(ctx, &span); | |||
} | |||
else { | |||
if (zoom) | |||
_mesa_write_zoomed_index_span(ctx, &span, desty); | |||
else | |||
_mesa_write_index_span(ctx, &span, GL_BITMAP); | |||
_mesa_write_index_span(ctx, &span); | |||
} | |||
} | |||
} | |||
@@ -721,8 +721,8 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, | |||
GLuint transferOps = ctx->_ImageTransferState; | |||
struct sw_span span; | |||
INIT_SPAN(span); | |||
span.arrayMask |= SPAN_RGBA; | |||
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); | |||
/*span.arrayMask |= SPAN_RGBA;*/ | |||
if (!_mesa_is_legal_format_and_type(format, type)) { | |||
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawPixels(format or type)"); | |||
@@ -838,7 +838,7 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, | |||
span.x = x; | |||
span.y = y; | |||
span.end = width; | |||
_mesa_write_rgba_span(ctx, &span, GL_BITMAP); | |||
_mesa_write_rgba_span(ctx, &span); | |||
} | |||
} | |||
} |
@@ -1,4 +1,4 @@ | |||
/* $Id: s_lines.c,v 1.26 2002/02/15 03:39:37 brianp Exp $ */ | |||
/* $Id: s_lines.c,v 1.27 2002/04/12 15:39:59 brianp Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -88,11 +88,11 @@ draw_wide_line( GLcontext *ctx, struct sw_span *span, GLboolean xMajor ) | |||
span->yArray[i]++; | |||
} | |||
if ((span->interpMask | span->arrayMask) & SPAN_TEXTURE) | |||
_mesa_write_texture_span(ctx, span, GL_LINE); | |||
_mesa_write_texture_span(ctx, span); | |||
else if ((span->interpMask | span->arrayMask) & SPAN_RGBA) | |||
_mesa_write_rgba_span(ctx, span, GL_LINE); | |||
_mesa_write_rgba_span(ctx, span); | |||
else | |||
_mesa_write_index_span(ctx, span, GL_LINE); | |||
_mesa_write_index_span(ctx, span); | |||
} | |||
} | |||
else { | |||
@@ -107,11 +107,11 @@ draw_wide_line( GLcontext *ctx, struct sw_span *span, GLboolean xMajor ) | |||
span->xArray[i]++; | |||
} | |||
if ((span->interpMask | span->arrayMask) & SPAN_TEXTURE) | |||
_mesa_write_texture_span(ctx, span, GL_LINE); | |||
_mesa_write_texture_span(ctx, span); | |||
else if ((span->interpMask | span->arrayMask) & SPAN_RGBA) | |||
_mesa_write_rgba_span(ctx, span, GL_LINE); | |||
_mesa_write_rgba_span(ctx, span); | |||
else | |||
_mesa_write_index_span(ctx, span, GL_LINE); | |||
_mesa_write_index_span(ctx, span); | |||
} | |||
} | |||
} | |||
@@ -134,9 +134,9 @@ static void flat_ci_line( GLcontext *ctx, | |||
ASSERT(!ctx->Line.StippleFlag); | |||
ASSERT(ctx->Line.Width == 1.0F); | |||
INIT_SPAN(span); | |||
span.arrayMask |= SPAN_XY; | |||
span.interpMask |= SPAN_INDEX; | |||
INIT_SPAN(span, GL_LINE, 0, SPAN_INDEX, SPAN_XY); | |||
/*span.arrayMask |= SPAN_XY; | |||
span.interpMask |= SPAN_INDEX;*/ | |||
span.index = IntToFixed(vert1->index); | |||
span.indexStep = 0; | |||
@@ -150,7 +150,7 @@ static void flat_ci_line( GLcontext *ctx, | |||
#include "s_linetemp.h" | |||
_mesa_write_index_span(ctx, &span, GL_LINE); | |||
_mesa_write_index_span(ctx, &span); | |||
} | |||
@@ -165,9 +165,9 @@ static void flat_rgba_line( GLcontext *ctx, | |||
ASSERT(!ctx->Line.StippleFlag); | |||
ASSERT(ctx->Line.Width == 1.0F); | |||
INIT_SPAN(span); | |||
span.arrayMask |= SPAN_XY; | |||
span.interpMask |= SPAN_RGBA; | |||
INIT_SPAN(span, GL_LINE, 0, SPAN_RGBA, SPAN_XY); | |||
/*span.arrayMask |= SPAN_XY; | |||
span.interpMask |= SPAN_RGBA;*/ | |||
span.red = ChanToFixed(vert1->color[0]); | |||
span.green = ChanToFixed(vert1->color[1]); | |||
span.blue = ChanToFixed(vert1->color[2]); | |||
@@ -187,7 +187,7 @@ static void flat_rgba_line( GLcontext *ctx, | |||
#include "s_linetemp.h" | |||
_mesa_write_rgba_span(ctx, &span, GL_LINE); | |||
_mesa_write_rgba_span(ctx, &span); | |||
} | |||
@@ -202,8 +202,8 @@ static void smooth_ci_line( GLcontext *ctx, | |||
ASSERT(!ctx->Line.StippleFlag); | |||
ASSERT(ctx->Line.Width == 1.0F); | |||
INIT_SPAN(span); | |||
span.arrayMask |= (SPAN_XY | SPAN_INDEX); | |||
INIT_SPAN(span, GL_LINE, 0, 0, SPAN_XY | SPAN_INDEX); | |||
/*span.arrayMask |= (SPAN_XY | SPAN_INDEX);*/ | |||
#define INTERP_XY 1 | |||
#define INTERP_INDEX 1 | |||
@@ -217,7 +217,7 @@ static void smooth_ci_line( GLcontext *ctx, | |||
#include "s_linetemp.h" | |||
_mesa_write_index_span(ctx, &span, GL_LINE); | |||
_mesa_write_index_span(ctx, &span); | |||
} | |||
@@ -232,8 +232,8 @@ static void smooth_rgba_line( GLcontext *ctx, | |||
ASSERT(!ctx->Line.StippleFlag); | |||
ASSERT(ctx->Line.Width == 1.0F); | |||
INIT_SPAN(span); | |||
span.arrayMask |= (SPAN_XY | SPAN_RGBA); | |||
INIT_SPAN(span, GL_LINE, 0, 0, SPAN_XY | SPAN_RGBA); | |||
/*span.arrayMask |= (SPAN_XY | SPAN_RGBA);*/ | |||
#define INTERP_XY 1 | |||
#define INTERP_RGB 1 | |||
@@ -251,7 +251,7 @@ static void smooth_rgba_line( GLcontext *ctx, | |||
#include "s_linetemp.h" | |||
_mesa_write_rgba_span(ctx, &span, GL_LINE); | |||
_mesa_write_rgba_span(ctx, &span); | |||
} | |||
@@ -265,8 +265,9 @@ static void general_smooth_ci_line( GLcontext *ctx, | |||
ASSERT(ctx->Light.ShadeModel == GL_SMOOTH); | |||
INIT_SPAN(span); | |||
span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_INDEX); | |||
INIT_SPAN(span, GL_LINE, 0, 0, | |||
SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_INDEX); | |||
/*span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_INDEX);*/ | |||
#define SET_XMAJOR 1 | |||
#define INTERP_XY 1 | |||
@@ -293,7 +294,7 @@ static void general_smooth_ci_line( GLcontext *ctx, | |||
draw_wide_line(ctx, &span, xMajor); | |||
} | |||
else { | |||
_mesa_write_index_span(ctx, &span, GL_LINE); | |||
_mesa_write_index_span(ctx, &span); | |||
} | |||
} | |||
@@ -308,9 +309,10 @@ static void general_flat_ci_line( GLcontext *ctx, | |||
ASSERT(ctx->Light.ShadeModel == GL_FLAT); | |||
INIT_SPAN(span); | |||
span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG); | |||
span.interpMask |= SPAN_INDEX; | |||
INIT_SPAN(span, GL_LINE, 0, SPAN_INDEX, | |||
SPAN_XY | SPAN_Z | SPAN_FOG); | |||
/*span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG); | |||
span.interpMask |= SPAN_INDEX;*/ | |||
span.index = IntToFixed(vert1->index); | |||
span.indexStep = 0; | |||
@@ -337,7 +339,7 @@ static void general_flat_ci_line( GLcontext *ctx, | |||
draw_wide_line(ctx, &span, xMajor); | |||
} | |||
else { | |||
_mesa_write_index_span(ctx, &span, GL_LINE); | |||
_mesa_write_index_span(ctx, &span); | |||
} | |||
} | |||
@@ -352,8 +354,9 @@ static void general_smooth_rgba_line( GLcontext *ctx, | |||
ASSERT(ctx->Light.ShadeModel == GL_SMOOTH); | |||
INIT_SPAN(span); | |||
span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA); | |||
INIT_SPAN(span, GL_LINE, 0, 0, | |||
SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA); | |||
/*span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA);*/ | |||
#define SET_XMAJOR 1 | |||
#define INTERP_XY 1 | |||
@@ -384,7 +387,7 @@ static void general_smooth_rgba_line( GLcontext *ctx, | |||
draw_wide_line(ctx, &span, xMajor); | |||
} | |||
else { | |||
_mesa_write_rgba_span(ctx, &span, GL_LINE); | |||
_mesa_write_rgba_span(ctx, &span); | |||
} | |||
} | |||
@@ -398,9 +401,10 @@ static void general_flat_rgba_line( GLcontext *ctx, | |||
ASSERT(ctx->Light.ShadeModel == GL_FLAT); | |||
INIT_SPAN(span); | |||
span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG); | |||
span.interpMask |= SPAN_RGBA; | |||
INIT_SPAN(span, GL_LINE, 0, SPAN_RGBA, | |||
SPAN_XY | SPAN_Z | SPAN_FOG); | |||
/*span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG); | |||
span.interpMask |= SPAN_RGBA;*/ | |||
span.red = ChanToFixed(vert1->color[0]); | |||
span.green = ChanToFixed(vert1->color[1]); | |||
span.blue = ChanToFixed(vert1->color[2]); | |||
@@ -433,7 +437,7 @@ static void general_flat_rgba_line( GLcontext *ctx, | |||
draw_wide_line(ctx, &span, xMajor); | |||
} | |||
else { | |||
_mesa_write_rgba_span(ctx, &span, GL_LINE); | |||
_mesa_write_rgba_span(ctx, &span); | |||
} | |||
} | |||
@@ -448,9 +452,10 @@ static void flat_textured_line( GLcontext *ctx, | |||
ASSERT(ctx->Light.ShadeModel == GL_FLAT); | |||
INIT_SPAN(span); | |||
span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_TEXTURE | SPAN_LAMBDA); | |||
span.interpMask |= (SPAN_RGBA | SPAN_SPEC); | |||
INIT_SPAN(span, GL_LINE, 0, SPAN_RGBA | SPAN_SPEC, | |||
SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_TEXTURE | SPAN_RGBA); | |||
/*span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_TEXTURE | SPAN_LAMBDA); | |||
span.interpMask |= (SPAN_RGBA | SPAN_SPEC);*/ | |||
span.red = ChanToFixed(vert1->color[0]); | |||
span.green = ChanToFixed(vert1->color[1]); | |||
span.blue = ChanToFixed(vert1->color[2]); | |||
@@ -494,7 +499,7 @@ static void flat_textured_line( GLcontext *ctx, | |||
draw_wide_line(ctx, &span, xMajor); | |||
} | |||
else { | |||
_mesa_write_texture_span(ctx, &span, GL_LINE); | |||
_mesa_write_texture_span(ctx, &span); | |||
} | |||
} | |||
@@ -510,8 +515,9 @@ static void smooth_textured_line( GLcontext *ctx, | |||
ASSERT(ctx->Light.ShadeModel == GL_SMOOTH); | |||
INIT_SPAN(span); | |||
span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA | SPAN_TEXTURE | SPAN_LAMBDA); | |||
INIT_SPAN(span, GL_LINE, 0, 0, | |||
SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA | SPAN_TEXTURE | SPAN_LAMBDA); | |||
/*span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA | SPAN_TEXTURE | SPAN_LAMBDA);*/ | |||
#define SET_XMAJOR 1 | |||
#define INTERP_XY 1 | |||
@@ -547,7 +553,7 @@ static void smooth_textured_line( GLcontext *ctx, | |||
draw_wide_line(ctx, &span, xMajor); | |||
} | |||
else { | |||
_mesa_write_texture_span(ctx, &span, GL_LINE); | |||
_mesa_write_texture_span(ctx, &span); | |||
} | |||
} | |||
@@ -565,8 +571,9 @@ static void smooth_multitextured_line( GLcontext *ctx, | |||
ASSERT(ctx->Light.ShadeModel == GL_SMOOTH); | |||
INIT_SPAN(span); | |||
span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA | SPAN_SPEC | SPAN_TEXTURE | SPAN_LAMBDA); | |||
INIT_SPAN(span, GL_LINE, 0, 0, | |||
SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA | SPAN_SPEC | SPAN_TEXTURE | SPAN_LAMBDA); | |||
/*span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA | SPAN_SPEC | SPAN_TEXTURE | SPAN_LAMBDA);*/ | |||
#define SET_XMAJOR 1 | |||
#define INTERP_XY 1 | |||
@@ -610,7 +617,7 @@ static void smooth_multitextured_line( GLcontext *ctx, | |||
draw_wide_line(ctx, &span, xMajor); | |||
} | |||
else { | |||
_mesa_write_texture_span(ctx, &span, GL_LINE); | |||
_mesa_write_texture_span(ctx, &span); | |||
} | |||
} | |||
@@ -628,9 +635,10 @@ static void flat_multitextured_line( GLcontext *ctx, | |||
ASSERT(ctx->Light.ShadeModel == GL_FLAT); | |||
INIT_SPAN(span); | |||
span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_TEXTURE | SPAN_LAMBDA); | |||
span.interpMask |= (SPAN_RGBA | SPAN_SPEC); | |||
INIT_SPAN(span, GL_LINE, 0, SPAN_RGBA | SPAN_SPEC, | |||
SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_TEXTURE | SPAN_LAMBDA); | |||
/*span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_TEXTURE | SPAN_LAMBDA); | |||
span.interpMask |= (SPAN_RGBA | SPAN_SPEC);*/ | |||
span.red = ChanToFixed(vert1->color[0]); | |||
span.green = ChanToFixed(vert1->color[1]); | |||
span.blue = ChanToFixed(vert1->color[2]); | |||
@@ -678,7 +686,7 @@ static void flat_multitextured_line( GLcontext *ctx, | |||
draw_wide_line(ctx, &span, xMajor); | |||
} | |||
else { | |||
_mesa_write_texture_span(ctx, &span, GL_LINE); | |||
_mesa_write_texture_span(ctx, &span); | |||
} | |||
} | |||
@@ -1,4 +1,4 @@ | |||
/* $Id: s_pixeltex.c,v 1.7 2002/04/04 16:53:59 brianp Exp $ */ | |||
/* $Id: s_pixeltex.c,v 1.8 2002/04/12 15:39:59 brianp Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -97,6 +97,9 @@ _swrast_pixel_texture(GLcontext *ctx, struct sw_span *span) | |||
GLchan primary_rgba[MAX_WIDTH][4]; | |||
GLuint unit; | |||
ASSERT(!(span->arrayMask & SPAN_TEXTURE)); | |||
span->arrayMask |= SPAN_TEXTURE; | |||
MEMCPY(primary_rgba, span->color.rgba, 4 * span->end * sizeof(GLchan)); | |||
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { | |||
@@ -104,24 +107,25 @@ _swrast_pixel_texture(GLcontext *ctx, struct sw_span *span) | |||
pixeltexgen(ctx, span->end, | |||
(const GLchan (*)[4]) span->color.rgba, | |||
span->texcoords[unit]); | |||
_swrast_texture_fragments(ctx, unit, span->end, | |||
span->texcoords[unit], | |||
NULL, /* lambda */ | |||
(CONST GLchan (*)[4]) primary_rgba, | |||
span->color.rgba); | |||
_swrast_texture_fragments(ctx, unit, span, | |||
(CONST GLchan (*)[4]) primary_rgba); | |||
} | |||
} | |||
/* this is a work-around to be fixed by initializing again span */ | |||
span->arrayMask &= ~SPAN_TEXTURE; | |||
} | |||
else { | |||
/* single texture, unit 0 */ | |||
ASSERT(ctx->Texture._ReallyEnabled & TEXTURE0_ANY); | |||
ASSERT(!(span->arrayMask & SPAN_TEXTURE)); | |||
span->arrayMask |= SPAN_TEXTURE; | |||
pixeltexgen(ctx, span->end, | |||
(const GLchan (*)[4]) span->color.rgba, | |||
span->texcoords[0]); | |||
_swrast_texture_fragments(ctx, 0, span->end, | |||
span->texcoords[0], | |||
NULL, /* lambda */ | |||
(CONST GLchan (*)[4]) span->color.rgba, | |||
(GLchan (*)[4]) span->color.rgba); | |||
_swrast_texture_fragments(ctx, 0, span, | |||
(CONST GLchan (*)[4]) span->color.rgba); | |||
/* this is a work-around to be fixed */ | |||
span->arrayMask &= ~SPAN_TEXTURE; | |||
} | |||
} |
@@ -1,4 +1,4 @@ | |||
/* $Id: s_pointtemp.h,v 1.13 2002/03/16 18:02:08 brianp Exp $ */ | |||
/* $Id: s_pointtemp.h,v 1.14 2002/04/12 15:39:59 brianp Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -87,10 +87,10 @@ NAME ( GLcontext *ctx, const SWvertex *vert ) | |||
return; | |||
} | |||
INIT_SPAN(span); | |||
INIT_SPAN(span, GL_POINT, 0, SPAN_FOG, SPAN_XY | SPAN_Z); | |||
span.arrayMask |= (SPAN_XY | SPAN_Z); | |||
span.interpMask |= SPAN_FOG; | |||
/*span.arrayMask |= (SPAN_XY | SPAN_Z); | |||
span.interpMask |= SPAN_FOG;*/ | |||
span.fog = vert->fog; | |||
span.fogStep = 0.0; | |||
@@ -314,13 +314,13 @@ NAME ( GLcontext *ctx, const SWvertex *vert ) | |||
#if FLAGS & TEXTURE | |||
if (ctx->Texture._ReallyEnabled) | |||
_mesa_write_texture_span(ctx, &span, GL_POINT); | |||
_mesa_write_texture_span(ctx, &span); | |||
else | |||
_mesa_write_rgba_span(ctx, &span, GL_POINT); | |||
_mesa_write_rgba_span(ctx, &span); | |||
#elif FLAGS & RGBA | |||
_mesa_write_rgba_span(ctx, &span, GL_POINT); | |||
_mesa_write_rgba_span(ctx, &span); | |||
#else | |||
_mesa_write_index_span(ctx, &span, GL_POINT); | |||
_mesa_write_index_span(ctx, &span); | |||
#endif | |||
} | |||
@@ -1,4 +1,4 @@ | |||
/* $Id: s_span.c,v 1.37 2002/03/16 18:02:08 brianp Exp $ */ | |||
/* $Id: s_span.c,v 1.38 2002/04/12 15:39:59 brianp Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -135,7 +135,8 @@ interpolate_colors(GLcontext *ctx, struct sw_span *span) | |||
GLchan (*rgba)[4] = span->color.rgba; | |||
GLuint i; | |||
ASSERT(span->interpMask & SPAN_RGBA); | |||
ASSERT((span->interpMask & SPAN_RGBA) && | |||
!(span->arrayMask & SPAN_RGBA)); | |||
if (span->interpMask & SPAN_FLAT) { | |||
/* constant color */ | |||
@@ -174,7 +175,8 @@ interpolate_indexes(GLcontext *ctx, struct sw_span *span) | |||
const GLuint n = span->end; | |||
GLuint *indexes = span->color.index; | |||
GLuint i; | |||
ASSERT(span->interpMask & SPAN_INDEX); | |||
ASSERT((span->interpMask & SPAN_INDEX) && | |||
!(span->arrayMask & SPAN_INDEX)); | |||
if ((span->interpMask & SPAN_FLAT) || (indexStep == 0)) { | |||
/* constant color */ | |||
@@ -242,7 +244,8 @@ _mesa_span_interpolate_z( const GLcontext *ctx, struct sw_span *span ) | |||
const GLuint n = span->end; | |||
GLuint i; | |||
ASSERT(span->interpMask & SPAN_Z); | |||
ASSERT((span->interpMask & SPAN_Z) && | |||
!(span->arrayMask & SPAN_Z)); | |||
if (ctx->Visual.depthBits <= 16) { | |||
GLfixed zval = span->z; | |||
@@ -318,10 +321,12 @@ static void | |||
interpolate_texcoords(GLcontext *ctx, struct sw_span *span) | |||
{ | |||
ASSERT(span->interpMask & SPAN_TEXTURE); | |||
ASSERT(!(span->arrayMask & SPAN_TEXTURE)); | |||
if (ctx->Texture._ReallyEnabled & ~TEXTURE0_ANY) { | |||
/* multitexture */ | |||
GLuint u; | |||
span->arrayMask |= SPAN_TEXTURE; | |||
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { | |||
if (ctx->Texture.Unit[u]._ReallyEnabled) { | |||
const struct gl_texture_object *obj =ctx->Texture.Unit[u]._Current; | |||
@@ -402,6 +407,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span) | |||
const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current; | |||
const struct gl_texture_image *img = obj->Image[obj->BaseLevel]; | |||
GLboolean needLambda = (obj->MinFilter != obj->MagFilter); | |||
span->arrayMask |= SPAN_TEXTURE; | |||
if (needLambda) { | |||
/* just texture unit 0, with lambda */ | |||
const GLfloat texW = (GLfloat) img->Width; | |||
@@ -717,14 +723,15 @@ multi_write_rgba_span( GLcontext *ctx, struct sw_span *span ) | |||
* to their original values before returning. | |||
*/ | |||
void | |||
_mesa_write_index_span( GLcontext *ctx, struct sw_span *span, | |||
GLenum primitive) | |||
_mesa_write_index_span( GLcontext *ctx, struct sw_span *span) | |||
{ | |||
SWcontext *swrast = SWRAST_CONTEXT(ctx); | |||
const GLuint origInterpMask = span->interpMask; | |||
const GLuint origArrayMask = span->arrayMask; | |||
ASSERT(span->end <= MAX_WIDTH); | |||
ASSERT(span->primitive == GL_POINT || span->primitive == GL_LINE || | |||
span->primitive == GL_POLYGON || span->primitive == GL_BITMAP); | |||
ASSERT((span->interpMask | span->arrayMask) & SPAN_INDEX); | |||
ASSERT((span->interpMask & span->arrayMask) == 0); | |||
@@ -738,8 +745,7 @@ _mesa_write_index_span( GLcontext *ctx, struct sw_span *span, | |||
} | |||
/* Clipping */ | |||
if ((swrast->_RasterMask & CLIP_BIT) || (primitive == GL_BITMAP) | |||
|| (primitive == GL_POINT) || (primitive == GL_LINE)) { | |||
if ((swrast->_RasterMask & CLIP_BIT) || (span->primitive != GL_POLYGON)) { | |||
if (!clip_span(ctx, span)) { | |||
return; | |||
} | |||
@@ -760,7 +766,7 @@ _mesa_write_index_span( GLcontext *ctx, struct sw_span *span, | |||
#endif | |||
/* Polygon Stippling */ | |||
if (ctx->Polygon.StippleFlag && primitive == GL_POLYGON) { | |||
if (ctx->Polygon.StippleFlag && span->primitive == GL_POLYGON) { | |||
stipple_polygon_span(ctx, span); | |||
} | |||
@@ -872,8 +878,7 @@ _mesa_write_index_span( GLcontext *ctx, struct sw_span *span, | |||
* to their original values before returning. | |||
*/ | |||
void | |||
_mesa_write_rgba_span( GLcontext *ctx, struct sw_span *span, | |||
GLenum primitive) | |||
_mesa_write_rgba_span( GLcontext *ctx, struct sw_span *span) | |||
{ | |||
SWcontext *swrast = SWRAST_CONTEXT(ctx); | |||
const GLuint colorMask = *((GLuint *) ctx->Color.ColorMask); | |||
@@ -882,6 +887,8 @@ _mesa_write_rgba_span( GLcontext *ctx, struct sw_span *span, | |||
GLboolean monoColor; | |||
ASSERT(span->end <= MAX_WIDTH); | |||
ASSERT(span->primitive == GL_POINT || span->primitive == GL_LINE || | |||
span->primitive == GL_POLYGON || span->primitive == GL_BITMAP); | |||
ASSERT((span->interpMask & span->arrayMask) == 0); | |||
ASSERT((span->interpMask | span->arrayMask) & SPAN_RGBA); | |||
#ifdef DEBUG | |||
@@ -892,7 +899,7 @@ _mesa_write_rgba_span( GLcontext *ctx, struct sw_span *span, | |||
#endif | |||
/* | |||
printf("%s() interp 0x%x array 0x%x p=0x%x\n", __FUNCTION__, span->interpMask, span->arrayMask, primitive); | |||
printf("%s() interp 0x%x array 0x%x p=0x%x\n", __FUNCTION__, span->interpMask, span->arrayMask, span->primitive); | |||
*/ | |||
if (span->arrayMask & SPAN_MASK) { | |||
@@ -910,8 +917,7 @@ _mesa_write_rgba_span( GLcontext *ctx, struct sw_span *span, | |||
span->blueStep == 0 && span->alphaStep == 0; | |||
/* Clipping */ | |||
if ((swrast->_RasterMask & CLIP_BIT) || (primitive == GL_BITMAP) | |||
|| (primitive == GL_POINT) || (primitive == GL_LINE)) { | |||
if ((swrast->_RasterMask & CLIP_BIT) || (span->primitive != GL_POLYGON)) { | |||
if (!clip_span(ctx, span)) { | |||
return; | |||
} | |||
@@ -932,7 +938,7 @@ _mesa_write_rgba_span( GLcontext *ctx, struct sw_span *span, | |||
#endif | |||
/* Polygon Stippling */ | |||
if (ctx->Polygon.StippleFlag && primitive == GL_POLYGON) { | |||
if (ctx->Polygon.StippleFlag && span->primitive == GL_POLYGON) { | |||
stipple_polygon_span(ctx, span); | |||
} | |||
@@ -1099,13 +1105,14 @@ add_colors(GLuint n, GLchan rgba[][4], GLchan specular[][4] ) | |||
* to their original values before returning. | |||
*/ | |||
void | |||
_mesa_write_texture_span( GLcontext *ctx, struct sw_span *span, | |||
GLenum primitive ) | |||
_mesa_write_texture_span( GLcontext *ctx, struct sw_span *span) | |||
{ | |||
const GLuint colorMask = *((GLuint *) ctx->Color.ColorMask); | |||
SWcontext *swrast = SWRAST_CONTEXT(ctx); | |||
const GLuint origArrayMask = span->arrayMask; | |||
ASSERT(span->primitive == GL_POINT || span->primitive == GL_LINE || | |||
span->primitive == GL_POLYGON || span->primitive == GL_BITMAP); | |||
ASSERT(span->end <= MAX_WIDTH); | |||
ASSERT((span->interpMask & span->arrayMask) == 0); | |||
ASSERT(ctx->Texture._ReallyEnabled); | |||
@@ -1124,8 +1131,7 @@ _mesa_write_texture_span( GLcontext *ctx, struct sw_span *span, | |||
} | |||
/* Clipping */ | |||
if ((swrast->_RasterMask & CLIP_BIT) || (primitive == GL_BITMAP) | |||
|| (primitive == GL_POINT) || (primitive == GL_LINE)) { | |||
if ((swrast->_RasterMask & CLIP_BIT) || (span->primitive != GL_POLYGON)) { | |||
if (!clip_span(ctx, span)) { | |||
return; | |||
} | |||
@@ -1146,7 +1152,7 @@ _mesa_write_texture_span( GLcontext *ctx, struct sw_span *span, | |||
#endif | |||
/* Polygon Stippling */ | |||
if (ctx->Polygon.StippleFlag && primitive == GL_POLYGON) { | |||
if (ctx->Polygon.StippleFlag && span->primitive == GL_POLYGON) { | |||
stipple_polygon_span(ctx, span); | |||
} | |||
@@ -1,4 +1,4 @@ | |||
/* $Id: s_span.h,v 1.15 2002/02/17 17:30:58 brianp Exp $ */ | |||
/* $Id: s_span.h,v 1.16 2002/04/12 15:39:59 brianp Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -47,16 +47,15 @@ _mesa_span_default_color( GLcontext *ctx, struct sw_span *span ); | |||
extern void | |||
_mesa_write_index_span( GLcontext *ctx, struct sw_span *span, | |||
GLenum primitive); | |||
_mesa_write_index_span( GLcontext *ctx, struct sw_span *span); | |||
extern void | |||
_mesa_write_rgba_span( GLcontext *ctx, struct sw_span *span, | |||
GLenum primitive); | |||
_mesa_write_rgba_span( GLcontext *ctx, struct sw_span *span); | |||
extern void | |||
_mesa_write_texture_span( GLcontext *ctx, struct sw_span *span, | |||
GLenum primitive ); | |||
_mesa_write_texture_span( GLcontext *ctx, struct sw_span *span); | |||
extern void |
@@ -1,4 +1,4 @@ | |||
/* $Id: s_texture.c,v 1.58 2002/04/04 16:56:24 brianp Exp $ */ | |||
/* $Id: s_texture.c,v 1.59 2002/04/12 15:39:59 brianp Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -3329,26 +3329,30 @@ apply_texture( const GLcontext *ctx, | |||
* Apply a unit of texture mapping to the incoming fragments. | |||
*/ | |||
void | |||
_swrast_texture_fragments( GLcontext *ctx, GLuint texUnit, GLuint n, | |||
GLfloat texcoords[][4], GLfloat lambda[], | |||
CONST GLchan primary_rgba[][4], | |||
GLchan rgba[][4] ) | |||
_swrast_texture_fragments( GLcontext *ctx, GLuint texUnit, | |||
struct sw_span *span, | |||
CONST GLchan primary_rgba[][4]) | |||
{ | |||
const GLuint mask = TEXTURE0_ANY << (texUnit * 4); | |||
GLfloat (*texcoords)[4] = span->texcoords[texUnit]; | |||
GLfloat *lambda = span->lambda[texUnit]; | |||
if (ctx->Texture._ReallyEnabled & mask) { | |||
const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit]; | |||
ASSERT(span->arrayMask & SPAN_TEXTURE); | |||
if (textureUnit->_Current) { /* XXX need this? */ | |||
const struct gl_texture_object *curObj = textureUnit->_Current; | |||
GLchan texel[MAX_WIDTH][4]; | |||
if (lambda) { | |||
if (span->arrayMask | SPAN_LAMBDA) { | |||
#if 0 | |||
float min, max; | |||
int i; | |||
min = max = lambda[0]; | |||
for (i = 1; i < n; i++) { | |||
for (i = 1; i < span->end; i++) { | |||
if (lambda[i] > max) | |||
max = lambda[i]; | |||
if (lambda[i] < min) | |||
@@ -3359,7 +3363,7 @@ _swrast_texture_fragments( GLcontext *ctx, GLuint texUnit, GLuint n, | |||
if (textureUnit->LodBias != 0.0F) { | |||
/* apply LOD bias, but don't clamp yet */ | |||
GLuint i; | |||
for (i=0;i<n;i++) { | |||
for (i=0;i<span->end;i++) { | |||
lambda[i] += textureUnit->LodBias; | |||
} | |||
} | |||
@@ -3369,7 +3373,7 @@ _swrast_texture_fragments( GLcontext *ctx, GLuint texUnit, GLuint n, | |||
const GLfloat min = curObj->MinLod; | |||
const GLfloat max = curObj->MaxLod; | |||
GLuint i; | |||
for (i=0;i<n;i++) { | |||
for (i=0;i<span->end;i++) { | |||
GLfloat l = lambda[i]; | |||
lambda[i] = CLAMP(l, min, max); | |||
} | |||
@@ -3379,11 +3383,11 @@ _swrast_texture_fragments( GLcontext *ctx, GLuint texUnit, GLuint n, | |||
/* Sample the texture for n fragments */ | |||
SWRAST_CONTEXT(ctx)->TextureSample[texUnit]( ctx, texUnit, | |||
textureUnit->_Current, | |||
n, texcoords, | |||
span->end, texcoords, | |||
lambda, texel ); | |||
apply_texture( ctx, textureUnit, n, primary_rgba, | |||
(const GLchan (*)[4]) texel, rgba ); | |||
apply_texture( ctx, textureUnit, span->end, primary_rgba, | |||
(const GLchan (*)[4]) texel, span->color.rgba ); | |||
} | |||
} | |||
} | |||
@@ -3405,6 +3409,7 @@ _swrast_multitexture_fragments( GLcontext *ctx, struct sw_span *span ) | |||
GLuint unit; | |||
ASSERT(span->end < MAX_WIDTH); | |||
ASSERT(span->arrayMask & SPAN_TEXTURE); | |||
/* save copy of the span colors (the GL_PRIMARY_COLOR) */ | |||
MEMCPY(primary_rgba, span->color.rgba, 4 * span->end * sizeof(GLchan)); | |||
@@ -3412,12 +3417,8 @@ _swrast_multitexture_fragments( GLcontext *ctx, struct sw_span *span ) | |||
/* loop over texture units, modifying the span->color.rgba values */ | |||
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { | |||
if (ctx->Texture.Unit[unit]._ReallyEnabled) { | |||
_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 ); | |||
_swrast_texture_fragments( ctx, unit, span, | |||
(CONST GLchan (*)[4]) primary_rgba); | |||
} | |||
} | |||
} | |||
@@ -3425,11 +3426,7 @@ _swrast_multitexture_fragments( GLcontext *ctx, struct sw_span *span ) | |||
/* Just unit 0 enabled */ | |||
ASSERT(ctx->Texture._ReallyEnabled & TEXTURE0_ANY); | |||
_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 ); | |||
_swrast_texture_fragments( ctx, 0, span, | |||
(CONST GLchan (*)[4]) span->color.rgba); | |||
} | |||
} |
@@ -1,4 +1,4 @@ | |||
/* $Id: s_texture.h,v 1.11 2002/01/28 04:25:56 brianp Exp $ */ | |||
/* $Id: s_texture.h,v 1.12 2002/04/12 15:39:59 brianp Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -38,11 +38,12 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, | |||
GLuint texUnit, | |||
const struct gl_texture_object *tObj ); | |||
extern void | |||
_swrast_texture_fragments( GLcontext *ctx, GLuint texSet, GLuint n, | |||
GLfloat texcoords[][4], GLfloat lambda[], | |||
CONST GLchan primary_rgba[][4], | |||
GLchan rgba[][4] ); | |||
_swrast_texture_fragments( GLcontext *ctx, GLuint texUnit, | |||
struct sw_span *span, | |||
CONST GLchan primary_rgba[][4]); | |||
extern void | |||
_swrast_multitexture_fragments( GLcontext *ctx, struct sw_span *span ); |
@@ -1,4 +1,4 @@ | |||
/* $Id: s_triangle.c,v 1.56 2002/03/25 17:24:43 brianp Exp $ */ | |||
/* $Id: s_triangle.c,v 1.57 2002/04/12 15:39:59 brianp Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -85,7 +85,7 @@ static void flat_ci_triangle( GLcontext *ctx, | |||
span.index = IntToFixed(v2->index); \ | |||
span.indexStep = 0; | |||
#define RENDER_SPAN( span ) _mesa_write_index_span(ctx, &span, GL_POLYGON ) | |||
#define RENDER_SPAN( span ) _mesa_write_index_span(ctx, &span); | |||
#include "s_tritemp.h" | |||
} | |||
@@ -104,7 +104,7 @@ static void smooth_ci_triangle( GLcontext *ctx, | |||
#define INTERP_FOG 1 | |||
#define INTERP_INDEX 1 | |||
#define RENDER_SPAN( span ) _mesa_write_index_span(ctx, &span, GL_POLYGON) | |||
#define RENDER_SPAN( span ) _mesa_write_index_span(ctx, &span); | |||
#include "s_tritemp.h" | |||
} | |||
@@ -136,7 +136,7 @@ static void flat_rgba_triangle( GLcontext *ctx, | |||
span.blueStep = 0; \ | |||
span.alphaStep = 0; | |||
#define RENDER_SPAN( span ) _mesa_write_rgba_span(ctx, &span, GL_POLYGON ) | |||
#define RENDER_SPAN( span ) _mesa_write_rgba_span(ctx, &span); | |||
#include "s_tritemp.h" | |||
} | |||
@@ -165,7 +165,7 @@ static void smooth_rgba_triangle( GLcontext *ctx, | |||
ASSERT(ctx->Light.ShadeModel==GL_SMOOTH); \ | |||
} | |||
#define RENDER_SPAN( span ) _mesa_write_rgba_span(ctx, &span, GL_POLYGON) | |||
#define RENDER_SPAN( span ) _mesa_write_rgba_span(ctx, &span); | |||
#include "s_tritemp.h" | |||
@@ -550,7 +550,7 @@ affine_span(GLcontext *ctx, struct sw_span *span, | |||
} | |||
span->interpMask &= ~SPAN_RGBA; | |||
ASSERT(span->arrayMask & SPAN_RGBA); | |||
_mesa_write_rgba_span(ctx, span, GL_POLYGON); | |||
_mesa_write_rgba_span(ctx, span); | |||
#undef SPAN_NEAREST | |||
#undef SPAN_LINEAR | |||
@@ -822,7 +822,7 @@ fast_persp_span(GLcontext *ctx, struct sw_span *span, | |||
} | |||
ASSERT(span->arrayMask & SPAN_RGBA); | |||
_mesa_write_rgba_span(ctx, span, GL_POLYGON); | |||
_mesa_write_rgba_span(ctx, span); | |||
#undef SPAN_NEAREST | |||
@@ -926,7 +926,7 @@ static void general_textured_triangle( GLcontext *ctx, | |||
#define INTERP_ALPHA 1 | |||
#define INTERP_TEX 1 | |||
#define RENDER_SPAN( span ) _mesa_write_texture_span(ctx, &span, GL_POLYGON); | |||
#define RENDER_SPAN( span ) _mesa_write_texture_span(ctx, &span); | |||
#include "s_tritemp.h" | |||
} | |||
@@ -953,7 +953,7 @@ multitextured_triangle( GLcontext *ctx, | |||
#define INTERP_SPEC 1 | |||
#define INTERP_MULTITEX 1 | |||
#define RENDER_SPAN( span ) _mesa_write_texture_span(ctx, &span, GL_POLYGON); | |||
#define RENDER_SPAN( span ) _mesa_write_texture_span(ctx, &span); | |||
#include "s_tritemp.h" | |||
@@ -1,4 +1,4 @@ | |||
/* $Id: s_tritemp.h,v 1.35 2002/03/16 18:02:08 brianp Exp $ */ | |||
/* $Id: s_tritemp.h,v 1.36 2002/04/12 15:39:59 brianp Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -120,7 +120,7 @@ | |||
struct sw_span span; | |||
INIT_SPAN(span); | |||
INIT_SPAN(span, GL_POLYGON, 0, 0, 0); | |||
#ifdef INTERP_Z | |||
(void) fixedToDepthShift; |
@@ -1,4 +1,4 @@ | |||
/* $Id: s_zoom.c,v 1.13 2002/02/02 17:24:11 brianp Exp $ */ | |||
/* $Id: s_zoom.c,v 1.14 2002/04/12 15:39:59 brianp Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -55,8 +55,9 @@ zoom_span( GLcontext *ctx, const struct sw_span *span, | |||
/* no pixel arrays! */ | |||
ASSERT((span->arrayMask & SPAN_XY) == 0); | |||
ASSERT(span->primitive == GL_BITMAP); | |||
INIT_SPAN(zoomed); | |||
INIT_SPAN(zoomed, GL_BITMAP, 0, 0, 0); | |||
if (format == GL_RGBA || format == GL_RGB) { | |||
zoomed.z = span->z; | |||
zoomed.zStep = span->z; | |||
@@ -208,7 +209,7 @@ zoom_span( GLcontext *ctx, const struct sw_span *span, | |||
MEMCPY(rgbaSave, zoomed.color.rgba, zoomed.end * 4 * sizeof(GLchan)); | |||
} | |||
for (zoomed.y = r0; zoomed.y < r1; zoomed.y++) { | |||
_mesa_write_rgba_span(ctx, &zoomed, GL_BITMAP); | |||
_mesa_write_rgba_span(ctx, &zoomed); | |||
if (r1 - r0 > 1) { | |||
/* restore the colors */ | |||
MEMCPY(zoomed.color.rgba, rgbaSave, zoomed.end*4 * sizeof(GLchan)); | |||
@@ -220,7 +221,7 @@ zoom_span( GLcontext *ctx, const struct sw_span *span, | |||
MEMCPY(indexSave, zoomed.color.index, zoomed.end * sizeof(GLuint)); | |||
} | |||
for (zoomed.y = r0; zoomed.y < r1; zoomed.y++) { | |||
_mesa_write_index_span(ctx, &zoomed, GL_BITMAP); | |||
_mesa_write_index_span(ctx, &zoomed); | |||
if (r1 - r0 > 1) { | |||
/* restore the colors */ | |||
MEMCPY(zoomed.color.index, indexSave, zoomed.end * sizeof(GLuint)); |
@@ -1,4 +1,4 @@ | |||
/* $Id: swrast.h,v 1.21 2002/03/16 00:53:15 brianp Exp $ */ | |||
/* $Id: swrast.h,v 1.22 2002/04/12 15:39:59 brianp Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -108,6 +108,9 @@ struct sw_span { | |||
/* This flag indicates that only a part of the span is visible */ | |||
GLboolean writeAll; | |||
/* either GL_POLYGON, GL_LINE, GL_POLYGON, GL_BITMAP */ | |||
GLenum primitive; | |||
/** | |||
* This bitmask (of SPAN_* flags) indicates which of the x/xStep | |||
* variables are relevant. | |||
@@ -168,11 +171,13 @@ struct sw_span { | |||
}; | |||
#define INIT_SPAN(S) \ | |||
do { \ | |||
S.interpMask = 0; \ | |||
S.arrayMask = 0; \ | |||
S.start = S.end = 0; \ | |||
#define INIT_SPAN(S, PRIMITIVE, END, INTERP_MASK, ARRAY_MASK) \ | |||
do { \ | |||
S.primitive = (PRIMITIVE); \ | |||
S.interpMask = (INTERP_MASK); \ | |||
S.arrayMask = (ARRAY_MASK); \ | |||
S.start = 0; \ | |||
S.end = (END); \ | |||
} while (0) | |||