type, width, interp mask and array mask.
-/* $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
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 */
}
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;
}
#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
}
-/* $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
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 */
{
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
}
}
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
}
}
-/* $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
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);
/* 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;
}
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);
}
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)
}
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)
-/* $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
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);
span.x = destx;
span.y = dy;
span.end = width;
- _mesa_write_rgba_span(ctx, &span, GL_BITMAP);
+ _mesa_write_rgba_span(ctx, &span);
}
}
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);
span.x = destx;
span.y = dy;
span.end = width;
- _mesa_write_rgba_span(ctx, &span, GL_BITMAP);
+ _mesa_write_rgba_span(ctx, &span);
}
}
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) {
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) */
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" );
(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);
}
}
-/* $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
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;
}
}
-/* $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
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 */
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);
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);
}
}
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
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
_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 {
_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);
}
}
}
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)");
span.x = x;
span.y = y;
span.end = width;
- _mesa_write_rgba_span(ctx, &span, GL_BITMAP);
+ _mesa_write_rgba_span(ctx, &span);
}
}
}
-/* $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
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 {
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);
}
}
}
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;
#include "s_linetemp.h"
- _mesa_write_index_span(ctx, &span, GL_LINE);
+ _mesa_write_index_span(ctx, &span);
}
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]);
#include "s_linetemp.h"
- _mesa_write_rgba_span(ctx, &span, GL_LINE);
+ _mesa_write_rgba_span(ctx, &span);
}
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
#include "s_linetemp.h"
- _mesa_write_index_span(ctx, &span, GL_LINE);
+ _mesa_write_index_span(ctx, &span);
}
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
#include "s_linetemp.h"
- _mesa_write_rgba_span(ctx, &span, GL_LINE);
+ _mesa_write_rgba_span(ctx, &span);
}
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
draw_wide_line(ctx, &span, xMajor);
}
else {
- _mesa_write_index_span(ctx, &span, GL_LINE);
+ _mesa_write_index_span(ctx, &span);
}
}
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;
draw_wide_line(ctx, &span, xMajor);
}
else {
- _mesa_write_index_span(ctx, &span, GL_LINE);
+ _mesa_write_index_span(ctx, &span);
}
}
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
draw_wide_line(ctx, &span, xMajor);
}
else {
- _mesa_write_rgba_span(ctx, &span, GL_LINE);
+ _mesa_write_rgba_span(ctx, &span);
}
}
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]);
draw_wide_line(ctx, &span, xMajor);
}
else {
- _mesa_write_rgba_span(ctx, &span, GL_LINE);
+ _mesa_write_rgba_span(ctx, &span);
}
}
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]);
draw_wide_line(ctx, &span, xMajor);
}
else {
- _mesa_write_texture_span(ctx, &span, GL_LINE);
+ _mesa_write_texture_span(ctx, &span);
}
}
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
draw_wide_line(ctx, &span, xMajor);
}
else {
- _mesa_write_texture_span(ctx, &span, GL_LINE);
+ _mesa_write_texture_span(ctx, &span);
}
}
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
draw_wide_line(ctx, &span, xMajor);
}
else {
- _mesa_write_texture_span(ctx, &span, GL_LINE);
+ _mesa_write_texture_span(ctx, &span);
}
}
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]);
draw_wide_line(ctx, &span, xMajor);
}
else {
- _mesa_write_texture_span(ctx, &span, GL_LINE);
+ _mesa_write_texture_span(ctx, &span);
}
}
-/* $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
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++) {
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;
}
}
-/* $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
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;
#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
}
-/* $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
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 */
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 */
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;
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;
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;
* 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);
}
/* 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;
}
#endif
/* Polygon Stippling */
- if (ctx->Polygon.StippleFlag && primitive == GL_POLYGON) {
+ if (ctx->Polygon.StippleFlag && span->primitive == GL_POLYGON) {
stipple_polygon_span(ctx, 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);
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
#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) {
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;
}
#endif
/* Polygon Stippling */
- if (ctx->Polygon.StippleFlag && primitive == GL_POLYGON) {
+ if (ctx->Polygon.StippleFlag && span->primitive == GL_POLYGON) {
stipple_polygon_span(ctx, span);
}
* 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);
}
/* 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;
}
#endif
/* Polygon Stippling */
- if (ctx->Polygon.StippleFlag && primitive == GL_POLYGON) {
+ if (ctx->Polygon.StippleFlag && span->primitive == GL_POLYGON) {
stipple_polygon_span(ctx, span);
}
-/* $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
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
-/* $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
* 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)
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;
}
}
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);
}
/* 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 );
}
}
}
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));
/* 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);
}
}
}
/* 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);
}
}
-/* $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
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 );
-/* $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
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"
}
#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"
}
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"
}
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"
}
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
}
ASSERT(span->arrayMask & SPAN_RGBA);
- _mesa_write_rgba_span(ctx, span, GL_POLYGON);
+ _mesa_write_rgba_span(ctx, span);
#undef SPAN_NEAREST
#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"
}
#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"
-/* $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
struct sw_span span;
- INIT_SPAN(span);
+ INIT_SPAN(span, GL_POLYGON, 0, 0, 0);
#ifdef INTERP_Z
(void) fixedToDepthShift;
-/* $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
/* 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;
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));
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));
-/* $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
/* 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.
};
-#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)