diff options
author | Brian Paul <[email protected]> | 2006-04-25 00:53:25 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2006-04-25 00:53:25 +0000 |
commit | 94b30dc390f1fdd526c080080830016fad3e2ee2 (patch) | |
tree | 92643c41eae15bcf373a9777ca04e73cfe46c7c3 /src/mesa/tnl | |
parent | 5bdc6fdebc0ab59a888fba15136eb4a0ee2790e1 (diff) |
Put color index attribute into the 6th attribute slot.
Update a lot of loops, conditionals to use the _TNL_FIRST/LAST_* values
instead of specific vertex attributes.
Remove the EdgeFlagv function from the GLvertexformat struct.
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r-- | src/mesa/tnl/t_array_import.c | 16 | ||||
-rw-r--r-- | src/mesa/tnl/t_context.c | 2 | ||||
-rw-r--r-- | src/mesa/tnl/t_context.h | 18 | ||||
-rw-r--r-- | src/mesa/tnl/t_pipeline.c | 2 | ||||
-rw-r--r-- | src/mesa/tnl/t_save_api.c | 21 | ||||
-rw-r--r-- | src/mesa/tnl/t_save_loopback.c | 14 | ||||
-rw-r--r-- | src/mesa/tnl/t_save_playback.c | 6 | ||||
-rw-r--r-- | src/mesa/tnl/t_vb_light.c | 4 | ||||
-rw-r--r-- | src/mesa/tnl/t_vp_build.c | 2 | ||||
-rw-r--r-- | src/mesa/tnl/t_vtx_api.c | 48 | ||||
-rw-r--r-- | src/mesa/tnl/t_vtx_eval.c | 4 | ||||
-rw-r--r-- | src/mesa/tnl/t_vtx_exec.c | 6 | ||||
-rw-r--r-- | src/mesa/tnl/t_vtx_generic.c | 12 |
13 files changed, 62 insertions, 93 deletions
diff --git a/src/mesa/tnl/t_array_import.c b/src/mesa/tnl/t_array_import.c index 7cc834ffa23..0fb3529b6b2 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 ad972fa7b7c..d13056f9f39 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 7a80e3477ca..6c97fbb7c8d 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 0b579a7b24b..a2d55b2f650 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 5765652b7e0..8625142e16e 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 7b2e4a43203..9d87c20df84 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 995964c9614..9504f0fe680 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 4d360007a46..47c5b400aae 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 647c6a1f245..56800aafda0 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 e8f63f23ae3..ed0688965b4 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 d948e700b0d..e21cc7f00a6 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 3705a5c96a9..57d842f05fe 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 bfae296921b..28de445ed41 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; |