mesa: new vars: oldDrawFb, oldReadFb in _mesa_BindFramebufferEXT()
authorbrian <brian@cvp965.(none)>
Tue, 10 Nov 2009 22:50:22 +0000 (15:50 -0700)
committerbrian <brian@cvp965.(none)>
Wed, 11 Nov 2009 01:09:13 +0000 (18:09 -0700)
src/mesa/main/fbobject.c

index 5896f1b95f7dbc954939ce83f34b73be619e516b..9bf43416a6587b33f23f7fee39877508e59b079f 100644 (file)
@@ -1194,6 +1194,7 @@ void GLAPIENTRY
 _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
 {
    struct gl_framebuffer *newDrawFb, *newReadFb;
+   struct gl_framebuffer *oldDrawFb, *oldReadFb;
    GLboolean bindReadBuf, bindDrawBuf;
    GET_CURRENT_CONTEXT(ctx);
 
@@ -1275,11 +1276,14 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
    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 {
@@ -1289,11 +1293,11 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
    }
 
    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 {