_mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
{
struct gl_framebuffer *newDrawFb, *newReadFb;
+ struct gl_framebuffer *oldDrawFb, *oldReadFb;
GLboolean bindReadBuf, bindDrawBuf;
GET_CURRENT_CONTEXT(ctx);
ASSERT(newDrawFb);
ASSERT(newDrawFb != &DummyFramebuffer);
+ oldDrawFb = ctx->DrawBuffer;
+ oldReadFb = ctx->ReadBuffer;
+
/*
* OK, now bind the new Draw/Read framebuffers, if they're changing.
*/
if (bindReadBuf) {
- if (ctx->ReadBuffer == newReadFb) {
+ if (oldReadFb == newReadFb) {
bindReadBuf = GL_FALSE; /* no change */
}
else {
}
if (bindDrawBuf) {
- if (ctx->DrawBuffer->Name != 0) {
+ if (oldDrawFb->Name != 0) {
check_end_texture_render(ctx, ctx->DrawBuffer);
}
- if (ctx->DrawBuffer == newDrawFb) {
+ if (oldDrawFb == newDrawFb) {
bindDrawBuf = GL_FALSE; /* no change */
}
else {