From a32e7c487cbae1a8521fa2d244763e2ec596af91 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 3 Feb 2010 13:20:04 -0700 Subject: [PATCH] mesa: added tex unit assert, use Elements() macro --- src/mesa/main/rastpos.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; } -- 2.30.2