mesa: update framebuffer status as needed in _mesa_source/dest_buffer_exists()
authorBrian Paul <brianp@vmware.com>
Fri, 7 Aug 2009 20:51:59 +0000 (14:51 -0600)
committerBrian Paul <brianp@vmware.com>
Sat, 8 Aug 2009 13:30:26 +0000 (07:30 -0600)
src/mesa/main/framebuffer.c

index 9d9c421..dc79b8c 100644 (file)
@@ -827,8 +827,10 @@ _mesa_source_buffer_exists(GLcontext *ctx, GLenum format)
 {
    const struct gl_renderbuffer_attachment *att = ctx->ReadBuffer->Attachment;
 
-   /* state validation should have already been done */
-   ASSERT(ctx->NewState == 0x0);
+   /* If we don't know the framebuffer status, update it now */
+   if (ctx->ReadBuffer->_Status == 0) {
+      _mesa_test_framebuffer_completeness(ctx, ctx->ReadBuffer);
+   }
 
    if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
       return GL_FALSE;
@@ -898,8 +900,10 @@ _mesa_dest_buffer_exists(GLcontext *ctx, GLenum format)
 {
    const struct gl_renderbuffer_attachment *att = ctx->DrawBuffer->Attachment;
 
-   /* state validation should have already been done */
-   ASSERT(ctx->NewState == 0x0);
+   /* If we don't know the framebuffer status, update it now */
+   if (ctx->DrawBuffer->_Status == 0) {
+      _mesa_test_framebuffer_completeness(ctx, ctx->DrawBuffer);
+   }
 
    if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
       return GL_FALSE;