From 2020278d06f927eed0bcba919f70846df090fc45 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 11 Feb 2004 22:06:05 +0000 Subject: Do more bookkeeping of vertex buffer object reference counts. Incr/decr counts when doing glPush/PopClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT). --- src/mesa/main/varray.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/mesa/main/varray.c') diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index c9896ae3ca..c0b7bcfabe 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -58,7 +58,9 @@ update_array(GLcontext *ctx, struct gl_client_array *array, array->Ptr = (const GLubyte *) ptr; #if FEATURE_ARB_vertex_buffer_object array->BufferObj->RefCount--; - /* XXX free buffer object if RefCount == 0 ? */ + if (array->BufferObj->RefCount <= 0) { + (*ctx->Driver.DeleteBuffer)( ctx, array->BufferObj ); + } array->BufferObj = ctx->Array.ArrayBufferObj; array->BufferObj->RefCount++; /* Compute the index of the last array element that's inside the buffer. -- cgit v1.2.3