summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2004-04-20 10:18:33 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2004-04-20 10:18:33 +0000
commit30a8a0b8fa9e66efb97aef630765e4cdf6d9cb68 (patch)
tree2f5b72f742759808cde8fd641827359903afb93e /src
parent8be72c5b5dca9b8390914a6d7b8b8a3fb6196df8 (diff)
When upgrading copied vertices, distinguish between an attribute
entering a vertex for the first time and one which was already present but increasing its size. Fixes Brian's normal.c bug.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/tnl/t_save_api.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/mesa/tnl/t_save_api.c b/src/mesa/tnl/t_save_api.c
index 4e85935932..dce84e212c 100644
--- a/src/mesa/tnl/t_save_api.c
+++ b/src/mesa/tnl/t_save_api.c
@@ -473,7 +473,7 @@ static void _save_upgrade_vertex( GLcontext *ctx,
/* Need to note this and fix up at runtime (or loopback):
*/
- if (tnl->save.currentsz[attr] == 0) {
+ if (tnl->save.currentsz[attr][0] == 0) {
assert(oldsz == 0);
tnl->save.dangling_attr_ref = GL_TRUE;
_mesa_debug(0, "_save_upgrade_vertex: dangling reference attr %d\n",
@@ -496,10 +496,19 @@ static void _save_upgrade_vertex( GLcontext *ctx,
for (j = 0 ; j < _TNL_ATTRIB_MAX ; j++) {
if (tnl->save.attrsz[j]) {
if (j == attr) {
- ASSIGN_4V( dest, 0, 0, 0, 1 );
- COPY_SZ_4V( dest, oldsz, data );
- data += oldsz;
- dest += newsz;
+ if (oldsz) {
+ ASSIGN_4V( dest, 0, 0, 0, 1 );
+ COPY_SZ_4V( dest, oldsz, data );
+ data += oldsz;
+ dest += newsz;
+ }
+ else {
+ GLuint currentsz = tnl->save.currentsz[attr][0];
+ GLfloat *current = tnl->save.current[attr];
+ ASSIGN_4V( dest, 0, 0, 0, 1 );
+ COPY_SZ_4V( dest, currentsz, current );
+ dest += newsz;
+ }
}
else {
GLint sz = tnl->save.attrsz[j];