-/* $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
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];
/* 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 */
}
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++) {
_mesa_pack_float_rgba_span(ctx, n, (const GLfloat (*)[4]) rgba,
dstFormat, dstType, dstAddr,
dstPacking, transferOps);
+ UNDEFARRAY(rgba); /* mac 32k limitation */
}
}
/* 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 */
for (i = 0; i < n; i++) {
dest[i] = (GLchan) (indexes[i] & 0xff);
}
+ UNDEFARRAY(rgba); /* mac 32k limitation */
return;
}
else {
break;
default:
_mesa_problem(ctx, "bad dstFormat in _mesa_unpack_chan_span()");
+ UNDEFARRAY(rgba); /* mac 32k limitation */
return;
}
dst += dstComponents;
}
}
+ UNDEFARRAY(rgba); /* mac 32k limitation */
}
}
/* 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 */
for (i = 0; i < n; i++) {
dest[i] = (GLchan) (indexes[i] & 0xff);
}
+ UNDEFARRAY(rgba); /* mac 32k limitation */
return;
}
else {
break;
default:
_mesa_problem(ctx, "bad dstFormat in _mesa_unpack_float_color_span()");
+ UNDEFARRAY(rgba); /* mac 32k limitation */
return;
}
dst += dstComponents;
}
}
+ UNDEFARRAY(rgba); /* mac 32k limitation */
}
}
-/* $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
*/
+#include "mem.h"
#include "mmath.h"
#include "s_aatriangle.h"
#include "s_context.h"
-/* $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
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
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];
#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
}
-/* $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
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;
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++) {
(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) {
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;
}
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;
}
}
- if (overlapping)
- FREE(tmpImage);
+ UNDEFARRAY(rgba); /* mac 32k limitation */
+
+ if (overlapping)
+ FREE(tmpImage);
}
-/* $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
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++) {
rgba);
}
}
+ UNDEFARRAY(s); /* mac 32k limitation */
+ UNDEFARRAY(t);
+ UNDEFARRAY(r);
+ UNDEFARRAY(q);
}
if (quickDraw) {
-/* $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
* 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 */
-/* $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
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);
rgba[i][ACOMP] = rgba[i][RCOMP];
}
}
+ UNDEFARRAY(ccolor); /* mac 32k limitation */
}
#undef PROD
-/* $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
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;
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);
}
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]); \
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; \
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"
}
-/* $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
*
* 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.
} /* for subTriangle */
}
+#ifdef CLEANUP_CODE
+ CLEANUP_CODE
+#endif
}
}
#undef SETUP_CODE
+#undef CLEANUP_CODE
#undef RENDER_SPAN
#undef PIXEL_TYPE