diff options
Diffstat (limited to 'src')
27 files changed, 134 insertions, 174 deletions
diff --git a/src/mesa/array_cache/ac_context.c b/src/mesa/array_cache/ac_context.c index ebf3a3dc47..ff143c13e2 100644 --- a/src/mesa/array_cache/ac_context.c +++ b/src/mesa/array_cache/ac_context.c @@ -96,7 +96,7 @@ static void _ac_fallbacks_init( GLcontext *ctx ) cl->Type = GL_FLOAT; cl->Stride = 0; cl->StrideB = 0; - cl->Ptr = (GLubyte *) &ctx->Current.Index; + cl->Ptr = (GLubyte *) &ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX]; cl->Enabled = 1; cl->Flags = CA_CLIENT_DATA; /* hack */ #if FEATURE_ARB_vertex_buffer_object diff --git a/src/mesa/main/api_loopback.c b/src/mesa/main/api_loopback.c index db30059e61..51d5af6f5f 100644 --- a/src/mesa/main/api_loopback.c +++ b/src/mesa/main/api_loopback.c @@ -281,6 +281,7 @@ loopback_Color4ubv_f( const GLubyte *v) UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3]) ); } + static void GLAPIENTRY loopback_FogCoorddEXT( GLdouble d ) { @@ -342,6 +343,14 @@ loopback_Indexubv( const GLubyte *c ) INDEX( (GLfloat) *c ); } + +static void GLAPIENTRY +loopback_EdgeFlagv(const GLboolean *flag) +{ + CALL_EdgeFlag(GET_DISPATCH(), (*flag)); +} + + static void GLAPIENTRY loopback_Normal3b( GLbyte nx, GLbyte ny, GLbyte nz ) { @@ -1483,6 +1492,8 @@ _mesa_loopback_init_api_table( struct _glapi_table *dest ) SET_SecondaryColor3usvEXT(dest, loopback_SecondaryColor3usvEXT_f); SET_SecondaryColor3ubvEXT(dest, loopback_SecondaryColor3ubvEXT_f); + SET_EdgeFlagv(dest, loopback_EdgeFlagv); + SET_Indexd(dest, loopback_Indexd); SET_Indexi(dest, loopback_Indexi); SET_Indexs(dest, loopback_Indexs); diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c index 2bc1a133ec..33d44e4329 100644 --- a/src/mesa/main/api_noop.c +++ b/src/mesa/main/api_noop.c @@ -48,22 +48,16 @@ static void GLAPIENTRY _mesa_noop_EdgeFlag( GLboolean b ) ctx->Current.EdgeFlag = b; } -static void GLAPIENTRY _mesa_noop_EdgeFlagv( const GLboolean *b ) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Current.EdgeFlag = *b; -} - static void GLAPIENTRY _mesa_noop_Indexf( GLfloat f ) { GET_CURRENT_CONTEXT(ctx); - ctx->Current.Index = f; + ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0] = f; } static void GLAPIENTRY _mesa_noop_Indexfv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - ctx->Current.Index = *v; + ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0] = *v; } static void GLAPIENTRY _mesa_noop_FogCoordfEXT( GLfloat a ) @@ -917,7 +911,6 @@ _mesa_noop_vtxfmt_init( GLvertexformat *vfmt ) vfmt->Color4f = _mesa_noop_Color4f; vfmt->Color4fv = _mesa_noop_Color4fv; vfmt->EdgeFlag = _mesa_noop_EdgeFlag; - vfmt->EdgeFlagv = _mesa_noop_EdgeFlagv; vfmt->End = _mesa_noop_End; vfmt->EvalCoord1f = _mesa_noop_EvalCoord1f; vfmt->EvalCoord1fv = _mesa_noop_EvalCoord1fv; diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 544a3036c6..36c5f2a689 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -913,18 +913,18 @@ _mesa_init_current( GLcontext *ctx ) { GLuint i; - /* Current group */ + /* Init all to (0,0,0,1) */ for (i = 0; i < VERT_ATTRIB_MAX; i++) { ASSIGN_4V( ctx->Current.Attrib[i], 0.0, 0.0, 0.0, 1.0 ); } - /* special cases: */ + + /* redo special cases: */ ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_WEIGHT], 1.0, 0.0, 0.0, 1.0 ); ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_NORMAL], 0.0, 0.0, 1.0, 1.0 ); ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR0], 1.0, 1.0, 1.0, 1.0 ); ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR1], 0.0, 0.0, 0.0, 1.0 ); ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_FOG], 0.0, 0.0, 0.0, 0.0 ); - - ctx->Current.Index = 1; + ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0] = 1.0; ctx->Current.EdgeFlag = GL_TRUE; } diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index b1c78f2232..4d9cea1e59 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -975,7 +975,6 @@ typedef struct { void (GLAPIENTRYP Color4f)( GLfloat, GLfloat, GLfloat, GLfloat ); void (GLAPIENTRYP Color4fv)( const GLfloat * ); void (GLAPIENTRYP EdgeFlag)( GLboolean ); - void (GLAPIENTRYP EdgeFlagv)( const GLboolean * ); void (GLAPIENTRYP EvalCoord1f)( GLfloat ); /* NOTE */ void (GLAPIENTRYP EvalCoord1fv)( const GLfloat * ); /* NOTE */ void (GLAPIENTRYP EvalCoord2f)( GLfloat, GLfloat ); /* NOTE */ diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 790cace05c..cbf00f735e 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -5067,12 +5067,6 @@ save_EdgeFlag(GLboolean x) } static void GLAPIENTRY -save_EdgeFlagv(const GLboolean * v) -{ - save_EdgeFlag(v[0]); -} - -static void GLAPIENTRY save_Materialfv(GLenum face, GLenum pname, const GLfloat * param) { GET_CURRENT_CONTEXT(ctx); @@ -8447,7 +8441,6 @@ _mesa_save_vtxfmt_init(GLvertexformat * vfmt) vfmt->Color4f = save_Color4f; vfmt->Color4fv = save_Color4fv; vfmt->EdgeFlag = save_EdgeFlag; - vfmt->EdgeFlagv = save_EdgeFlagv; vfmt->End = save_End; vfmt->EvalCoord1f = save_EvalCoord1f; vfmt->EvalCoord1fv = save_EvalCoord1fv; diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 9b322908d1..9684ccb8a4 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -230,7 +230,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) case GL_CURRENT_INDEX: { FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Index); + params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]); } break; case GL_CURRENT_NORMAL: @@ -2048,7 +2048,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) case GL_CURRENT_INDEX: { FLUSH_CURRENT(ctx, 0); - params[0] = ctx->Current.Index; + params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]; } break; case GL_CURRENT_NORMAL: @@ -3866,7 +3866,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) case GL_CURRENT_INDEX: { FLUSH_CURRENT(ctx, 0); - params[0] = IROUND(ctx->Current.Index); + params[0] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]); } break; case GL_CURRENT_NORMAL: diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py index 9dd6b8f79e..63aed5ab25 100644 --- a/src/mesa/main/get_gen.py +++ b/src/mesa/main/get_gen.py @@ -135,7 +135,8 @@ StateVars = [ "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]", "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]" ], "FLUSH_CURRENT(ctx, 0);", None ), - ( "GL_CURRENT_INDEX", GLfloat, ["ctx->Current.Index"], + ( "GL_CURRENT_INDEX", GLfloat, + [ "ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]" ], "FLUSH_CURRENT(ctx, 0);", None ), ( "GL_CURRENT_NORMAL", GLfloatN, [ "ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]", diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 244d1c64f8..e9e26d53f0 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -142,7 +142,7 @@ enum VERT_ATTRIB_COLOR0 = 3, VERT_ATTRIB_COLOR1 = 4, VERT_ATTRIB_FOG = 5, - VERT_ATTRIB_SIX = 6, + VERT_ATTRIB_COLOR_INDEX = 6, VERT_ATTRIB_SEVEN = 7, VERT_ATTRIB_TEX0 = 8, VERT_ATTRIB_TEX1 = 9, @@ -176,38 +176,38 @@ enum * These are used in bitfields in many places. */ /*@{*/ -#define VERT_BIT_POS (1 << VERT_ATTRIB_POS) -#define VERT_BIT_WEIGHT (1 << VERT_ATTRIB_WEIGHT) -#define VERT_BIT_NORMAL (1 << VERT_ATTRIB_NORMAL) -#define VERT_BIT_COLOR0 (1 << VERT_ATTRIB_COLOR0) -#define VERT_BIT_COLOR1 (1 << VERT_ATTRIB_COLOR1) -#define VERT_BIT_FOG (1 << VERT_ATTRIB_FOG) -#define VERT_BIT_SIX (1 << VERT_ATTRIB_SIX) -#define VERT_BIT_SEVEN (1 << VERT_ATTRIB_SEVEN) -#define VERT_BIT_TEX0 (1 << VERT_ATTRIB_TEX0) -#define VERT_BIT_TEX1 (1 << VERT_ATTRIB_TEX1) -#define VERT_BIT_TEX2 (1 << VERT_ATTRIB_TEX2) -#define VERT_BIT_TEX3 (1 << VERT_ATTRIB_TEX3) -#define VERT_BIT_TEX4 (1 << VERT_ATTRIB_TEX4) -#define VERT_BIT_TEX5 (1 << VERT_ATTRIB_TEX5) -#define VERT_BIT_TEX6 (1 << VERT_ATTRIB_TEX6) -#define VERT_BIT_TEX7 (1 << VERT_ATTRIB_TEX7) -#define VERT_BIT_GENERIC0 (1 << VERT_ATTRIB_GENERIC0) -#define VERT_BIT_GENERIC1 (1 << VERT_ATTRIB_GENERIC1) -#define VERT_BIT_GENERIC2 (1 << VERT_ATTRIB_GENERIC2) -#define VERT_BIT_GENERIC3 (1 << VERT_ATTRIB_GENERIC3) -#define VERT_BIT_GENERIC4 (1 << VERT_ATTRIB_GENERIC4) -#define VERT_BIT_GENERIC5 (1 << VERT_ATTRIB_GENERIC5) -#define VERT_BIT_GENERIC6 (1 << VERT_ATTRIB_GENERIC6) -#define VERT_BIT_GENERIC7 (1 << VERT_ATTRIB_GENERIC7) -#define VERT_BIT_GENERIC8 (1 << VERT_ATTRIB_GENERIC8) -#define VERT_BIT_GENERIC9 (1 << VERT_ATTRIB_GENERIC9) -#define VERT_BIT_GENERIC10 (1 << VERT_ATTRIB_GENERIC10) -#define VERT_BIT_GENERIC11 (1 << VERT_ATTRIB_GENERIC11) -#define VERT_BIT_GENERIC12 (1 << VERT_ATTRIB_GENERIC12) -#define VERT_BIT_GENERIC13 (1 << VERT_ATTRIB_GENERIC13) -#define VERT_BIT_GENERIC14 (1 << VERT_ATTRIB_GENERIC14) -#define VERT_BIT_GENERIC15 (1 << VERT_ATTRIB_GENERIC15) +#define VERT_BIT_POS (1 << VERT_ATTRIB_POS) +#define VERT_BIT_WEIGHT (1 << VERT_ATTRIB_WEIGHT) +#define VERT_BIT_NORMAL (1 << VERT_ATTRIB_NORMAL) +#define VERT_BIT_COLOR0 (1 << VERT_ATTRIB_COLOR0) +#define VERT_BIT_COLOR1 (1 << VERT_ATTRIB_COLOR1) +#define VERT_BIT_FOG (1 << VERT_ATTRIB_FOG) +#define VERT_BIT_COLOR_INDEX (1 << VERT_ATTRIB_COLOR_INDEX) +#define VERT_BIT_SEVEN (1 << VERT_ATTRIB_SEVEN) +#define VERT_BIT_TEX0 (1 << VERT_ATTRIB_TEX0) +#define VERT_BIT_TEX1 (1 << VERT_ATTRIB_TEX1) +#define VERT_BIT_TEX2 (1 << VERT_ATTRIB_TEX2) +#define VERT_BIT_TEX3 (1 << VERT_ATTRIB_TEX3) +#define VERT_BIT_TEX4 (1 << VERT_ATTRIB_TEX4) +#define VERT_BIT_TEX5 (1 << VERT_ATTRIB_TEX5) +#define VERT_BIT_TEX6 (1 << VERT_ATTRIB_TEX6) +#define VERT_BIT_TEX7 (1 << VERT_ATTRIB_TEX7) +#define VERT_BIT_GENERIC0 (1 << VERT_ATTRIB_GENERIC0) +#define VERT_BIT_GENERIC1 (1 << VERT_ATTRIB_GENERIC1) +#define VERT_BIT_GENERIC2 (1 << VERT_ATTRIB_GENERIC2) +#define VERT_BIT_GENERIC3 (1 << VERT_ATTRIB_GENERIC3) +#define VERT_BIT_GENERIC4 (1 << VERT_ATTRIB_GENERIC4) +#define VERT_BIT_GENERIC5 (1 << VERT_ATTRIB_GENERIC5) +#define VERT_BIT_GENERIC6 (1 << VERT_ATTRIB_GENERIC6) +#define VERT_BIT_GENERIC7 (1 << VERT_ATTRIB_GENERIC7) +#define VERT_BIT_GENERIC8 (1 << VERT_ATTRIB_GENERIC8) +#define VERT_BIT_GENERIC9 (1 << VERT_ATTRIB_GENERIC9) +#define VERT_BIT_GENERIC10 (1 << VERT_ATTRIB_GENERIC10) +#define VERT_BIT_GENERIC11 (1 << VERT_ATTRIB_GENERIC11) +#define VERT_BIT_GENERIC12 (1 << VERT_ATTRIB_GENERIC12) +#define VERT_BIT_GENERIC13 (1 << VERT_ATTRIB_GENERIC13) +#define VERT_BIT_GENERIC14 (1 << VERT_ATTRIB_GENERIC14) +#define VERT_BIT_GENERIC15 (1 << VERT_ATTRIB_GENERIC15) #define VERT_BIT_TEX(u) (1 << (VERT_ATTRIB_TEX0 + (u))) #define VERT_BIT_GENERIC(g) (1 << (VERT_ATTRIB_GENERIC0 + (g))) @@ -2566,7 +2566,7 @@ struct matrix_stack #define _NEW_ARRAY_COLOR0 VERT_BIT_COLOR0 #define _NEW_ARRAY_COLOR1 VERT_BIT_COLOR1 #define _NEW_ARRAY_FOGCOORD VERT_BIT_FOG -#define _NEW_ARRAY_INDEX VERT_BIT_SIX +#define _NEW_ARRAY_INDEX VERT_BIT_COLOR_INDEX #define _NEW_ARRAY_EDGEFLAG VERT_BIT_SEVEN #define _NEW_ARRAY_TEXCOORD_0 VERT_BIT_TEX0 #define _NEW_ARRAY_TEXCOORD_1 VERT_BIT_TEX1 diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c index 507eb9f984..4f490db724 100644 --- a/src/mesa/main/rastpos.c +++ b/src/mesa/main/rastpos.c @@ -503,7 +503,8 @@ raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) ctx->Current.Attrib[VERT_ATTRIB_COLOR1]); } else { - ctx->Current.RasterIndex = ctx->Current.Index; + ctx->Current.RasterIndex + = ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]; } } @@ -756,7 +757,8 @@ window_pos3f(GLfloat x, GLfloat y, GLfloat z) = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3], 0.0F, 1.0F); } else { - ctx->Current.RasterIndex = ctx->Current.Index; + ctx->Current.RasterIndex + = ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]; } /* raster texcoord = current texcoord */ diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 761a45f2bd..34eb2c3b8a 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -881,9 +881,13 @@ update_arrays( GLcontext *ctx ) /* 6 */ if (ctx->VertexProgram._Enabled - && ctx->Array.VertexAttrib[VERT_ATTRIB_SIX].Enabled) { - min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_SIX]._MaxElement); + && ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) { + min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR_INDEX]._MaxElement); } + else if (ctx->Array.Index.Enabled) { + min = MIN2(min, ctx->Array.Index._MaxElement); + } + /* 7 */ if (ctx->VertexProgram._Enabled @@ -912,10 +916,6 @@ update_arrays( GLcontext *ctx ) } } - if (ctx->Array.Index.Enabled) { - min = MIN2(min, ctx->Array.Index._MaxElement); - } - if (ctx->Array.EdgeFlag.Enabled) { min = MIN2(min, ctx->Array.EdgeFlag._MaxElement); } diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c index 99583a20da..0204979003 100644 --- a/src/mesa/main/vtxfmt.c +++ b/src/mesa/main/vtxfmt.c @@ -85,7 +85,6 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt ) SET_Color4f(tab, vfmt->Color4f); SET_Color4fv(tab, vfmt->Color4fv); SET_EdgeFlag(tab, vfmt->EdgeFlag); - SET_EdgeFlagv(tab, vfmt->EdgeFlagv); SET_EvalCoord1f(tab, vfmt->EvalCoord1f); SET_EvalCoord1fv(tab, vfmt->EvalCoord1fv); SET_EvalCoord2f(tab, vfmt->EvalCoord2f); diff --git a/src/mesa/main/vtxfmt_tmp.h b/src/mesa/main/vtxfmt_tmp.h index 2a0fdde466..783b06558d 100644 --- a/src/mesa/main/vtxfmt_tmp.h +++ b/src/mesa/main/vtxfmt_tmp.h @@ -68,12 +68,6 @@ static void GLAPIENTRY TAG(EdgeFlag)( GLboolean e ) CALL_EdgeFlag(GET_DISPATCH(), ( e )); } -static void GLAPIENTRY TAG(EdgeFlagv)( const GLboolean *v ) -{ - PRE_LOOPBACK( EdgeFlagv ); - CALL_EdgeFlagv(GET_DISPATCH(), ( v )); -} - static void GLAPIENTRY TAG(EvalCoord1f)( GLfloat s ) { PRE_LOOPBACK( EvalCoord1f ); @@ -467,7 +461,6 @@ static GLvertexformat TAG(vtxfmt) = { TAG(Color4f), TAG(Color4fv), TAG(EdgeFlag), - TAG(EdgeFlagv), TAG(EvalCoord1f), TAG(EvalCoord1fv), TAG(EvalCoord2f), diff --git a/src/mesa/swrast_setup/ss_context.c b/src/mesa/swrast_setup/ss_context.c index 0ce81e0487..99cd7b5a33 100644 --- a/src/mesa/swrast_setup/ss_context.c +++ b/src/mesa/swrast_setup/ss_context.c @@ -133,6 +133,9 @@ _swsetup_RenderStart( GLcontext *ctx ) if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 )) EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_4CHAN_4F_RGBA, specular); + if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR_INDEX )) + EMIT_ATTR( _TNL_ATTRIB_COLOR_INDEX, EMIT_1F, index ); + if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG )) EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1F, fog); @@ -152,9 +155,6 @@ _swsetup_RenderStart( GLcontext *ctx ) } } - if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_INDEX )) - EMIT_ATTR( _TNL_ATTRIB_INDEX, EMIT_1F, index ); - if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_POINTSIZE )) EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F, pointSize ); @@ -247,8 +247,8 @@ _swsetup_Translate( GLcontext *ctx, const void *vertex, SWvertex *dest ) _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_FOG, tmp ); dest->fog = tmp[0]; - _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_INDEX, tmp ); - dest->index = (GLuint) tmp[0]; + _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR_INDEX, tmp ); + dest->index = tmp[0]; _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_POINTSIZE, tmp ); dest->pointSize = tmp[0]; diff --git a/src/mesa/tnl/t_array_import.c b/src/mesa/tnl/t_array_import.c index 7cc834ffa2..0fb3529b6b 100644 --- a/src/mesa/tnl/t_array_import.c +++ b/src/mesa/tnl/t_array_import.c @@ -267,6 +267,7 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLint end) /* When vertex program mode is enabled, the generic vertex program * attribute arrays have priority over the conventional attributes. * Try to use them now. + * XXX that's true of NV_vertex_program, but ARB_vertex_program??? */ for (index = 0; index < VERT_ATTRIB_MAX; index++) { /* When vertex program mode is enabled, the generic vertex attribute @@ -304,6 +305,11 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLint end) tmp->FogCoord.count = VB->Count; VB->AttribPtr[_TNL_ATTRIB_FOG] = &tmp->FogCoord; } + else if (index == VERT_ATTRIB_COLOR_INDEX) { + _tnl_import_index( ctx, 0, 0 ); + tmp->Index.count = VB->Count; + VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX] = &tmp->Index; + } else if (index >= VERT_ATTRIB_TEX0 && index <= VERT_ATTRIB_TEX7) { i = index - VERT_ATTRIB_TEX0; _tnl_import_texcoord( ctx, i, GL_FALSE, GL_FALSE ); @@ -317,19 +323,13 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLint end) /* odd-ball vertex attributes */ { - _tnl_import_index( ctx, 0, 0 ); - tmp->Index.count = VB->Count; - VB->AttribPtr[_TNL_ATTRIB_INDEX] = &tmp->Index; - } - - { _tnl_import_edgeflag( ctx, GL_TRUE, sizeof(GLboolean) ); VB->EdgeFlag = (GLboolean *) tmp->EdgeFlag; } /* These are constant & could be precalculated: */ - for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT; i < _TNL_ATTRIB_INDEX; i++) { + for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) { _tnl_constant_attrib(tnl, tmp, i); } @@ -340,7 +340,7 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLint end) VB->NormalPtr = VB->AttribPtr[_TNL_ATTRIB_NORMAL]; VB->ColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR0]; VB->ColorPtr[1] = NULL; - VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_INDEX]; + VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX]; VB->IndexPtr[1] = NULL; VB->SecondaryColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR1]; VB->SecondaryColorPtr[1] = NULL; diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c index ad972fa7b7..d13056f9f3 100644 --- a/src/mesa/tnl/t_context.c +++ b/src/mesa/tnl/t_context.c @@ -186,7 +186,7 @@ _tnl_InvalidateState( GLcontext *ctx, GLuint new_state ) } else { RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_POS ); - RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_INDEX ); + RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR_INDEX ); } if (ctx->Fog.Enabled || diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index 7a80e3477c..6c97fbb7c8 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -105,7 +105,7 @@ enum { _TNL_ATTRIB_COLOR0 = 3, _TNL_ATTRIB_COLOR1 = 4, _TNL_ATTRIB_FOG = 5, - _TNL_ATTRIB_SIX = 6, + _TNL_ATTRIB_COLOR_INDEX = 6, _TNL_ATTRIB_SEVEN = 7, _TNL_ATTRIB_TEX0 = 8, _TNL_ATTRIB_TEX1 = 9, @@ -143,10 +143,9 @@ enum { _TNL_ATTRIB_MAT_BACK_SHININESS = 41, _TNL_ATTRIB_MAT_FRONT_INDEXES = 42, _TNL_ATTRIB_MAT_BACK_INDEXES = 43, - _TNL_ATTRIB_INDEX = 44, - _TNL_ATTRIB_EDGEFLAG = 45, - _TNL_ATTRIB_POINTSIZE = 46, - _TNL_ATTRIB_MAX = 47 + _TNL_ATTRIB_EDGEFLAG = 44, + _TNL_ATTRIB_POINTSIZE = 45, + _TNL_ATTRIB_MAX = 46 } ; #define _TNL_ATTRIB_TEX(u) (_TNL_ATTRIB_TEX0 + (u)) @@ -155,7 +154,8 @@ enum { /* special index used for handing invalid glVertexAttribute() indices */ #define _TNL_ATTRIB_ERROR (_TNL_ATTRIB_ATTRIBUTE15 + 1) -/* Define bit ranges instead of bit masks. +/** + * Handy attribute ranges: */ #define _TNL_FIRST_PROG _TNL_ATTRIB_WEIGHT #define _TNL_LAST_PROG _TNL_ATTRIB_TEX7 @@ -197,8 +197,8 @@ struct tnl_eval2_map { struct tnl_eval { GLuint new_state; - struct tnl_eval1_map map1[_TNL_ATTRIB_INDEX + 1]; - struct tnl_eval2_map map2[_TNL_ATTRIB_INDEX + 1]; + struct tnl_eval1_map map1[_TNL_ATTRIB_EDGEFLAG + 1]; + struct tnl_eval2_map map2[_TNL_ATTRIB_EDGEFLAG + 1]; }; @@ -377,6 +377,7 @@ struct tnl_vertex_arrays * The GL_NV_vertex_program extension defines 16 extra sets of vertex * arrays which have precedent over the conventional arrays when enabled. */ + /* XXX I think the array size is wronge (47 vs. 16) */ GLvector4f Attribs[_TNL_ATTRIB_MAX]; }; @@ -419,6 +420,7 @@ struct vertex_buffer GLuint PrimitiveCount; /* Inputs to the vertex program stage */ + /* XXX This array may be too large (47 vs. 16) */ GLvector4f *AttribPtr[_TNL_ATTRIB_MAX]; /* GL_NV_vertex_program */ }; diff --git a/src/mesa/tnl/t_pipeline.c b/src/mesa/tnl/t_pipeline.c index 0b579a7b24..a2d55b2f65 100644 --- a/src/mesa/tnl/t_pipeline.c +++ b/src/mesa/tnl/t_pipeline.c @@ -81,7 +81,7 @@ static GLuint check_input_changes( GLcontext *ctx ) TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint i; - for (i = 0; i < _TNL_ATTRIB_EDGEFLAG; i++) { + for (i = 0; i <= _TNL_LAST_MAT; i++) { if (tnl->vb.AttribPtr[i]->size != tnl->pipeline.last_attrib_size[i] || tnl->vb.AttribPtr[i]->stride != tnl->pipeline.last_attrib_stride[i]) { tnl->pipeline.last_attrib_size[i] = tnl->vb.AttribPtr[i]->size; diff --git a/src/mesa/tnl/t_save_api.c b/src/mesa/tnl/t_save_api.c index 5765652b7e..8625142e16 100644 --- a/src/mesa/tnl/t_save_api.c +++ b/src/mesa/tnl/t_save_api.c @@ -371,7 +371,8 @@ static void _save_copy_to_current( GLcontext *ctx ) TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint i; - for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_INDEX ; i++) { + /* XXX Use _TNL_FIRST_* and _TNL_LAST_* values instead? */ + for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_EDGEFLAG ; i++) { if (tnl->save.attrsz[i]) { tnl->save.currentsz[i][0] = tnl->save.attrsz[i]; COPY_CLEAN_4V(tnl->save.current[i], @@ -399,7 +400,7 @@ static void _save_copy_from_current( GLcontext *ctx ) TNLcontext *tnl = TNL_CONTEXT(ctx); GLint i; - for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_INDEX ; i++) + for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_EDGEFLAG ; i++) switch (tnl->save.attrsz[i]) { case 4: tnl->save.attrptr[i][3] = tnl->save.current[i][3]; case 3: tnl->save.attrptr[i][2] = tnl->save.current[i][2]; @@ -1173,19 +1174,15 @@ static void GLAPIENTRY _save_EdgeFlag( GLboolean b ) IDX_ATTR( _TNL_ATTRIB_EDGEFLAG, (GLfloat)b ); } -static void GLAPIENTRY _save_EdgeFlagv( const GLboolean *v ) -{ - IDX_ATTR( _TNL_ATTRIB_EDGEFLAG, (GLfloat)(v[0]) ); -} static void GLAPIENTRY _save_Indexf( GLfloat f ) { - IDX_ATTR( _TNL_ATTRIB_INDEX, f ); + IDX_ATTR( _TNL_ATTRIB_COLOR_INDEX, f ); } static void GLAPIENTRY _save_Indexfv( const GLfloat *f ) { - IDX_ATTR( _TNL_ATTRIB_INDEX, f[0] ); + IDX_ATTR( _TNL_ATTRIB_COLOR_INDEX, f[0] ); } @@ -1467,7 +1464,6 @@ static void _save_vtxfmt_init( GLcontext *ctx ) vfmt->Color4f = _save_Color4f; vfmt->Color4fv = _save_Color4fv; vfmt->EdgeFlag = _save_EdgeFlag; - vfmt->EdgeFlagv = _save_EdgeFlagv; vfmt->End = _save_End; vfmt->FogCoordfEXT = _save_FogCoordfEXT; vfmt->FogCoordfvEXT = _save_FogCoordfvEXT; @@ -1652,16 +1648,13 @@ static void _save_current_init( GLcontext *ctx ) tnl->save.current[i] = ctx->ListState.CurrentAttrib[i]; } - for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT; i < _TNL_ATTRIB_INDEX; i++) { - const GLuint j = i - _TNL_ATTRIB_MAT_FRONT_AMBIENT; + for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) { + const GLuint j = i - _TNL_FIRST_MAT; ASSERT(j < MAT_ATTRIB_MAX); tnl->save.currentsz[i] = &ctx->ListState.ActiveMaterialSize[j]; tnl->save.current[i] = ctx->ListState.CurrentMaterial[j]; } - tnl->save.currentsz[_TNL_ATTRIB_INDEX] = &ctx->ListState.ActiveIndex; - tnl->save.current[_TNL_ATTRIB_INDEX] = &ctx->ListState.CurrentIndex; - tnl->save.currentsz[_TNL_ATTRIB_EDGEFLAG] = &ctx->ListState.ActiveEdgeFlag; tnl->save.current[_TNL_ATTRIB_EDGEFLAG] = &tnl->save.CurrentFloatEdgeFlag; } diff --git a/src/mesa/tnl/t_save_loopback.c b/src/mesa/tnl/t_save_loopback.c index 7b2e4a4320..9d87c20df8 100644 --- a/src/mesa/tnl/t_save_loopback.c +++ b/src/mesa/tnl/t_save_loopback.c @@ -297,7 +297,8 @@ void _tnl_loopback_vertex_list( GLcontext *ctx, struct loopback_attr la[_TNL_ATTRIB_MAX]; GLuint i, nr = 0; - for (i = 0 ; i <= _TNL_ATTRIB_TEX7 ; i++) { + /* conventional + generic attributes */ + for (i = 0 ; i <= _TNL_ATTRIB_ATTRIBUTE15 ; i++) { if (list->attrsz[i]) { la[nr].target = i; la[nr].sz = list->attrsz[i]; @@ -306,6 +307,7 @@ void _tnl_loopback_vertex_list( GLcontext *ctx, } } + /* material attributes */ for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT ; i <= _TNL_ATTRIB_MAT_BACK_INDEXES ; i++) { @@ -317,6 +319,7 @@ void _tnl_loopback_vertex_list( GLcontext *ctx, } } + /* special-case: edgeflag */ if (list->attrsz[_TNL_ATTRIB_EDGEFLAG]) { la[nr].target = _TNL_ATTRIB_EDGEFLAG; la[nr].sz = list->attrsz[_TNL_ATTRIB_EDGEFLAG]; @@ -324,15 +327,6 @@ void _tnl_loopback_vertex_list( GLcontext *ctx, nr++; } - if (list->attrsz[_TNL_ATTRIB_INDEX]) { - la[nr].target = _TNL_ATTRIB_INDEX; - la[nr].sz = list->attrsz[_TNL_ATTRIB_INDEX]; - la[nr].func = index_attr1fv; - nr++; - } - - /* XXX ARB vertex attribs */ - for (i = 0 ; i < list->prim_count ; i++) { if (list->prim[i].mode & PRIM_WEAK) loopback_weak_prim( ctx, list, i, la, nr ); diff --git a/src/mesa/tnl/t_save_playback.c b/src/mesa/tnl/t_save_playback.c index 995964c961..9504f0fe68 100644 --- a/src/mesa/tnl/t_save_playback.c +++ b/src/mesa/tnl/t_save_playback.c @@ -66,7 +66,7 @@ static void _tnl_bind_vertex_list( GLcontext *ctx, VB->Elts = NULL; VB->NormalLengthPtr = node->normal_lengths; - for (attr = 0; attr <= _TNL_ATTRIB_INDEX; attr++) { + for (attr = 0; attr <= _TNL_ATTRIB_EDGEFLAG; attr++) { if (node->attrsz[attr]) { tmp->Attribs[attr].count = node->count; tmp->Attribs[attr].data = (GLfloat (*)[4]) data; @@ -106,7 +106,7 @@ static void _tnl_bind_vertex_list( GLcontext *ctx, VB->NormalPtr = VB->AttribPtr[_TNL_ATTRIB_NORMAL]; VB->ColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR0]; VB->ColorPtr[1] = NULL; - VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_INDEX]; + VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX]; VB->IndexPtr[1] = NULL; VB->SecondaryColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR1]; VB->SecondaryColorPtr[1] = NULL; @@ -129,7 +129,7 @@ static void _playback_copy_to_current( GLcontext *ctx, else data = node->buffer; - for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_INDEX ; i++) { + for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_EDGEFLAG ; i++) { if (node->attrsz[i]) { COPY_CLEAN_4V(tnl->vtx.current[i], node->attrsz[i], data); data += node->attrsz[i]; diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c index 4d360007a4..47c5b400aa 100644 --- a/src/mesa/tnl/t_vb_light.c +++ b/src/mesa/tnl/t_vb_light.c @@ -135,7 +135,7 @@ prepare_materials(GLcontext *ctx, * update_materials(), above, that'll actually copy the vertex color to * the material attribute(s). */ - for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT ; i < _TNL_ATTRIB_INDEX ; i++) { + for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) { if (VB->AttribPtr[i]->stride) { const GLuint j = store->mat_count++; const GLuint attr = i - _TNL_ATTRIB_MAT_FRONT_AMBIENT; @@ -251,7 +251,7 @@ static GLboolean run_lighting( GLcontext *ctx, VB->AttribPtr[_TNL_ATTRIB_COLOR0] = VB->ColorPtr[0]; VB->AttribPtr[_TNL_ATTRIB_COLOR1] = VB->SecondaryColorPtr[0]; - VB->AttribPtr[_TNL_ATTRIB_INDEX] = VB->IndexPtr[0]; + VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX] = VB->IndexPtr[0]; return GL_TRUE; } diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c index 647c6a1f24..56800aafda 100644 --- a/src/mesa/tnl/t_vp_build.c +++ b/src/mesa/tnl/t_vp_build.c @@ -142,7 +142,7 @@ static struct state_key *make_state_key( GLcontext *ctx ) key->light_color_material_mask = ctx->Light.ColorMaterialBitmask; } - for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT ; i < _TNL_ATTRIB_INDEX ; i++) + for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) if (VB->AttribPtr[i]->stride) key->light_material_mask |= 1<<(i-_TNL_ATTRIB_MAT_FRONT_AMBIENT); diff --git a/src/mesa/tnl/t_vtx_api.c b/src/mesa/tnl/t_vtx_api.c index e8f63f23ae..ed0688965b 100644 --- a/src/mesa/tnl/t_vtx_api.c +++ b/src/mesa/tnl/t_vtx_api.c @@ -145,7 +145,7 @@ static void _tnl_copy_to_current( GLcontext *ctx ) TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint i; - for (i = _TNL_ATTRIB_POS+1 ; i < _TNL_ATTRIB_INDEX ; i++) { + for (i = _TNL_ATTRIB_POS+1 ; i < _TNL_ATTRIB_EDGEFLAG ; i++) { if (tnl->vtx.attrsz[i]) { /* Note: the tnl->vtx.current[i] pointers points to * the ctx->Current fields. The first 16 or so, anyway. @@ -156,13 +156,6 @@ static void _tnl_copy_to_current( GLcontext *ctx ) } } - /* color index is special (it's not a float[4] so COPY_CLEAN_4V above - * will trash adjacent memory!) - */ - if (tnl->vtx.attrsz[_TNL_ATTRIB_INDEX]) { - ctx->Current.Index = tnl->vtx.attrptr[_TNL_ATTRIB_INDEX][0]; - } - /* Edgeflag requires additional treatment: */ if (tnl->vtx.attrsz[_TNL_ATTRIB_EDGEFLAG]) { @@ -642,30 +635,6 @@ static void GLAPIENTRY _tnl_EdgeFlag( GLboolean b ) OTHER_ATTR( _TNL_ATTRIB_EDGEFLAG, 1, &f ); } -static void GLAPIENTRY _tnl_EdgeFlagv( const GLboolean *v ) -{ - GET_CURRENT_CONTEXT( ctx ); - TNLcontext *tnl = TNL_CONTEXT(ctx); - GLfloat f = (GLfloat)v[0]; - - OTHER_ATTR( _TNL_ATTRIB_EDGEFLAG, 1, &f ); -} - -static void GLAPIENTRY _tnl_Indexf( GLfloat f ) -{ - GET_CURRENT_CONTEXT( ctx ); - TNLcontext *tnl = TNL_CONTEXT(ctx); - - OTHER_ATTR( _TNL_ATTRIB_INDEX, 1, &f ); -} - -static void GLAPIENTRY _tnl_Indexfv( const GLfloat *v ) -{ - GET_CURRENT_CONTEXT( ctx ); - TNLcontext *tnl = TNL_CONTEXT(ctx); - - OTHER_ATTR( _TNL_ATTRIB_INDEX, 1, v ); -} /* Eval */ @@ -680,7 +649,7 @@ static void GLAPIENTRY _tnl_EvalCoord1f( GLfloat u ) if (tnl->vtx.eval.new_state) _tnl_update_eval( ctx ); - for (i = 0 ; i <= _TNL_ATTRIB_INDEX ; i++) { + for (i = 0 ; i <= _TNL_ATTRIB_EDGEFLAG ; i++) { if (tnl->vtx.eval.map1[i].map) if (tnl->vtx.attrsz[i] != tnl->vtx.eval.map1[i].sz) _tnl_fixup_vertex( ctx, i, tnl->vtx.eval.map1[i].sz ); @@ -708,7 +677,7 @@ static void GLAPIENTRY _tnl_EvalCoord2f( GLfloat u, GLfloat v ) if (tnl->vtx.eval.new_state) _tnl_update_eval( ctx ); - for (i = 0 ; i <= _TNL_ATTRIB_INDEX ; i++) { + for (i = 0 ; i <= _TNL_ATTRIB_EDGEFLAG ; i++) { if (tnl->vtx.eval.map2[i].map) if (tnl->vtx.attrsz[i] != tnl->vtx.eval.map2[i].sz) _tnl_fixup_vertex( ctx, i, tnl->vtx.eval.map2[i].sz ); @@ -859,6 +828,9 @@ static void GLAPIENTRY _tnl_End( void ) } +/** + * XXX why aren't all members initialized here?? + */ static void _tnl_exec_vtxfmt_init( GLcontext *ctx ) { GLvertexformat *vfmt = &(TNL_CONTEXT(ctx)->exec_vtxfmt); @@ -868,7 +840,6 @@ static void _tnl_exec_vtxfmt_init( GLcontext *ctx ) vfmt->CallList = _mesa_CallList; vfmt->CallLists = _mesa_CallLists; vfmt->EdgeFlag = _tnl_EdgeFlag; - vfmt->EdgeFlagv = _tnl_EdgeFlagv; vfmt->End = _tnl_End; vfmt->EvalCoord1f = _tnl_EvalCoord1f; vfmt->EvalCoord1fv = _tnl_EvalCoord1fv; @@ -876,8 +847,6 @@ static void _tnl_exec_vtxfmt_init( GLcontext *ctx ) vfmt->EvalCoord2fv = _tnl_EvalCoord2fv; vfmt->EvalPoint1 = _tnl_EvalPoint1; vfmt->EvalPoint2 = _tnl_EvalPoint2; - vfmt->Indexf = _tnl_Indexf; - vfmt->Indexfv = _tnl_Indexfv; vfmt->Materialfv = _tnl_Materialfv; vfmt->Rectf = _mesa_noop_Rectf; @@ -935,8 +904,7 @@ static void _tnl_current_init( GLcontext *ctx ) tnl->vtx.current[_TNL_ATTRIB_MAT_FRONT_AMBIENT + i] = ctx->Light.Material.Attrib[i]; - /* special cases */ - tnl->vtx.current[_TNL_ATTRIB_INDEX] = &ctx->Current.Index; + /* special case */ tnl->vtx.current[_TNL_ATTRIB_EDGEFLAG] = &tnl->vtx.CurrentFloatEdgeFlag; } @@ -1006,7 +974,7 @@ void _tnl_vtx_init( GLcontext *ctx ) _tnl_generic_attr_table_init( generic_attr_func ); } - for (i = 0; i < _TNL_ATTRIB_INDEX; i++) + for (i = 0; i < _TNL_ATTRIB_EDGEFLAG; i++) _mesa_vector4f_init( &tmp->Attribs[i], 0, NULL); for (i = 0; i < 4; i++) { diff --git a/src/mesa/tnl/t_vtx_eval.c b/src/mesa/tnl/t_vtx_eval.c index d948e700b0..e21cc7f00a 100644 --- a/src/mesa/tnl/t_vtx_eval.c +++ b/src/mesa/tnl/t_vtx_eval.c @@ -134,7 +134,7 @@ void _tnl_do_EvalCoord1f(GLcontext* ctx, GLfloat u) TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint attr; - for (attr = 1; attr <= _TNL_ATTRIB_INDEX; attr++) { + for (attr = 1; attr <= _TNL_ATTRIB_EDGEFLAG; attr++) { struct gl_1d_map *map = tnl->vtx.eval.map1[attr].map; if (map) { GLfloat uu = (u - map->u1) * map->du; @@ -179,7 +179,7 @@ void _tnl_do_EvalCoord2f( GLcontext* ctx, GLfloat u, GLfloat v ) TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint attr; - for (attr = 1; attr <= _TNL_ATTRIB_INDEX; attr++) { + for (attr = 1; attr <= _TNL_ATTRIB_EDGEFLAG; attr++) { struct gl_2d_map *map = tnl->vtx.eval.map2[attr].map; if (map) { GLfloat uu = (u - map->u1) * map->du; diff --git a/src/mesa/tnl/t_vtx_exec.c b/src/mesa/tnl/t_vtx_exec.c index 3705a5c96a..57d842f05f 100644 --- a/src/mesa/tnl/t_vtx_exec.c +++ b/src/mesa/tnl/t_vtx_exec.c @@ -129,7 +129,7 @@ static void _tnl_vb_bind_vtx( GLcontext *ctx ) VB->Elts = NULL; VB->NormalLengthPtr = NULL; - for (attr = 0; attr <= _TNL_ATTRIB_INDEX ; attr++) { + for (attr = 0; attr <= _TNL_ATTRIB_EDGEFLAG ; attr++) { if (tnl->vtx.attrsz[attr]) { tmp->Attribs[attr].count = count; tmp->Attribs[attr].data = (GLfloat (*)[4]) data; @@ -171,10 +171,10 @@ static void _tnl_vb_bind_vtx( GLcontext *ctx ) VB->NormalPtr = VB->AttribPtr[_TNL_ATTRIB_NORMAL]; VB->ColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR0]; VB->ColorPtr[1] = NULL; - VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_INDEX]; - VB->IndexPtr[1] = NULL; VB->SecondaryColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR1]; VB->SecondaryColorPtr[1] = NULL; + VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX]; + VB->IndexPtr[1] = NULL; VB->FogCoordPtr = VB->AttribPtr[_TNL_ATTRIB_FOG]; for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { diff --git a/src/mesa/tnl/t_vtx_generic.c b/src/mesa/tnl/t_vtx_generic.c index bfae296921..28de445ed4 100644 --- a/src/mesa/tnl/t_vtx_generic.c +++ b/src/mesa/tnl/t_vtx_generic.c @@ -333,6 +333,16 @@ static void GLAPIENTRY _tnl_Color4fv( const GLfloat *v ) DISPATCH_ATTR4FV( _TNL_ATTRIB_COLOR0, v ); } +static void GLAPIENTRY _tnl_Indexf( GLfloat v ) +{ + DISPATCH_ATTR1F( _TNL_ATTRIB_COLOR_INDEX, v ); +} + +static void GLAPIENTRY _tnl_Indexfv( const GLfloat *v ) +{ + DISPATCH_ATTR1FV( _TNL_ATTRIB_COLOR_INDEX, v ); +} + static void GLAPIENTRY _tnl_SecondaryColor3fEXT( GLfloat x, GLfloat y, GLfloat z ) { @@ -556,6 +566,8 @@ void _tnl_generic_exec_vtxfmt_init( GLcontext *ctx ) vfmt->Color3fv = _tnl_Color3fv; vfmt->Color4f = _tnl_Color4f; vfmt->Color4fv = _tnl_Color4fv; + vfmt->Indexf = _tnl_Indexf; + vfmt->Indexfv = _tnl_Indexfv; vfmt->FogCoordfEXT = _tnl_FogCoordfEXT; vfmt->FogCoordfvEXT = _tnl_FogCoordfvEXT; vfmt->MultiTexCoord1fARB = _tnl_MultiTexCoord1f; |