use _mesa_reference_renderbuffer() in a few more places
authorBrian <brian@yutani.localnet.net>
Mon, 2 Apr 2007 15:56:28 +0000 (09:56 -0600)
committerBrian <brian@yutani.localnet.net>
Mon, 2 Apr 2007 15:57:27 +0000 (09:57 -0600)
src/mesa/main/fbobject.c
src/mesa/main/texrender.c

index fefa14e503655c982f660970bc0b05da055e1a91..58bcc24b32cce071e18eba6b3ca919e39ba82df7 100644 (file)
@@ -165,11 +165,7 @@ _mesa_remove_attachment(GLcontext *ctx, struct gl_renderbuffer_attachment *att)
    if (att->Type == GL_TEXTURE || att->Type == GL_RENDERBUFFER_EXT) {
       ASSERT(att->Renderbuffer);
       ASSERT(!att->Texture);
-      att->Renderbuffer->RefCount--;
-      if (att->Renderbuffer->RefCount == 0) {
-         att->Renderbuffer->Delete(att->Renderbuffer);
-      }
-      att->Renderbuffer = NULL;
+      _mesa_reference_renderbuffer(&att->Renderbuffer, NULL);
    }
    att->Type = GL_NONE;
    att->Complete = GL_TRUE;
@@ -228,10 +224,9 @@ _mesa_set_renderbuffer_attachment(GLcontext *ctx,
    /* XXX check if re-doing same attachment, exit early */
    _mesa_remove_attachment(ctx, att);
    att->Type = GL_RENDERBUFFER_EXT;
-   att->Renderbuffer = rb;
    att->Texture = NULL; /* just to be safe */
    att->Complete = GL_FALSE;
-   rb->RefCount++;
+   _mesa_reference_renderbuffer(&att->Renderbuffer, rb);
 }
 
 
@@ -246,12 +241,9 @@ _mesa_framebuffer_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb,
    struct gl_renderbuffer_attachment *att;
 
    _glthread_LOCK_MUTEX(fb->Mutex);
-   if (rb)
-      _glthread_LOCK_MUTEX(rb->Mutex);
 
    att = _mesa_get_attachment(ctx, fb, attachment);
    ASSERT(att);
-
    if (rb) {
       _mesa_set_renderbuffer_attachment(ctx, att, rb);
    }
@@ -259,8 +251,6 @@ _mesa_framebuffer_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb,
       _mesa_remove_attachment(ctx, att);
    }
 
-   if (rb)
-      _glthread_UNLOCK_MUTEX(rb->Mutex);
    _glthread_UNLOCK_MUTEX(fb->Mutex);
 }
 
index 32e7b575f001e73b918628843a4a5d67bd8540d8..f73858451242c3d6b21bc89afe837df280e5b7e2 100644 (file)
@@ -325,7 +325,7 @@ wrap_texture(GLcontext *ctx, struct gl_renderbuffer_attachment *att)
    trb->Base.PutMonoValues = texture_put_mono_values;
 
    /* update attachment point */
-   att->Renderbuffer = &(trb->Base);
+   _mesa_reference_renderbuffer(&att->Renderbuffer, &(trb->Base));
 }