summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2006-04-14 02:20:18 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2006-04-14 02:20:18 +0000
commitee4e75bd6f768b7210436feeb32b4545ed62e025 (patch)
tree2684654e69d43aa244fc6082717523da202aa43e /src
parent1d886a81add08536f18d2453ae38fcac79f0b806 (diff)
Replace ctx->Const.MaxTextureUnits w/ ctx->Const.MaxTexture[Coord/Image]Units
in various places. Note that ctx->Texture.CurrentUnit needs to be tested against Coord/Image limits when referenced, not just in glActiveTexture().
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/matrix.c4
-rw-r--r--src/mesa/main/mtypes.h6
-rw-r--r--src/mesa/main/texstate.c143
-rw-r--r--src/mesa/swrast/s_context.c11
-rw-r--r--src/mesa/swrast/s_span.c3
-rw-r--r--src/mesa/tnl/t_array_api.c6
-rw-r--r--src/mesa/tnl/t_vb_arbprogram.c2
-rw-r--r--src/mesa/tnl/t_vb_arbshader.c4
-rw-r--r--src/mesa/tnl/t_vb_program.c2
9 files changed, 134 insertions, 47 deletions
diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c
index 5ff250a0c7..7339b0ce40 100644
--- a/src/mesa/main/matrix.c
+++ b/src/mesa/main/matrix.c
@@ -160,6 +160,10 @@ _mesa_MatrixMode( GLenum mode )
ctx->CurrentStack = &ctx->ProjectionMatrixStack;
break;
case GL_TEXTURE:
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glMatrixMode(texcoord unit)");
+ return;
+ }
ctx->CurrentStack = &ctx->TextureMatrixStack[ctx->Texture.CurrentUnit];
break;
case GL_COLOR:
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index c8831386bb..a78a7d1927 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -634,7 +634,7 @@ struct gl_current_attrib
GLfloat RasterColor[4]; /**< Current raster color */
GLfloat RasterSecondaryColor[4]; /**< Current raster secondary color */
GLfloat RasterIndex; /**< Current raster index */
- GLfloat RasterTexCoords[MAX_TEXTURE_UNITS][4];/**< Current raster texcoords */
+ GLfloat RasterTexCoords[MAX_TEXTURE_COORD_UNITS][4];
GLboolean RasterPosValid; /**< Raster pos valid flag */
/*@}*/
};
@@ -1048,8 +1048,8 @@ struct gl_point_attrib
GLfloat MinSize, MaxSize; /**< GL_EXT_point_parameters */
GLfloat Threshold; /**< GL_EXT_point_parameters */
GLboolean _Attenuated; /**< True if Params != [1, 0, 0] */
- GLboolean PointSprite; /**< GL_NV_point_sprite / GL_NV_point_sprite */
- GLboolean CoordReplace[MAX_TEXTURE_UNITS]; /**< GL_NV/ARB_point_sprite */
+ GLboolean PointSprite; /**< GL_NV/ARB_point_sprite */
+ GLboolean CoordReplace[MAX_TEXTURE_COORD_UNITS]; /**< GL_ARB_point_sprite */
GLenum SpriteRMode; /**< GL_NV_point_sprite (only!) */
GLenum SpriteOrigin; /**< GL_ARB_point_sprite */
};
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index daf579a7bf..4bd9895cd5 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -312,10 +312,20 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state,
void GLAPIENTRY
_mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
{
+ GLuint maxUnit;
GET_CURRENT_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ struct gl_texture_unit *texUnit;
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
+ ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxTextureImageUnits;
+ if (ctx->Texture.CurrentUnit >= maxUnit) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glTexEnvfv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
#define TE_ERROR(errCode, msg, value) \
_mesa_error(ctx, errCode, msg, _mesa_lookup_enum_by_nr(value));
@@ -795,10 +805,20 @@ _mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param )
void GLAPIENTRY
_mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
{
+ GLuint maxUnit;
+ const struct gl_texture_unit *texUnit;
GET_CURRENT_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
+ ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxTextureImageUnits;
+ if (ctx->Texture.CurrentUnit >= maxUnit) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexEnvfv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
if (target == GL_TEXTURE_ENV) {
switch (pname) {
case GL_TEXTURE_ENV_MODE:
@@ -1006,10 +1026,20 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
void GLAPIENTRY
_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
{
+ GLuint maxUnit;
+ const struct gl_texture_unit *texUnit;
GET_CURRENT_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
+ ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxTextureImageUnits;
+ if (ctx->Texture.CurrentUnit >= maxUnit) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexEnviv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
if (target == GL_TEXTURE_ENV) {
switch (pname) {
case GL_TEXTURE_ENV_MODE:
@@ -1264,10 +1294,10 @@ _mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param )
void GLAPIENTRY
_mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- GLenum eparam = (GLenum) (GLint) params[0];
+ const GLenum eparam = (GLenum) (GLint) params[0];
+ struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
+ GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
@@ -1277,6 +1307,12 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
*params,
_mesa_lookup_enum_by_nr(eparam));
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureImageUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameterfv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
switch (target) {
case GL_TEXTURE_1D:
@@ -1662,14 +1698,22 @@ void GLAPIENTRY
_mesa_GetTexLevelParameteriv( GLenum target, GLint level,
GLenum pname, GLint *params )
{
- GET_CURRENT_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ const struct gl_texture_unit *texUnit;
const struct gl_texture_image *img = NULL;
GLuint dimensions;
GLboolean isProxy;
GLint maxLevels;
+ GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureImageUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGetTexLevelParameteriv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
/* this will catch bad target values */
dimensions = tex_image_dimensions(ctx, target); /* 1, 2 or 3 */
if (dimensions == 0) {
@@ -1884,11 +1928,19 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
void GLAPIENTRY
_mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ struct gl_texture_unit *texUnit;
struct gl_texture_object *obj;
+ GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureImageUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGetTexParameterfv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
obj = _mesa_select_tex_object(ctx, texUnit, target);
if (!obj) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(target)");
@@ -2008,11 +2060,19 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
void GLAPIENTRY
_mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ struct gl_texture_unit *texUnit;
struct gl_texture_object *obj;
+ GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureImageUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGetTexParameteriv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
obj = _mesa_select_tex_object(ctx, texUnit, target);
if (!obj) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameteriv(target)");
@@ -2146,8 +2206,7 @@ void GLAPIENTRY
_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
- GLuint tUnit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];
+ struct gl_texture_unit *texUnit;
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
@@ -2157,6 +2216,13 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
*params,
_mesa_lookup_enum_by_nr((GLenum) (GLint) *params));
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glTexGen(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
switch (coord) {
case GL_S:
if (pname==GL_TEXTURE_GEN_MODE) {
@@ -2428,11 +2494,17 @@ _mesa_TexGeni( GLenum coord, GLenum pname, GLint param )
void GLAPIENTRY
_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
{
+ const struct gl_texture_unit *texUnit;
GET_CURRENT_CONTEXT(ctx);
- GLuint tUnit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGendv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
switch (coord) {
case GL_S:
if (pname==GL_TEXTURE_GEN_MODE) {
@@ -2505,11 +2577,17 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
void GLAPIENTRY
_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
{
+ const struct gl_texture_unit *texUnit;
GET_CURRENT_CONTEXT(ctx);
- GLuint tUnit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGenfv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
switch (coord) {
case GL_S:
if (pname==GL_TEXTURE_GEN_MODE) {
@@ -2582,11 +2660,17 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
void GLAPIENTRY
_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
{
+ const struct gl_texture_unit *texUnit;
GET_CURRENT_CONTEXT(ctx);
- GLuint tUnit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGeniv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
switch (coord) {
case GL_S:
if (pname==GL_TEXTURE_GEN_MODE) {
@@ -2679,21 +2763,22 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
}
#endif
+
/* GL_ARB_multitexture */
void GLAPIENTRY
-_mesa_ActiveTextureARB( GLenum target )
+_mesa_ActiveTextureARB(GLenum texture)
{
GET_CURRENT_CONTEXT(ctx);
- const GLuint texUnit = target - GL_TEXTURE0;
+ const GLuint texUnit = texture - GL_TEXTURE0;
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
_mesa_debug(ctx, "glActiveTexture %s\n",
- _mesa_lookup_enum_by_nr(target));
+ _mesa_lookup_enum_by_nr(texture));
- /* Cater for texture unit 0 is first, therefore use >= */
+ /* XXX error-check against max(coordunits, imageunits) */
if (texUnit >= ctx->Const.MaxTextureUnits) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glActiveTexture(target)");
+ _mesa_error(ctx, GL_INVALID_ENUM, "glActiveTexture(texture)");
return;
}
@@ -2716,14 +2801,14 @@ _mesa_ActiveTextureARB( GLenum target )
/* GL_ARB_multitexture */
void GLAPIENTRY
-_mesa_ClientActiveTextureARB( GLenum target )
+_mesa_ClientActiveTextureARB(GLenum texture)
{
GET_CURRENT_CONTEXT(ctx);
- GLuint texUnit = target - GL_TEXTURE0;
+ GLuint texUnit = texture - GL_TEXTURE0;
ASSERT_OUTSIDE_BEGIN_END(ctx);
- if (texUnit >= ctx->Const.MaxTextureUnits) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glClientActiveTexture(target)");
+ if (texUnit >= ctx->Const.MaxTextureCoordUnits) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glClientActiveTexture(texture)");
return;
}
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index ea283a1943..c544e6c166 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -2,7 +2,7 @@
* Mesa 3-D graphics library
* Version: 6.5
*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -487,7 +487,7 @@ _swrast_invalidate_state( GLcontext *ctx, GLbitfield new_state )
swrast->BlendFunc = _swrast_validate_blend_func;
if (new_state & _SWRAST_NEW_TEXTURE_SAMPLE_FUNC)
- for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
+ for (i = 0 ; i < ctx->Const.MaxTextureImageUnits ; i++)
swrast->TextureSample[i] = NULL;
}
@@ -688,10 +688,7 @@ _swrast_CreateContext( GLcontext *ctx )
swrast->PointSpan.facing = 0;
swrast->PointSpan.array = swrast->SpanArrays;
- assert(ctx->Const.MaxTextureUnits > 0);
- assert(ctx->Const.MaxTextureUnits <= MAX_TEXTURE_UNITS);
-
- swrast->TexelBuffer = (GLchan *) MALLOC(ctx->Const.MaxTextureUnits *
+ swrast->TexelBuffer = (GLchan *) MALLOC(ctx->Const.MaxTextureImageUnits *
MAX_WIDTH * 4 * sizeof(GLchan));
if (!swrast->TexelBuffer) {
FREE(swrast->SpanArrays);
@@ -786,7 +783,7 @@ _swrast_print_vertex( GLcontext *ctx, const SWvertex *v )
_mesa_debug(ctx, "win %f %f %f %f\n",
v->win[0], v->win[1], v->win[2], v->win[3]);
- for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
+ for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
if (ctx->Texture.Unit[i]._ReallyEnabled)
_mesa_debug(ctx, "texcoord[%d] %f %f %f %f\n", i,
v->texcoord[i][0], v->texcoord[i][1],
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 11457723b0..35735a411f 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -127,7 +127,7 @@ void
_swrast_span_default_texcoords( GLcontext *ctx, struct sw_span *span )
{
GLuint i;
- for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
+ for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
const GLfloat *tc = ctx->Current.RasterTexCoords[i];
if (ctx->FragmentProgram._Active || ctx->ATIFragmentShader._Enabled) {
COPY_4V(span->tex[i], tc);
@@ -401,6 +401,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span)
/* multitexture */
GLuint u;
span->arrayMask |= SPAN_TEXTURE;
+ /* XXX CoordUnits vs. ImageUnits */
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
if (ctx->Texture._EnabledCoordUnits & (1 << u)) {
const struct gl_texture_object *obj =ctx->Texture.Unit[u]._Current;
diff --git a/src/mesa/tnl/t_array_api.c b/src/mesa/tnl/t_array_api.c
index 8ceca29c25..36ea54296c 100644
--- a/src/mesa/tnl/t_array_api.c
+++ b/src/mesa/tnl/t_array_api.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.1
+ * Version: 6.5
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -399,7 +399,7 @@ void _tnl_array_init( GLcontext *ctx )
_mesa_vector4f_init( &tmp->FogCoord, 0, NULL);
_mesa_vector4f_init( &tmp->Index, 0, NULL);
- for (i = 0; i < ctx->Const.MaxTextureUnits; i++)
+ for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++)
_mesa_vector4f_init( &tmp->TexCoord[i], 0, NULL);
}
diff --git a/src/mesa/tnl/t_vb_arbprogram.c b/src/mesa/tnl/t_vb_arbprogram.c
index 1f492b6beb..9fa53e2d5b 100644
--- a/src/mesa/tnl/t_vb_arbprogram.c
+++ b/src/mesa/tnl/t_vb_arbprogram.c
@@ -1394,7 +1394,7 @@ run_arb_vertex_program(GLcontext *ctx, struct tnl_pipeline_stage *stage)
VB->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &m->attribs[VERT_RESULT_PSIZ];
}
- for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
+ for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
if (outputs & (1<<(VERT_RESULT_TEX0+i))) {
VB->TexCoordPtr[i] = &m->attribs[VERT_RESULT_TEX0 + i];
VB->AttribPtr[VERT_ATTRIB_TEX0+i] = VB->TexCoordPtr[i];
diff --git a/src/mesa/tnl/t_vb_arbshader.c b/src/mesa/tnl/t_vb_arbshader.c
index b1d024e0cc..d33389e514 100644
--- a/src/mesa/tnl/t_vb_arbshader.c
+++ b/src/mesa/tnl/t_vb_arbshader.c
@@ -231,7 +231,7 @@ static GLboolean run_arb_vertex_shader (GLcontext *ctx, struct tnl_pipeline_stag
vb->ClipPtr->count = vb->Count;
vb->ColorPtr[0] = &store->outputs[VERT_RESULT_COL0];
vb->SecondaryColorPtr[0] = &store->outputs[VERT_RESULT_COL1];
- for (i = 0; i < ctx->Const.MaxTextureUnits; i++)
+ for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++)
vb->TexCoordPtr[i] = &store->outputs[VERT_RESULT_TEX0 + i];
vb->ColorPtr[1] = &store->outputs[VERT_RESULT_BFC0];
vb->SecondaryColorPtr[1] = &store->outputs[VERT_RESULT_BFC1];
@@ -243,7 +243,7 @@ static GLboolean run_arb_vertex_shader (GLcontext *ctx, struct tnl_pipeline_stag
vb->AttribPtr[VERT_ATTRIB_COLOR0] = vb->ColorPtr[0];
vb->AttribPtr[VERT_ATTRIB_COLOR1] = vb->SecondaryColorPtr[0];
vb->AttribPtr[VERT_ATTRIB_FOG] = vb->FogCoordPtr;
- for (i = 0; i < ctx->Const.MaxTextureUnits; i++)
+ for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++)
vb->AttribPtr[VERT_ATTRIB_TEX0 + i] = vb->TexCoordPtr[i];
vb->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->outputs[VERT_RESULT_PSIZ];
for (i = 0; i < MAX_VARYING_VECTORS; i++)
diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c
index 13db40aa60..7a98db85fd 100644
--- a/src/mesa/tnl/t_vb_program.c
+++ b/src/mesa/tnl/t_vb_program.c
@@ -165,7 +165,7 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage )
VB->AttribPtr[VERT_ATTRIB_FOG] = VB->FogCoordPtr;
VB->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->attribs[VERT_RESULT_PSIZ];
- for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
+ for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
VB->AttribPtr[VERT_ATTRIB_TEX0+i] = VB->TexCoordPtr[i] =
&store->attribs[VERT_RESULT_TEX0 + i];
}