mesa: reduce calls to _mesa_test_framebuffer_completeness()
authorBrian Paul <brianp@vmware.com>
Tue, 1 Mar 2011 01:24:20 +0000 (18:24 -0700)
committerBrian Paul <brianp@vmware.com>
Tue, 1 Mar 2011 01:24:20 +0000 (18:24 -0700)
when doing glCopyTex[Sub]Image() and checking the source buffer's
completeness.
We only need to determine FBO completeness when the status is indeterminate.

src/mesa/main/teximage.c

index 1f2ad7f266b4f8910401474d2fae83db221b1100..d4ae6dd69d83bb1a6ca53e0ba2617bf6b7127a76 100644 (file)
@@ -1898,7 +1898,9 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
 
    /* Check that the source buffer is complete */
    if (ctx->ReadBuffer->Name) {
-      _mesa_test_framebuffer_completeness(ctx, ctx->ReadBuffer);
+      if (ctx->ReadBuffer->_Status == 0) {
+         _mesa_test_framebuffer_completeness(ctx, ctx->ReadBuffer);
+      }
       if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
          _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
                      "glCopyTexImage%dD(invalid readbuffer)", dimensions);
@@ -2000,7 +2002,9 @@ copytexsubimage_error_check1( struct gl_context *ctx, GLuint dimensions,
 {
    /* Check that the source buffer is complete */
    if (ctx->ReadBuffer->Name) {
-      _mesa_test_framebuffer_completeness(ctx, ctx->ReadBuffer);
+      if (ctx->ReadBuffer->_Status == 0) {
+         _mesa_test_framebuffer_completeness(ctx, ctx->ReadBuffer);
+      }
       if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
          _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
                      "glCopyTexImage%dD(invalid readbuffer)", dimensions);