From 7ac5b7b934544c27d87b4852c95efb379889f1dc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 20 May 2006 15:08:25 +0000 Subject: [PATCH] use new _mesa_dereference_frame/renderbuffer() functions --- src/mesa/main/fbobject.c | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 807fac0a393..b6a59336cb8 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -595,10 +595,7 @@ _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer) oldRb = ctx->CurrentRenderbuffer; if (oldRb) { - oldRb->RefCount--; - if (oldRb->RefCount == 0) { - oldRb->Delete(oldRb); - } + _mesa_dereference_renderbuffer(&oldRb); } ASSERT(newRb != &DummyRenderbuffer); @@ -635,10 +632,7 @@ _mesa_DeleteRenderbuffersEXT(GLsizei n, const GLuint *renderbuffers) /* But the object will not be freed until it's no longer * bound in any context. */ - rb->RefCount--; - if (rb->RefCount == 0) { - rb->Delete(rb); - } + _mesa_dereference_renderbuffer(&rb); } } } @@ -1019,12 +1013,7 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) if (bindReadBuf) { oldFb = ctx->ReadBuffer; if (oldFb && oldFb->Name != 0) { - _glthread_LOCK_MUTEX(oldFb->Mutex); - oldFb->RefCount--; - _glthread_UNLOCK_MUTEX(oldFb->Mutex); - if (oldFb->RefCount == 0) { - oldFb->Delete(oldFb); - } + _mesa_dereference_framebuffer(&oldFb); } ctx->ReadBuffer = newFb; } @@ -1035,12 +1024,7 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) /* check if old FB had any texture attachments */ check_end_texture_render(ctx, oldFb); /* check if time to delete this framebuffer */ - _glthread_LOCK_MUTEX(oldFb->Mutex); - oldFb->RefCount--; - if (oldFb->RefCount == 0) { - oldFb->Delete(oldFb); - } - _glthread_UNLOCK_MUTEX(oldFb->Mutex); + _mesa_dereference_framebuffer(&oldFb); } ctx->DrawBuffer = newFb; if (newFb->Name != 0) { @@ -1085,12 +1069,7 @@ _mesa_DeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers) /* But the object will not be freed until it's no longer * bound in any context. */ - _glthread_LOCK_MUTEX(fb->Mutex); - fb->RefCount--; - _glthread_UNLOCK_MUTEX(fb->Mutex); - if (fb->RefCount == 0) { - fb->Delete(fb); - } + _mesa_dereference_framebuffer(&fb); } } } -- 2.30.2