From 9e8a961dd7d7b717a9fb4ecdea1c1b60ea355efe Mon Sep 17 00:00:00 2001 From: Brian Date: Sun, 20 May 2007 12:27:39 -0600 Subject: Overhaul/simplify SWvertex and SWspan attribute handling. Instead of separate fog/specular/texcoord/varying code, just treat all of them as generic attributes. Simplifies the point/line/triangle functions. --- src/mesa/swrast/s_zoom.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'src/mesa/swrast/s_zoom.c') diff --git a/src/mesa/swrast/s_zoom.c b/src/mesa/swrast/s_zoom.c index 0908265fe9..78fa137d3f 100644 --- a/src/mesa/swrast/s_zoom.c +++ b/src/mesa/swrast/s_zoom.c @@ -155,14 +155,11 @@ zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span, zoomed_arrays.ChanType = span->array->ChanType; /* XXX temporary */ #if CHAN_TYPE == GL_UNSIGNED_BYTE - zoomed_arrays.rgba = zoomed_arrays.color.sz1.rgba; - zoomed_arrays.spec = zoomed_arrays.color.sz1.spec; + zoomed_arrays.rgba = zoomed_arrays.rgba8; #elif CHAN_TYPE == GL_UNSIGNED_SHORT - zoomed_arrays.rgba = zoomed_arrays.color.sz2.rgba; - zoomed_arrays.spec = zoomed_arrays.color.sz2.spec; + zoomed_arrays.rgba = zoomed_arrays.rgba16; #else zoomed_arrays.rgba = zoomed_arrays.attribs[FRAG_ATTRIB_COL0]; - zoomed_arrays.spec = zoomed_arrays.attribs[FRAG_ATTRIB_COL1]; #endif @@ -219,7 +216,7 @@ zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span, GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x; ASSERT(j >= 0); ASSERT(j < (GLint) span->end); - COPY_4UBV(zoomed.array->color.sz1.rgba[i], rgba[j]); + COPY_4UBV(zoomed.array->rgba8[i], rgba[j]); } } else if (zoomed.array->ChanType == GL_UNSIGNED_SHORT) { @@ -229,7 +226,7 @@ zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span, GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x; ASSERT(j >= 0); ASSERT(j < (GLint) span->end); - COPY_4V(zoomed.array->color.sz2.rgba[i], rgba[j]); + COPY_4V(zoomed.array->rgba16[i], rgba[j]); } } else { @@ -251,10 +248,10 @@ zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span, GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x; ASSERT(j >= 0); ASSERT(j < (GLint) span->end); - zoomed.array->color.sz1.rgba[i][0] = rgb[j][0]; - zoomed.array->color.sz1.rgba[i][1] = rgb[j][1]; - zoomed.array->color.sz1.rgba[i][2] = rgb[j][2]; - zoomed.array->color.sz1.rgba[i][3] = 0xff; + zoomed.array->rgba8[i][0] = rgb[j][0]; + zoomed.array->rgba8[i][1] = rgb[j][1]; + zoomed.array->rgba8[i][2] = rgb[j][2]; + zoomed.array->rgba8[i][3] = 0xff; } } else if (zoomed.array->ChanType == GL_UNSIGNED_SHORT) { @@ -264,10 +261,10 @@ zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span, GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x; ASSERT(j >= 0); ASSERT(j < (GLint) span->end); - zoomed.array->color.sz2.rgba[i][0] = rgb[j][0]; - zoomed.array->color.sz2.rgba[i][1] = rgb[j][1]; - zoomed.array->color.sz2.rgba[i][2] = rgb[j][2]; - zoomed.array->color.sz2.rgba[i][3] = 0xffff; + zoomed.array->rgba16[i][0] = rgb[j][0]; + zoomed.array->rgba16[i][1] = rgb[j][1]; + zoomed.array->rgba16[i][2] = rgb[j][2]; + zoomed.array->rgba16[i][3] = 0xffff; } } else { @@ -314,8 +311,7 @@ zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span, * Also, clipping may change the span end value, so store it as well. */ const GLint end = zoomed.end; /* save */ - /* use specular color array for temp storage */ - void *rgbaSave = zoomed.array->spec; + GLuint rgbaSave[MAX_WIDTH][4]; const GLint pixelSize = (zoomed.array->ChanType == GL_UNSIGNED_BYTE) ? 4 * sizeof(GLubyte) : ((zoomed.array->ChanType == GL_UNSIGNED_SHORT) ? 4 * sizeof(GLushort) @@ -334,7 +330,7 @@ zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span, } else if (format == GL_COLOR_INDEX) { /* use specular color array for temp storage */ - GLuint *indexSave = (GLuint *) zoomed.array->spec; + GLuint *indexSave = (GLuint *) zoomed.array->attribs[FRAG_ATTRIB_FOGC]; const GLint end = zoomed.end; /* save */ if (y1 - y0 > 1) { MEMCPY(indexSave, zoomed.array->index, zoomed.end * sizeof(GLuint)); -- cgit v1.2.3