summaryrefslogtreecommitdiff
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-06-29 21:52:18 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-06-29 21:52:18 -0600
commitf4b103dc993491355ec3e3640d9cb060138175c2 (patch)
tree335ae95e1532639c084d0da63c37dc015232d9f3 /src/mesa/swrast
parentfcc77d3ece160743e3f0f034ce2e130030c6386d (diff)
simplify INIT_SPAN code
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_aalinetemp.h4
-rw-r--r--src/mesa/swrast/s_aatritemp.h3
-rw-r--r--src/mesa/swrast/s_accum.c4
-rw-r--r--src/mesa/swrast/s_bitmap.c8
-rw-r--r--src/mesa/swrast/s_buffers.c8
-rw-r--r--src/mesa/swrast/s_copypix.c13
-rw-r--r--src/mesa/swrast/s_drawpix.c13
-rw-r--r--src/mesa/swrast/s_linetemp.h5
-rw-r--r--src/mesa/swrast/s_points.c6
-rw-r--r--src/mesa/swrast/s_span.h18
-rw-r--r--src/mesa/swrast/s_tritemp.h2
-rw-r--r--src/mesa/swrast/s_zoom.c2
12 files changed, 55 insertions, 31 deletions
diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h
index 3d3511823d..69a1f0cd39 100644
--- a/src/mesa/swrast/s_aalinetemp.h
+++ b/src/mesa/swrast/s_aalinetemp.h
@@ -137,8 +137,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, GL_LINE, 0, 0, SPAN_XY | SPAN_COVERAGE);
-
+ INIT_SPAN(line.span, GL_LINE);
+ line.span.arrayMask = SPAN_XY | SPAN_COVERAGE;
line.xAdj = line.dx / line.len * line.halfWidth;
line.yAdj = line.dy / line.len * line.halfWidth;
diff --git a/src/mesa/swrast/s_aatritemp.h b/src/mesa/swrast/s_aatritemp.h
index 34a2305b39..42d74a1632 100644
--- a/src/mesa/swrast/s_aatritemp.h
+++ b/src/mesa/swrast/s_aatritemp.h
@@ -69,7 +69,8 @@
(void) swrast;
- INIT_SPAN(span, GL_POLYGON, 0, 0, SPAN_COVERAGE);
+ INIT_SPAN(span, GL_POLYGON);
+ span.arrayMask = SPAN_COVERAGE;
/* determine bottom to top order of vertices */
{
diff --git a/src/mesa/swrast/s_accum.c b/src/mesa/swrast/s_accum.c
index f53e7f52c5..3c45dee399 100644
--- a/src/mesa/swrast/s_accum.c
+++ b/src/mesa/swrast/s_accum.c
@@ -474,7 +474,9 @@ accum_return(GLcontext *ctx, GLfloat value,
SWspan span;
/* init color span */
- INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_RGBA);
+ INIT_SPAN(span, GL_BITMAP);
+ span.end = width;
+ span.arrayMask = SPAN_RGBA;
span.x = xpos;
span.y = ypos + i;
diff --git a/src/mesa/swrast/s_bitmap.c b/src/mesa/swrast/s_bitmap.c
index 563b5fe602..1e7f6c18e6 100644
--- a/src/mesa/swrast/s_bitmap.c
+++ b/src/mesa/swrast/s_bitmap.c
@@ -82,7 +82,9 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
if (SWRAST_CONTEXT(ctx)->NewState)
_swrast_validate_derived( ctx );
- INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_XY);
+ INIT_SPAN(span, GL_BITMAP);
+ span.end = width;
+ span.arrayMask = SPAN_XY;
_swrast_span_default_attribs(ctx, &span);
for (row = 0; row < height; row++) {
@@ -180,7 +182,9 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
if (SWRAST_CONTEXT(ctx)->NewState)
_swrast_validate_derived( ctx );
- INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_MASK);
+ INIT_SPAN(span, GL_BITMAP);
+ span.end = width;
+ span.arrayMask = SPAN_MASK;
_swrast_span_default_attribs(ctx, &span);
/*span.arrayMask |= SPAN_MASK;*/ /* we'll init span.mask[] */
diff --git a/src/mesa/swrast/s_buffers.c b/src/mesa/swrast/s_buffers.c
index bd66cf125b..90a56284c5 100644
--- a/src/mesa/swrast/s_buffers.c
+++ b/src/mesa/swrast/s_buffers.c
@@ -55,7 +55,9 @@ clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb)
/* Initialize color span with clear color */
/* XXX optimize for clearcolor == black/zero (bzero) */
- INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_RGBA);
+ INIT_SPAN(span, GL_BITMAP);
+ span.end = width;
+ span.arrayMask = SPAN_RGBA;
span.array->ChanType = rb->DataType;
if (span.array->ChanType == GL_UNSIGNED_BYTE) {
GLubyte clearColor[4];
@@ -119,7 +121,9 @@ clear_ci_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb)
ASSERT(rb->DataType == GL_UNSIGNED_INT);
/* Initialize index span with clear index */
- INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_INDEX);
+ INIT_SPAN(span, GL_BITMAP);
+ span.end = width;
+ span.arrayMask = SPAN_INDEX;
for (i = 0; i < width;i++) {
span.array->index[i] = ctx->Color.ClearIndex;
}
diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c
index 9cd6ca20a9..bbe1081860 100644
--- a/src/mesa/swrast/s_copypix.c
+++ b/src/mesa/swrast/s_copypix.c
@@ -102,8 +102,10 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
GLfloat *dest, *tmpImage, *convImage;
SWspan span;
- INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA);
+ INIT_SPAN(span, GL_BITMAP);
_swrast_span_default_attribs(ctx, &span);
+ span.arrayMask = SPAN_RGBA;
+ span.arrayAttribs = FRAG_BIT_COL0;
/* allocate space for GLfloat image */
tmpImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
@@ -232,8 +234,9 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
stepy = 1;
}
- INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA);
+ INIT_SPAN(span, GL_BITMAP);
_swrast_span_default_attribs(ctx, &span);
+ span.arrayMask = SPAN_RGBA;
span.arrayAttribs = FRAG_BIT_COL0; /* we'll fill in COL0 attrib values */
if (overlapping) {
@@ -315,8 +318,9 @@ copy_ci_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
return;
}
- INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_INDEX);
+ INIT_SPAN(span, GL_BITMAP);
_swrast_span_default_attribs(ctx, &span);
+ span.arrayMask = SPAN_INDEX;
if (ctx->DrawBuffer == ctx->ReadBuffer) {
overlapping = regions_overlap(srcx, srcy, destx, desty, width, height,
@@ -449,8 +453,9 @@ copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
return;
}
- INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_Z);
+ INIT_SPAN(span, GL_BITMAP);
_swrast_span_default_attribs(ctx, &span);
+ span.arrayMask = SPAN_Z;
if (ctx->DrawBuffer == ctx->ReadBuffer) {
overlapping = regions_overlap(srcx, srcy, destx, desty, width, height,
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c
index b5388745ba..b8b452e33d 100644
--- a/src/mesa/swrast/s_drawpix.c
+++ b/src/mesa/swrast/s_drawpix.c
@@ -70,7 +70,9 @@ fast_draw_rgba_pixels(GLcontext *ctx, GLint x, GLint y,
return GL_FALSE;
}
- INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA);
+ INIT_SPAN(span, GL_BITMAP);
+ span.arrayMask = SPAN_RGBA;
+ span.arrayAttribs = FRAG_BIT_COL0;
_swrast_span_default_attribs(ctx, &span);
/* copy input params since clipping may change them */
@@ -332,7 +334,8 @@ draw_index_pixels( GLcontext *ctx, GLint x, GLint y,
GLint row, skipPixels;
SWspan span;
- INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_INDEX);
+ INIT_SPAN(span, GL_BITMAP);
+ span.arrayMask = SPAN_INDEX;
_swrast_span_default_attribs(ctx, &span);
/*
@@ -427,7 +430,8 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
const GLboolean zoom = ctx->Pixel.ZoomX != 1.0 || ctx->Pixel.ZoomY != 1.0;
SWspan span;
- INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_Z);
+ INIT_SPAN(span, GL_BITMAP);
+ span.arrayMask = SPAN_Z;
_swrast_span_default_attribs(ctx, &span);
if (type == GL_UNSIGNED_SHORT
@@ -544,8 +548,9 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
return;
}
- INIT_SPAN(span, GL_BITMAP, 0, 0x0, SPAN_RGBA);
+ INIT_SPAN(span, GL_BITMAP);
_swrast_span_default_attribs(ctx, &span);
+ span.arrayMask = SPAN_RGBA;
span.arrayAttribs = FRAG_BIT_COL0; /* we're fill in COL0 attrib values */
if (ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) {
diff --git a/src/mesa/swrast/s_linetemp.h b/src/mesa/swrast/s_linetemp.h
index 55548f27b0..1accfc67e2 100644
--- a/src/mesa/swrast/s_linetemp.h
+++ b/src/mesa/swrast/s_linetemp.h
@@ -303,7 +303,10 @@ NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 )
}
#endif
- INIT_SPAN(span, GL_LINE, numPixels, interpFlags, SPAN_XY);
+ INIT_SPAN(span, GL_LINE);
+ span.end = numPixels;
+ span.interpMask = interpFlags;
+ span.arrayMask = SPAN_XY;
/*
* Draw
diff --git a/src/mesa/swrast/s_points.c b/src/mesa/swrast/s_points.c
index ade1eab891..8eba53c807 100644
--- a/src/mesa/swrast/s_points.c
+++ b/src/mesa/swrast/s_points.c
@@ -82,7 +82,7 @@ sprite_point(GLcontext *ctx, const SWvertex *vert)
size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize);
/* span init */
- INIT_SPAN(span, GL_POINT, 0, 0, 0);
+ INIT_SPAN(span, GL_POINT);
span.interpMask = SPAN_Z | SPAN_RGBA;
span.red = ChanToFixed(vert->color[0]);
@@ -248,7 +248,7 @@ smooth_point(GLcontext *ctx, const SWvertex *vert)
(void) alphaAtten; /* not used */
/* span init */
- INIT_SPAN(span, GL_POINT, 0, 0, 0);
+ INIT_SPAN(span, GL_POINT);
span.interpMask = SPAN_Z | SPAN_RGBA;
span.arrayMask = SPAN_COVERAGE | SPAN_MASK;
@@ -367,7 +367,7 @@ large_point(GLcontext *ctx, const SWvertex *vert)
size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize);
/* span init */
- INIT_SPAN(span, GL_POINT, 0, 0, 0);
+ INIT_SPAN(span, GL_POINT);
span.arrayMask = SPAN_XY;
if (ciMode) {
diff --git a/src/mesa/swrast/s_span.h b/src/mesa/swrast/s_span.h
index 585cce91ee..512134db0f 100644
--- a/src/mesa/swrast/s_span.h
+++ b/src/mesa/swrast/s_span.h
@@ -159,15 +159,15 @@ typedef struct sw_span
-#define INIT_SPAN(S, PRIMITIVE, END, INTERP_MASK, ARRAY_MASK) \
-do { \
- (S).primitive = (PRIMITIVE); \
- (S).interpMask = (INTERP_MASK); \
- (S).arrayMask = (ARRAY_MASK); \
- (S).arrayAttribs = 0x0; \
- (S).end = (END); \
- (S).facing = 0; \
- (S).array = SWRAST_CONTEXT(ctx)->SpanArrays; \
+#define INIT_SPAN(S, PRIMITIVE) \
+do { \
+ (S).primitive = (PRIMITIVE); \
+ (S).interpMask = 0x0; \
+ (S).arrayMask = 0x0; \
+ (S).arrayAttribs = 0x0; \
+ (S).end = 0; \
+ (S).facing = 0; \
+ (S).array = SWRAST_CONTEXT(ctx)->SpanArrays; \
} while (0)
diff --git a/src/mesa/swrast/s_tritemp.h b/src/mesa/swrast/s_tritemp.h
index 2a90ffd85f..f5bc03e81e 100644
--- a/src/mesa/swrast/s_tritemp.h
+++ b/src/mesa/swrast/s_tritemp.h
@@ -144,7 +144,7 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
(void) swrast;
- INIT_SPAN(span, GL_POLYGON, 0, 0, 0);
+ INIT_SPAN(span, GL_POLYGON);
span.y = 0; /* silence warnings */
#ifdef INTERP_Z
diff --git a/src/mesa/swrast/s_zoom.c b/src/mesa/swrast/s_zoom.c
index 5f495e36c1..9f1a4c6f0a 100644
--- a/src/mesa/swrast/s_zoom.c
+++ b/src/mesa/swrast/s_zoom.c
@@ -148,7 +148,7 @@ zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span,
ASSERT((span->arrayMask & SPAN_XY) == 0);
ASSERT(span->primitive == GL_BITMAP);
- INIT_SPAN(zoomed, GL_BITMAP, 0, 0, 0);
+ INIT_SPAN(zoomed, GL_BITMAP);
zoomed.x = x0;
zoomed.end = zoomedWidth;
zoomed.array = &zoomed_arrays;