From: Brian Paul Date: Thu, 28 Apr 2005 21:14:00 +0000 (+0000) Subject: fix _tnl_copy_to_current() so that current edge flag and rasterpos aren't trashed... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d59054e60bd98f42f41f53f96c782b0dc713f13c;p=mesa.git fix _tnl_copy_to_current() so that current edge flag and rasterpos aren't trashed by color index updates --- diff --git a/src/mesa/tnl/t_vtx_api.c b/src/mesa/tnl/t_vtx_api.c index b9ad28e67db..129b19c5f96 100644 --- a/src/mesa/tnl/t_vtx_api.c +++ b/src/mesa/tnl/t_vtx_api.c @@ -142,7 +142,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_EDGEFLAG ; i++) + for (i = _TNL_ATTRIB_POS+1 ; i < _TNL_ATTRIB_INDEX ; 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. @@ -151,6 +151,14 @@ static void _tnl_copy_to_current( GLcontext *ctx ) tnl->vtx.attrsz[i], tnl->vtx.attrptr[i]); } + } + + /* 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: */