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.
This commit is contained in:
Keith Whitwell
2004-04-20 10:18:33 +00:00
parent 8be72c5b5d
commit 30a8a0b8fa

View File

@@ -473,7 +473,7 @@ static void _save_upgrade_vertex( GLcontext *ctx,
/* Need to note this and fix up at runtime (or loopback): /* 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); assert(oldsz == 0);
tnl->save.dangling_attr_ref = GL_TRUE; tnl->save.dangling_attr_ref = GL_TRUE;
_mesa_debug(0, "_save_upgrade_vertex: dangling reference attr %d\n", _mesa_debug(0, "_save_upgrade_vertex: dangling reference attr %d\n",
@@ -496,11 +496,20 @@ static void _save_upgrade_vertex( GLcontext *ctx,
for (j = 0 ; j < _TNL_ATTRIB_MAX ; j++) { for (j = 0 ; j < _TNL_ATTRIB_MAX ; j++) {
if (tnl->save.attrsz[j]) { if (tnl->save.attrsz[j]) {
if (j == attr) { if (j == attr) {
if (oldsz) {
ASSIGN_4V( dest, 0, 0, 0, 1 ); ASSIGN_4V( dest, 0, 0, 0, 1 );
COPY_SZ_4V( dest, oldsz, data ); COPY_SZ_4V( dest, oldsz, data );
data += oldsz; data += oldsz;
dest += newsz; 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 { else {
GLint sz = tnl->save.attrsz[j]; GLint sz = tnl->save.attrsz[j];
COPY_SZ_4V( dest, sz, data ); COPY_SZ_4V( dest, sz, data );