diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2001-05-16 20:27:12 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2001-05-16 20:27:12 +0000 |
commit | 47cf442c1164b6b406117fccfb8b564602741ee3 (patch) | |
tree | cd3e7c6147b0b19b091c38ad78785e8d18235ea3 | |
parent | 441a4af435b46e1b475318fbaf4e80b774390cb0 (diff) |
use DEFARRAY, etc macros to work around 32k data limit on Macs (Tom Goon)
-rw-r--r-- | src/mesa/main/image.c | 28 | ||||
-rw-r--r-- | src/mesa/swrast/s_aatriangle.c | 3 | ||||
-rw-r--r-- | src/mesa/swrast/s_aatritemp.h | 54 | ||||
-rw-r--r-- | src/mesa/swrast/s_copypix.c | 36 | ||||
-rw-r--r-- | src/mesa/swrast/s_drawpix.c | 17 | ||||
-rw-r--r-- | src/mesa/swrast/s_readpix.c | 6 | ||||
-rw-r--r-- | src/mesa/swrast/s_texture.c | 6 | ||||
-rw-r--r-- | src/mesa/swrast/s_triangle.c | 66 | ||||
-rw-r--r-- | src/mesa/swrast/s_tritemp.h | 7 |
9 files changed, 174 insertions, 49 deletions
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 86883aa2cf..df7a89d005 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1,4 +1,4 @@ -/* $Id: image.c,v 1.60 2001/05/15 21:21:08 brianp Exp $ */ +/* $Id: image.c,v 1.61 2001/05/16 20:27:12 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -805,7 +805,9 @@ _mesa_pack_float_rgba_span( GLcontext *ctx, if (transferOps) { /* make copy of incoming data */ - GLfloat rgbaCopy[MAX_WIDTH][4]; + DEFMARRAY(GLfloat, rgbaCopy, MAX_WIDTH, 4); /* mac 32k limitation */ + CHECKARRAY(rgbaCopy, return); /* mac 32k limitation */ + for (i = 0; i < n; i++) { rgbaCopy[i][0] = rgbaIn[i][0]; rgbaCopy[i][1] = rgbaIn[i][1]; @@ -866,9 +868,12 @@ _mesa_pack_float_rgba_span( GLcontext *ctx, /* min/max here */ if (transferOps & IMAGE_MIN_MAX_BIT) { _mesa_update_minmax(ctx, n, (CONST GLfloat (*)[4]) rgba); - if (ctx->MinMax.Sink) + if (ctx->MinMax.Sink) { + UNDEFARRAY(rgbaCopy); /* mac 32k limitation */ return; + } } + UNDEFARRAY(rgbaCopy); /* mac 32k limitation */ } else { /* use incoming data, not a copy */ @@ -1735,8 +1740,10 @@ _mesa_pack_rgba_span( GLcontext *ctx, } else { /* general solution */ - GLfloat rgba[MAX_WIDTH][4]; GLuint i; + DEFMARRAY(GLfloat, rgba, MAX_WIDTH, 4); /* mac 32k limitation */ + CHECKARRAY(rgba, return); /* mac 32k limitation */ + assert(n <= MAX_WIDTH); /* convert color components to floating point */ for (i=0;i<n;i++) { @@ -1748,6 +1755,7 @@ _mesa_pack_rgba_span( GLcontext *ctx, _mesa_pack_float_rgba_span(ctx, n, (const GLfloat (*)[4]) rgba, dstFormat, dstType, dstAddr, dstPacking, transferOps); + UNDEFARRAY(rgba); /* mac 32k limitation */ } } @@ -2555,10 +2563,11 @@ _mesa_unpack_chan_color_span( GLcontext *ctx, /* general solution begins here */ { - GLfloat rgba[MAX_WIDTH][4]; GLint dstComponents; GLint dstRedIndex, dstGreenIndex, dstBlueIndex, dstAlphaIndex; GLint dstLuminanceIndex, dstIntensityIndex; + DEFMARRAY(GLfloat, rgba, MAX_WIDTH, 4); /* mac 32k limitation */ + CHECKARRAY(rgba, return); /* mac 32k limitation */ dstComponents = _mesa_components_in_format( dstFormat ); /* source & dest image formats should have been error checked by now */ @@ -2587,6 +2596,7 @@ _mesa_unpack_chan_color_span( GLcontext *ctx, for (i = 0; i < n; i++) { dest[i] = (GLchan) (indexes[i] & 0xff); } + UNDEFARRAY(rgba); /* mac 32k limitation */ return; } else { @@ -2706,6 +2716,7 @@ _mesa_unpack_chan_color_span( GLcontext *ctx, break; default: _mesa_problem(ctx, "bad dstFormat in _mesa_unpack_chan_span()"); + UNDEFARRAY(rgba); /* mac 32k limitation */ return; } @@ -2769,6 +2780,7 @@ _mesa_unpack_chan_color_span( GLcontext *ctx, dst += dstComponents; } } + UNDEFARRAY(rgba); /* mac 32k limitation */ } } @@ -2826,10 +2838,11 @@ _mesa_unpack_float_color_span( GLcontext *ctx, /* general solution, no special cases, yet */ { - GLfloat rgba[MAX_WIDTH][4]; GLint dstComponents; GLint dstRedIndex, dstGreenIndex, dstBlueIndex, dstAlphaIndex; GLint dstLuminanceIndex, dstIntensityIndex; + DEFMARRAY(GLfloat, rgba, MAX_WIDTH, 4); /* mac 32k limitation */ + CHECKARRAY(rgba, return); /* mac 32k limitation */ dstComponents = _mesa_components_in_format( dstFormat ); /* source & dest image formats should have been error checked by now */ @@ -2858,6 +2871,7 @@ _mesa_unpack_float_color_span( GLcontext *ctx, for (i = 0; i < n; i++) { dest[i] = (GLchan) (indexes[i] & 0xff); } + UNDEFARRAY(rgba); /* mac 32k limitation */ return; } else { @@ -2977,6 +2991,7 @@ _mesa_unpack_float_color_span( GLcontext *ctx, break; default: _mesa_problem(ctx, "bad dstFormat in _mesa_unpack_float_color_span()"); + UNDEFARRAY(rgba); /* mac 32k limitation */ return; } @@ -3038,6 +3053,7 @@ _mesa_unpack_float_color_span( GLcontext *ctx, dst += dstComponents; } } + UNDEFARRAY(rgba); /* mac 32k limitation */ } } diff --git a/src/mesa/swrast/s_aatriangle.c b/src/mesa/swrast/s_aatriangle.c index d81250292d..5b8cdbf6a4 100644 --- a/src/mesa/swrast/s_aatriangle.c +++ b/src/mesa/swrast/s_aatriangle.c @@ -1,4 +1,4 @@ -/* $Id: s_aatriangle.c,v 1.15 2001/05/15 16:18:13 brianp Exp $ */ +/* $Id: s_aatriangle.c,v 1.16 2001/05/16 20:27:12 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -30,6 +30,7 @@ */ +#include "mem.h" #include "mmath.h" #include "s_aatriangle.h" #include "s_context.h" diff --git a/src/mesa/swrast/s_aatritemp.h b/src/mesa/swrast/s_aatritemp.h index 9f6695ce33..d2a866b8a3 100644 --- a/src/mesa/swrast/s_aatritemp.h +++ b/src/mesa/swrast/s_aatritemp.h @@ -1,4 +1,4 @@ -/* $Id: s_aatritemp.h,v 1.15 2001/05/15 21:30:27 brianp Exp $ */ +/* $Id: s_aatritemp.h,v 1.16 2001/05/16 20:27:12 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -54,7 +54,7 @@ GLfloat majDx, majDy; /* major (i.e. long) edge dx and dy */ #ifdef DO_Z - GLfloat zPlane[4]; /* Z (depth) */ + GLfloat zPlane[4]; GLdepth z[MAX_WIDTH]; #endif #ifdef DO_FOG @@ -64,38 +64,53 @@ GLfloat *fog = NULL; #endif #ifdef DO_RGBA - GLfloat rPlane[4], gPlane[4], bPlane[4], aPlane[4]; /* color */ - GLchan rgba[MAX_WIDTH][4]; + GLfloat rPlane[4], gPlane[4], bPlane[4], aPlane[4]; + DEFMARRAY(GLubyte, rgba, MAX_WIDTH, 4); /* mac 32k limitation */ #endif #ifdef DO_INDEX - GLfloat iPlane[4]; /* color index */ + GLfloat iPlane[4]; GLuint index[MAX_WIDTH]; GLint icoverageSpan[MAX_WIDTH]; #else GLfloat coverageSpan[MAX_WIDTH]; #endif #ifdef DO_SPEC - GLfloat srPlane[4], sgPlane[4], sbPlane[4]; /* spec color */ - GLchan spec[MAX_WIDTH][4]; + GLfloat srPlane[4], sgPlane[4], sbPlane[4]; + DEFMARRAY(GLubyte, spec, MAX_WIDTH, 4); #endif #ifdef DO_TEX GLfloat sPlane[4], tPlane[4], uPlane[4], vPlane[4]; GLfloat texWidth, texHeight; - GLfloat s[MAX_WIDTH], t[MAX_WIDTH], u[MAX_WIDTH]; - GLfloat lambda[MAX_WIDTH]; + DEFARRAY(GLfloat, s, MAX_WIDTH); /* mac 32k limitation */ + DEFARRAY(GLfloat, t, MAX_WIDTH); + DEFARRAY(GLfloat, u, MAX_WIDTH); + DEFARRAY(GLfloat, lambda, MAX_WIDTH); #elif defined(DO_MULTITEX) GLfloat sPlane[MAX_TEXTURE_UNITS][4]; GLfloat tPlane[MAX_TEXTURE_UNITS][4]; GLfloat uPlane[MAX_TEXTURE_UNITS][4]; GLfloat vPlane[MAX_TEXTURE_UNITS][4]; GLfloat texWidth[MAX_TEXTURE_UNITS], texHeight[MAX_TEXTURE_UNITS]; - GLfloat s[MAX_TEXTURE_UNITS][MAX_WIDTH]; - GLfloat t[MAX_TEXTURE_UNITS][MAX_WIDTH]; - GLfloat u[MAX_TEXTURE_UNITS][MAX_WIDTH]; - GLfloat lambda[MAX_TEXTURE_UNITS][MAX_WIDTH]; + DEFMARRAY(GLfloat, s, MAX_TEXTURE_UNITS, MAX_WIDTH); /* mac 32k limit */ + DEFMARRAY(GLfloat, t, MAX_TEXTURE_UNITS, MAX_WIDTH); + DEFMARRAY(GLfloat, u, MAX_TEXTURE_UNITS, MAX_WIDTH); + DEFMARRAY(GLfloat, lambda, MAX_TEXTURE_UNITS, MAX_WIDTH); #endif GLfloat bf = SWRAST_CONTEXT(ctx)->_backface_sign; +#ifdef DO_RGBA + CHECKARRAY(rgba, return); /* mac 32k limitation */ +#endif +#ifdef DO_SPEC + CHECKARRAY(spec, return); +#endif +#if defined(DO_TEX) || defined(DO_MULTITEX) + CHECKARRAY(s, return); + CHECKARRAY(t, return); + CHECKARRAY(u, return); + CHECKARRAY(lambda, return); +#endif + /* determine bottom to top order of vertices */ { GLfloat y0 = v0->win[1]; @@ -532,6 +547,19 @@ #endif } } + +#ifdef DO_RGBA + UNDEFARRAY(rgba); /* mac 32k limitation */ +#endif +#ifdef DO_SPEC + UNDEFARRAY(spec); +#endif +#if defined(DO_TEX) || defined(DO_MULTITEX) + UNDEFARRAY(s); + UNDEFARRAY(t); + UNDEFARRAY(u); + UNDEFARRAY(lambda); +#endif } diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c index 36e9974d38..a4a34ba592 100644 --- a/src/mesa/swrast/s_copypix.c +++ b/src/mesa/swrast/s_copypix.c @@ -1,4 +1,4 @@ -/* $Id: s_copypix.c,v 1.17 2001/05/15 21:30:27 brianp Exp $ */ +/* $Id: s_copypix.c,v 1.18 2001/05/16 20:27:12 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -432,8 +432,10 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, if (transferOps) { const GLfloat scale = (1.0F / CHAN_MAXF); - GLfloat rgbaFloat[MAX_WIDTH][4]; GLint k; + DEFMARRAY(GLfloat, rgbaFloat, MAX_WIDTH, 4); /* mac 32k limitation */ + CHECKARRAY(rgbaFloat, return); + /* convert chan to float */ for (k = 0; k < width; k++) { rgbaFloat[k][RCOMP] = (GLfloat) rgba[k][RCOMP] * scale; @@ -504,14 +506,22 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, rgba[k][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX); rgba[k][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); } + UNDEFARRAY(rgbaFloat); /* mac 32k limitation */ } if (ctx->Texture._ReallyEnabled && ctx->Pixel.PixelTextureEnabled) { - GLfloat s[MAX_WIDTH], t[MAX_WIDTH], r[MAX_WIDTH], q[MAX_WIDTH]; - GLchan primary_rgba[MAX_WIDTH][4]; GLuint unit; - /* XXX not sure how multitexture is supposed to work here */ + GLchan primary_rgba[MAX_WIDTH][4]; + DEFARRAY(GLfloat, s, MAX_WIDTH); /* mac 32k limitation */ + DEFARRAY(GLfloat, t, MAX_WIDTH); /* mac 32k limitation */ + DEFARRAY(GLfloat, r, MAX_WIDTH); /* mac 32k limitation */ + DEFARRAY(GLfloat, q, MAX_WIDTH); /* mac 32k limitation */ + CHECKARRAY(s, return); /* mac 32k limitation */ + CHECKARRAY(t, return); + CHECKARRAY(r, return); + CHECKARRAY(q, return); + /* XXX not sure how multitexture is supposed to work here */ MEMCPY(primary_rgba, rgba, 4 * width * sizeof(GLchan)); for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { @@ -521,6 +531,11 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, (CONST GLchan (*)[4]) primary_rgba, rgba); } + + UNDEFARRAY(s); /* mac 32k limitation */ + UNDEFARRAY(t); + UNDEFARRAY(r); + UNDEFARRAY(q); } if (quick_draw && dy >= 0 && dy < ctx->DrawBuffer->Height) { @@ -673,14 +688,16 @@ static void copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy, GLdepth zspan[MAX_WIDTH]; GLfloat *p, *tmpImage; GLuint indexes[MAX_WIDTH]; - GLchan rgba[MAX_WIDTH][4]; GLint sy, dy, stepy; GLint i, j; const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; GLint overlapping; + DEFMARRAY(GLubyte, rgba, MAX_WIDTH, 4); /* mac 32k limitation */ + CHECKARRAY(rgba, return); /* mac 32k limitation */ if (!ctx->Visual.depthBits) { _mesa_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" ); + UNDEFARRAY(rgba); /* mac 32k limitation */ return; } @@ -720,6 +737,7 @@ static void copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy, tmpImage = (GLfloat *) MALLOC(width * height * sizeof(GLfloat)); if (!tmpImage) { _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" ); + UNDEFARRAY(rgba); /* mac 32k limitation */ return; } p = tmpImage; @@ -770,8 +788,10 @@ static void copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy, } } - if (overlapping) - FREE(tmpImage); + UNDEFARRAY(rgba); /* mac 32k limitation */ + + if (overlapping) + FREE(tmpImage); } diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index e914eb7013..59b2d0294b 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -1,4 +1,4 @@ -/* $Id: s_drawpix.c,v 1.18 2001/05/15 21:30:27 brianp Exp $ */ +/* $Id: s_drawpix.c,v 1.19 2001/05/16 20:27:12 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -818,11 +818,18 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, continue; if (ctx->Texture._ReallyEnabled && ctx->Pixel.PixelTextureEnabled) { - GLfloat s[MAX_WIDTH], t[MAX_WIDTH], r[MAX_WIDTH], q[MAX_WIDTH]; GLchan primary_rgba[MAX_WIDTH][4]; GLuint unit; - /* XXX not sure how multitexture is supposed to work here */ + DEFARRAY(GLfloat, s, MAX_WIDTH); /* mac 32k limitation */ + DEFARRAY(GLfloat, t, MAX_WIDTH); + DEFARRAY(GLfloat, r, MAX_WIDTH); + DEFARRAY(GLfloat, q, MAX_WIDTH); + CHECKARRAY(s, return); /* mac 32k limitation */ + CHECKARRAY(t, return); + CHECKARRAY(r, return); + CHECKARRAY(q, return); + /* XXX not sure how multitexture is supposed to work here */ MEMCPY(primary_rgba, rgba, 4 * width * sizeof(GLchan)); for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { @@ -834,6 +841,10 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, rgba); } } + UNDEFARRAY(s); /* mac 32k limitation */ + UNDEFARRAY(t); + UNDEFARRAY(r); + UNDEFARRAY(q); } if (quickDraw) { diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index d95bba64c8..5fc03da27d 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -1,4 +1,4 @@ -/* $Id: s_readpix.c,v 1.11 2001/03/19 02:25:36 keithw Exp $ */ +/* $Id: s_readpix.c,v 1.12 2001/05/16 20:27:12 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -451,13 +451,15 @@ read_rgba_pixels( GLcontext *ctx, * there. This fixes conformance failures with 16-bit color * buffers, for example. */ - GLfloat rgbaf[MAX_WIDTH][4]; + DEFMARRAY(GLfloat, rgbaf, MAX_WIDTH, 4); /* mac 32k limitation */ + CHECKARRAY(rgbaf, return); /* mac 32k limitation */ _mesa_chan_to_float_span(ctx, readWidth, (CONST GLchan (*)[4]) rgba, rgbaf); _mesa_pack_float_rgba_span(ctx, readWidth, (CONST GLfloat (*)[4]) rgbaf, format, type, dst, packing, ctx->_ImageTransferState); + UNDEFARRAY(rgbaf); /* mac 32k limitation */ } else { /* GLubytes are fine */ diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c index ae18bff0de..a5a64d0466 100644 --- a/src/mesa/swrast/s_texture.c +++ b/src/mesa/swrast/s_texture.c @@ -1,4 +1,4 @@ -/* $Id: s_texture.c,v 1.29 2001/05/14 23:11:13 brianp Exp $ */ +/* $Id: s_texture.c,v 1.30 2001/05/16 20:27:12 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1743,12 +1743,13 @@ texture_combine(const GLcontext *ctx, CONST GLchan (*texel)[4], GLchan (*rgba)[4]) { - GLchan ccolor [3][3*MAX_WIDTH][4]; const GLchan (*argRGB [3])[4]; const GLchan (*argA [3])[4]; GLuint i, j; const GLuint RGBshift = textureUnit->CombineScaleShiftRGB; const GLuint Ashift = textureUnit->CombineScaleShiftA; + DEFMNARRAY(GLubyte, ccolor, 3, 3 * MAX_WIDTH, 4); /* mac 32k limitation */ + CHECKARRAY(ccolor, return); /* mac 32k limitation */ ASSERT(ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine); @@ -2084,6 +2085,7 @@ texture_combine(const GLcontext *ctx, rgba[i][ACOMP] = rgba[i][RCOMP]; } } + UNDEFARRAY(ccolor); /* mac 32k limitation */ } #undef PROD diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index b3c5810123..2c117b869c 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -1,4 +1,4 @@ -/* $Id: s_triangle.c,v 1.27 2001/05/15 21:30:27 brianp Exp $ */ +/* $Id: s_triangle.c,v 1.28 2001/05/16 20:27:12 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1606,17 +1606,33 @@ static void lin_persp_textured_triangle( GLcontext *ctx, static void rasterize_span(GLcontext *ctx, const struct triangle_span *span) { - GLchan rgba[MAX_WIDTH][4]; - GLchan spec[MAX_WIDTH][4]; - GLuint index[MAX_WIDTH]; - GLuint z[MAX_WIDTH]; - GLfloat fog[MAX_WIDTH]; - GLfloat sTex[MAX_WIDTH], tTex[MAX_WIDTH], rTex[MAX_WIDTH]; - GLfloat lambda[MAX_WIDTH]; - GLfloat msTex[MAX_TEXTURE_UNITS][MAX_WIDTH]; - GLfloat mtTex[MAX_TEXTURE_UNITS][MAX_WIDTH]; - GLfloat mrTex[MAX_TEXTURE_UNITS][MAX_WIDTH]; - GLfloat mLambda[MAX_TEXTURE_UNITS][MAX_WIDTH]; + DEFMARRAY(GLchan, rgba, MAX_WIDTH, 4); + DEFMARRAY(GLchan, spec, MAX_WIDTH, 4); + DEFARRAY(GLuint, index, MAX_WIDTH); + DEFARRAY(GLuint, z, MAX_WIDTH); + DEFARRAY(GLfloat, fog, MAX_WIDTH); + DEFARRAY(GLfloat, sTex, MAX_WIDTH); + DEFARRAY(GLfloat, tTex, MAX_WIDTH); + DEFARRAY(GLfloat, rTex, MAX_WIDTH); + DEFARRAY(GLfloat, lambda, MAX_WIDTH); + DEFMARRAY(GLfloat, msTex, MAX_TEXTURE_UNITS, MAX_WIDTH); + DEFMARRAY(GLfloat, mtTex, MAX_TEXTURE_UNITS, MAX_WIDTH); + DEFMARRAY(GLfloat, mrTex, MAX_TEXTURE_UNITS, MAX_WIDTH); + DEFMARRAY(GLfloat, mLambda, MAX_TEXTURE_UNITS, MAX_WIDTH); + + CHECKARRAY(rgba, return); + CHECKARRAY(spec, return); + CHECKARRAY(index, return); + CHECKARRAY(z, return); + CHECKARRAY(fog, return); + CHECKARRAY(sTex, return); + CHECKARRAY(tTex, return); + CHECKARRAY(rTex, return); + CHECKARRAY(lambda, return); + CHECKARRAY(msTex, return); + CHECKARRAY(mtTex, return); + CHECKARRAY(mrTex, return); + CHECKARRAY(mLambda, return); if (span->activeMask & SPAN_RGBA) { GLfixed r = span->red; @@ -1837,6 +1853,20 @@ rasterize_span(GLcontext *ctx, const struct triangle_span *span) else { _mesa_problem(ctx, "rasterize_span() should only be used for texturing"); } + + UNDEFARRAY(rgba); + UNDEFARRAY(spec); + UNDEFARRAY(index); + UNDEFARRAY(z); + UNDEFARRAY(fog); + UNDEFARRAY(sTex); + UNDEFARRAY(tTex); + UNDEFARRAY(rTex); + UNDEFARRAY(lambda); + UNDEFARRAY(msTex); + UNDEFARRAY(mtTex); + UNDEFARRAY(mrTex); + UNDEFARRAY(mLambda); } @@ -1863,6 +1893,12 @@ static void general_textured_triangle( GLcontext *ctx, const struct gl_texture_image *texImage = obj->Image[obj->BaseLevel];\ const GLboolean flatShade = (ctx->Light.ShadeModel==GL_FLAT); \ GLfixed rFlat, gFlat, bFlat, aFlat; \ + DEFARRAY(GLfloat, sSpan, MAX_WIDTH); /* mac 32k limitation */ \ + DEFARRAY(GLfloat, tSpan, MAX_WIDTH); /* mac 32k limitation */ \ + DEFARRAY(GLfloat, uSpan, MAX_WIDTH); /* mac 32k limitation */ \ + CHECKARRAY(sSpan, return); /* mac 32k limitation */ \ + CHECKARRAY(tSpan, return); /* mac 32k limitation */ \ + CHECKARRAY(uSpan, return); /* mac 32k limitation */ \ if (flatShade) { \ rFlat = IntToFixed(v2->color[RCOMP]); \ gFlat = IntToFixed(v2->color[GCOMP]); \ @@ -1877,7 +1913,6 @@ static void general_textured_triangle( GLcontext *ctx, GLdepth zSpan[MAX_WIDTH]; \ GLfloat fogSpan[MAX_WIDTH]; \ GLchan rgbaSpan[MAX_WIDTH][4]; \ - GLfloat sSpan[MAX_WIDTH], tSpan[MAX_WIDTH], uSpan[MAX_WIDTH]; \ GLuint i; \ if (flatShade) { \ span.red = rFlat; span.redStep = 0; \ @@ -1912,6 +1947,11 @@ static void general_textured_triangle( GLcontext *ctx, zSpan, fogSpan, sSpan, tSpan, uSpan, \ NULL, rgbaSpan, NULL, NULL, GL_POLYGON ); +#define CLEANUP_CODE \ + UNDEFARRAY(sSpan); /* mac 32k limitation */ \ + UNDEFARRAY(tSpan); \ + UNDEFARRAY(uSpan); + #include "s_tritemp.h" } diff --git a/src/mesa/swrast/s_tritemp.h b/src/mesa/swrast/s_tritemp.h index 09e1223506..142bd0992e 100644 --- a/src/mesa/swrast/s_tritemp.h +++ b/src/mesa/swrast/s_tritemp.h @@ -1,4 +1,4 @@ -/* $Id: s_tritemp.h,v 1.16 2001/05/14 16:23:04 brianp Exp $ */ +/* $Id: s_tritemp.h,v 1.17 2001/05/16 20:27:12 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -60,6 +60,7 @@ * * Optionally, one may provide one-time setup code per triangle: * SETUP_CODE - code which is to be executed once per triangle + * CLEANUP_CODE - code to execute at end of triangle * * The following macro MUST be defined: * RENDER_SPAN(span) - code to write a span of pixels. @@ -1187,10 +1188,14 @@ } /* for subTriangle */ } +#ifdef CLEANUP_CODE + CLEANUP_CODE +#endif } } #undef SETUP_CODE +#undef CLEANUP_CODE #undef RENDER_SPAN #undef PIXEL_TYPE |