mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
use DEFARRAY, etc macros to work around 32k data limit on Macs (Tom Goon)
This commit is contained in:
parent
441a4af435
commit
47cf442c11
9 changed files with 174 additions and 49 deletions
|
|
@ -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 */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue