mesa: Don't bind DRAW/READ_FRAMEBUFFER separately without FBO blit support

If GL_EXT_framebuffer_blit was not supported _mesa_DeleteFramebuffersEXT
would raise an error when deleting the currently bound framebuffer. This
because it tried to bind the default DRAW- and READ_FRAMEBUFFER separately.
This patch binds the default FRAMEBUFFER instead in that case.

Encountered in the fbo/fbo-copyteximage piglit test on R600.

Patch cleaned up a bit by Brian Paul.
This commit is contained in:
Erik Wien
2010-01-26 13:19:30 -07:00
committed by Brian Paul
parent cbecb8fc8e
commit 68ca19afd7

View File

@@ -1350,6 +1350,8 @@ _mesa_DeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers)
ASSERT(fb == &DummyFramebuffer || fb->Name == framebuffers[i]);
/* check if deleting currently bound framebuffer object */
if (ctx->Extensions.EXT_framebuffer_blit) {
/* separate draw/read binding points */
if (fb == ctx->DrawBuffer) {
/* bind default */
ASSERT(fb->RefCount >= 2);
@@ -1360,6 +1362,15 @@ _mesa_DeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers)
ASSERT(fb->RefCount >= 2);
_mesa_BindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0);
}
}
else {
/* only one binding point for read/draw buffers */
if (fb == ctx->DrawBuffer || fb == ctx->ReadBuffer) {
/* 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]);