diff options
author | Keith Whitwell <[email protected]> | 2005-04-25 09:36:27 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2005-04-25 09:36:27 +0000 |
commit | b83aadb0e4cc61638ead165af25b954e5e070d07 (patch) | |
tree | 5585f63144ba75f60a7853aea512fd6a3f0828ad /src/mesa | |
parent | 576caad33e2db8f6950a33848e05cf3d42e2d918 (diff) |
Ensure all VB->AttribPtr[] are populated. Reported by Aapo Tahkola
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/tnl/t_array_import.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/mesa/tnl/t_array_import.c b/src/mesa/tnl/t_array_import.c index 09b30132057..39515b4b0a3 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) @@ -299,6 +311,9 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLint end) VB->AttribPtr[_TNL_ATTRIB_TEX0 + i] = &tmp->TexCoord[i]; } } + else { + _tnl_constant_attrib(tnl, tmp, index); + } } /* odd-ball vertex attributes */ @@ -313,16 +328,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. |