From: Brian Date: Sat, 30 Jun 2007 03:52:18 +0000 (-0600) Subject: simplify INIT_SPAN code X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f4b103dc993491355ec3e3640d9cb060138175c2;p=mesa.git simplify INIT_SPAN code --- diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h index 3d3511823d7..69a1f0cd396 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 34a2305b393..42d74a16328 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 f53e7f52c5e..3c45dee3998 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 563b5fe602c..1e7f6c18e6a 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 bd66cf125b5..90a56284c51 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 9cd6ca20a9d..bbe1081860d 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 b5388745bab..b8b452e33dd 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 55548f27b08..1accfc67e2c 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 ade1eab8917..8eba53c8076 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 585cce91ee9..512134db0f8 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 2a90ffd85f8..f5bc03e81e4 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 5f495e36c12..9f1a4c6f0a7 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;