From: Brian Paul Date: Wed, 3 Feb 2010 20:20:04 +0000 (-0700) Subject: mesa: added tex unit assert, use Elements() macro X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a32e7c487cbae1a8521fa2d244763e2ec596af91;p=mesa.git mesa: added tex unit assert, use Elements() macro --- diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c index 703b47ec742..be61dc265d1 100644 --- a/src/mesa/main/rastpos.c +++ b/src/mesa/main/rastpos.c @@ -273,6 +273,7 @@ window_pos3f(GLfloat x, GLfloat y, GLfloat z) { GLuint texSet; for (texSet = 0; texSet < ctx->Const.MaxTextureCoordUnits; texSet++) { + assert(texSet < Elements(ctx->Current.RasterTexCoords)); COPY_4FV( ctx->Current.RasterTexCoords[texSet], ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texSet] ); } @@ -562,7 +563,7 @@ void _mesa_init_rastpos( GLcontext * ctx ) ASSIGN_4V( ctx->Current.RasterColor, 1.0, 1.0, 1.0, 1.0 ); ASSIGN_4V( ctx->Current.RasterSecondaryColor, 0.0, 0.0, 0.0, 1.0 ); ctx->Current.RasterIndex = 1.0; - for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) + for (i = 0; i < Elements(ctx->Current.RasterTexCoords); i++) ASSIGN_4V( ctx->Current.RasterTexCoords[i], 0.0, 0.0, 0.0, 1.0 ); ctx->Current.RasterPosValid = GL_TRUE; }