diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/fbobject.c | 2 | ||||
-rw-r--r-- | src/mesa/main/framebuffer.c | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 6608eefc6c..f7e870b49c 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1014,7 +1014,6 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) */ if (bindReadBuf) { - _mesa_unreference_framebuffer(&ctx->ReadBuffer); _mesa_reference_framebuffer(&ctx->ReadBuffer, newFb); } @@ -1022,7 +1021,6 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) /* check if old FB had any texture attachments */ check_end_texture_render(ctx, ctx->DrawBuffer); /* check if time to delete this framebuffer */ - _mesa_unreference_framebuffer(&ctx->DrawBuffer); _mesa_reference_framebuffer(&ctx->DrawBuffer, newFb); if (newFb->Name != 0) { /* check if newly bound framebuffer has any texture attachments */ diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index c97d2f0077..3136a950e0 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -253,6 +253,13 @@ _mesa_reference_framebuffer(struct gl_framebuffer **ptr, struct gl_framebuffer *fb) { assert(ptr); + if (*ptr == fb) { + /* no change */ + return; + } + if (*ptr) { + _mesa_unreference_framebuffer(ptr); + } assert(!*ptr); assert(fb); _glthread_LOCK_MUTEX(fb->Mutex); |