X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmesa%2Ftnl%2Ft_array_import.c;h=7cc834ffa233fd943445473f92ac353b8f54b088;hb=91ed68b2b9e0fcb70675ee575d805612a675a82c;hp=09b30132057b9c2e31b6362b26ee1ea9f195f20e;hpb=6f973f33679e034b7cb63806f1ddfabdbdd70123;p=mesa.git diff --git a/src/mesa/tnl/t_array_import.c b/src/mesa/tnl/t_array_import.c index 09b30132057..7cc834ffa23 100644 --- a/src/mesa/tnl/t_array_import.c +++ b/src/mesa/tnl/t_array_import.c @@ -238,6 +238,18 @@ static void _tnl_import_attrib( GLcontext *ctx, } +static void _tnl_constant_attrib( TNLcontext *tnl, + struct tnl_vertex_arrays *tmp, + GLuint i ) +{ + tmp->Attribs[i].count = 1; + tmp->Attribs[i].data = (GLfloat (*)[4]) tnl->vtx.current[i]; + tmp->Attribs[i].start = tnl->vtx.current[i]; + tmp->Attribs[i].size = 4; + tmp->Attribs[i].stride = 0; + tnl->vb.AttribPtr[i] = &tmp->Attribs[i]; +} + void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLint end) @@ -293,11 +305,13 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLint end) VB->AttribPtr[_TNL_ATTRIB_FOG] = &tmp->FogCoord; } else if (index >= VERT_ATTRIB_TEX0 && index <= VERT_ATTRIB_TEX7) { - for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { - _tnl_import_texcoord( ctx, i, GL_FALSE, GL_FALSE ); - tmp->TexCoord[i].count = VB->Count; - VB->AttribPtr[_TNL_ATTRIB_TEX0 + i] = &tmp->TexCoord[i]; - } + i = index - VERT_ATTRIB_TEX0; + _tnl_import_texcoord( ctx, i, GL_FALSE, GL_FALSE ); + tmp->TexCoord[i].count = VB->Count; + VB->AttribPtr[_TNL_ATTRIB_TEX0 + i] = &tmp->TexCoord[i]; + } + else { + _tnl_constant_attrib(tnl, tmp, index); } } @@ -313,16 +327,11 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLint end) VB->EdgeFlag = (GLboolean *) tmp->EdgeFlag; } - /* These are constant & can be precalculated: + /* These are constant & could be precalculated: */ for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT; i < _TNL_ATTRIB_INDEX; i++) { - tmp->Attribs[i].count = 1; - tmp->Attribs[i].data = (GLfloat (*)[4]) tnl->vtx.current[i]; - tmp->Attribs[i].start = tnl->vtx.current[i]; - tmp->Attribs[i].size = 4; - tmp->Attribs[i].stride = 0; - VB->AttribPtr[i] = &tmp->Attribs[i]; - } + _tnl_constant_attrib(tnl, tmp, i); + } /* Legacy pointers -- remove one day.