mesa: Generate FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT earlier
authorChris Forbes <chrisf@ijw.co.nz>
Sun, 23 Mar 2014 09:41:28 +0000 (22:41 +1300)
committerChris Forbes <chrisf@ijw.co.nz>
Mon, 24 Mar 2014 17:49:25 +0000 (06:49 +1300)
The ARB_framebuffer_object spec lists this case before the
FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER and
FRAMEBUFFER_INCOMPLETE_READ_BUFFER cases.

Fixes two broken cases in piglit's fbo-incomplete test, if
ARB_ES2_compatibility is not advertised. (If it is, this is masked
because the FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER /
FRAMEBUFFER_INCOMPLETE_READ_BUFFER cases are removed by that extension)

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/main/fbobject.c

index dfe2f1e9300e26b639405f3b44dd011553e61f2c..c4083073b2fb5b9bd3c7b32b9aea428497812f89 100644 (file)
@@ -1080,6 +1080,12 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
 
    fb->MaxNumLayers = max_layer_count;
 
+   if (numImages == 0) {
+      fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT;
+      fbo_incomplete(ctx, "no attachments", -1);
+      return;
+   }
+
    if (_mesa_is_desktop_gl(ctx) && !ctx->Extensions.ARB_ES2_compatibility) {
       /* Check that all DrawBuffers are present */
       for (j = 0; j < ctx->Const.MaxDrawBuffers; j++) {
@@ -1108,12 +1114,6 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
       }
    }
 
-   if (numImages == 0) {
-      fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT;
-      fbo_incomplete(ctx, "no attachments", -1);
-      return;
-   }
-
    /* Provisionally set status = COMPLETE ... */
    fb->_Status = GL_FRAMEBUFFER_COMPLETE_EXT;