summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2001-05-16 20:27:12 +0000
committerBrian Paul <[email protected]>2001-05-16 20:27:12 +0000
commit47cf442c1164b6b406117fccfb8b564602741ee3 (patch)
treecd3e7c6147b0b19b091c38ad78785e8d18235ea3 /src/mesa/swrast
parent441a4af435b46e1b475318fbaf4e80b774390cb0 (diff)
use DEFARRAY, etc macros to work around 32k data limit on Macs (Tom Goon)
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_aatriangle.c3
-rw-r--r--src/mesa/swrast/s_aatritemp.h54
-rw-r--r--src/mesa/swrast/s_copypix.c36
-rw-r--r--src/mesa/swrast/s_drawpix.c17
-rw-r--r--src/mesa/swrast/s_readpix.c6
-rw-r--r--src/mesa/swrast/s_texture.c6
-rw-r--r--src/mesa/swrast/s_triangle.c66
-rw-r--r--src/mesa/swrast/s_tritemp.h7
8 files changed, 152 insertions, 43 deletions
diff --git a/src/mesa/swrast/s_aatriangle.c b/src/mesa/swrast/s_aatriangle.c
index d81250292dd..5b8cdbf6a41 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 9f6695ce33e..d2a866b8a34 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 36e9974d387..a4a34ba5925 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 e914eb70136..59b2d0294b3 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 d95bba64c86..5fc03da27d7 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 ae18bff0dee..a5a64d04662 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 b3c58101237..2c117b869cb 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 09e12235067..142bd0992e5 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