summaryrefslogtreecommitdiff
path: root/src/mesa/tnl/t_imm_fixup.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/tnl/t_imm_fixup.c')
-rw-r--r--src/mesa/tnl/t_imm_fixup.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/mesa/tnl/t_imm_fixup.c b/src/mesa/tnl/t_imm_fixup.c
index d08c162efe..8e3f52e621 100644
--- a/src/mesa/tnl/t_imm_fixup.c
+++ b/src/mesa/tnl/t_imm_fixup.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_fixup.c,v 1.33 2002/01/22 14:35:16 brianp Exp $ */
+/* $Id: t_imm_fixup.c,v 1.34 2002/02/13 00:53:20 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -396,6 +396,8 @@ copy_material( struct immediate *next,
struct immediate *prev,
GLuint dst, GLuint src )
{
+/* fprintf(stderr, "%s\n", __FUNCTION__); */
+
if (next->Material == 0) {
next->Material = (struct gl_material (*)[2])
MALLOC( sizeof(struct gl_material) * IMM_SIZE * 2 );
@@ -461,6 +463,7 @@ void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *next )
GLuint dst = next->CopyStart+i;
next->Elt[dst] = prev->Elt[src];
next->Flag[dst] = VERT_BIT_ELT;
+ elts[i+offset] = dst;
}
/* fprintf(stderr, "ADDING VERT_BIT_ELT!\n"); */
next->CopyOrFlag |= VERT_BIT_ELT;
@@ -551,14 +554,14 @@ void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *next )
next->CopyOrFlag |= prev->Flag[src] & (VERT_BITS_FIXUP|
VERT_BIT_MATERIAL|
VERT_BIT_POS);
+ elts[i+offset] = dst;
}
}
- if (--tnl->ExecCopySource->ref_count == 0)
+ if (--tnl->ExecCopySource->ref_count == 0)
_tnl_free_immediate( tnl->ExecCopySource );
-
- tnl->ExecCopySource = 0;
- tnl->ExecCopyCount = 0;
+
+ tnl->ExecCopySource = next; next->ref_count++;
}
@@ -766,17 +769,19 @@ _tnl_get_exec_copy_verts( GLcontext *ctx, struct immediate *IM )
/* fprintf(stderr, "_tnl_get_exec_copy_verts %s\n", */
/* _mesa_lookup_enum_by_nr(prim)); */
- ASSERT(tnl->ExecCopySource == 0);
+ if (tnl->ExecCopySource)
+ if (--tnl->ExecCopySource->ref_count == 0)
+ _tnl_free_immediate( tnl->ExecCopySource );
if (prim == GL_POLYGON+1) {
+ tnl->ExecCopySource = 0;
tnl->ExecCopyCount = 0;
tnl->ExecCopyTexSize = 0;
tnl->ExecParity = 0;
} else {
/* Remember this immediate as the one to copy from.
*/
- IM->ref_count++;
- tnl->ExecCopySource = IM;
+ tnl->ExecCopySource = IM; IM->ref_count++;
tnl->ExecCopyCount = 0;
tnl->ExecCopyTexSize = IM->CopyTexSize;