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