diff options
author | Brian Paul <[email protected]> | 2005-10-04 16:01:02 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2005-10-04 16:01:02 +0000 |
commit | 91802fdf730451aaa0246f514f6778ffaef92c50 (patch) | |
tree | 273765948f2779fc1d2687e0dd7081fac925c7f2 | |
parent | 7edf1e80bd7ae3436e352cdb2ab1203afc0d9d33 (diff) |
check if deleting currently bound frame/renderbuffer object
-rw-r--r-- | src/mesa/main/fbobject.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 324a3032535..f2ab7dc9c06 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -582,6 +582,13 @@ _mesa_DeleteRenderbuffersEXT(GLsizei n, const GLuint *renderbuffers) struct gl_renderbuffer *rb; rb = lookup_renderbuffer(ctx, renderbuffers[i]); if (rb) { + /* check if deleting currently bound renderbuffer object */ + if (rb == ctx->CurrentRenderbuffer) { + /* bind default */ + ASSERT(rb->RefCount >= 2); + _mesa_BindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); + } + /* remove from hash table immediately, to free the ID */ _mesa_HashRemove(ctx->Shared->RenderBuffers, renderbuffers[i]); @@ -896,7 +903,7 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) } oldFb = ctx->DrawBuffer; - if (oldFb) { /* AND oldFb->Name != 0 */ + if (oldFb && oldFb->Name != 0) { oldFb->RefCount--; if (oldFb->RefCount == 0) { oldFb->Delete(oldFb); @@ -925,6 +932,14 @@ _mesa_DeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers) fb = lookup_framebuffer(ctx, framebuffers[i]); if (fb) { ASSERT(fb == &DummyFramebuffer || fb->Name == framebuffers[i]); + + /* check if deleting currently bound framebuffer object */ + if (fb == ctx->DrawBuffer) { + /* bind default */ + ASSERT(fb->RefCount >= 2); + _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + } + /* remove from hash table immediately, to free the ID */ _mesa_HashRemove(ctx->Shared->FrameBuffers, framebuffers[i]); |