summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-04-28 21:16:04 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-04-28 21:16:04 +0000
commit762ff10ce1ec7a8e3a3448236e95735bb597b527 (patch)
tree25a8863119525821b19d325fc1d4fe8cfb7813c3
parent3cb0bc84f90ba3595ca6a475847c2687ced7183f (diff)
fix _tnl_copy_to_current() so that current edge flag and rasterpos aren't trashed by color index updates
-rw-r--r--src/mesa/tnl/t_vtx_api.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mesa/tnl/t_vtx_api.c b/src/mesa/tnl/t_vtx_api.c
index a6b8cc3013..56b1e9fea9 100644
--- a/src/mesa/tnl/t_vtx_api.c
+++ b/src/mesa/tnl/t_vtx_api.c
@@ -140,7 +140,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_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.
@@ -150,6 +150,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 special treatment:
*/