summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2006-05-20 15:08:25 +0000
committerBrian Paul <[email protected]>2006-05-20 15:08:25 +0000
commit7ac5b7b934544c27d87b4852c95efb379889f1dc (patch)
treec6e34a79814714d6e50dfa1ae9762fd828b01e2e
parentb52f02121bdfc68fbbba732f3d107c296f03d885 (diff)
use new _mesa_dereference_frame/renderbuffer() functions
-rw-r--r--src/mesa/main/fbobject.c31
1 files 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);
}
}
}