mesa: check framebuffer completeness only after state update
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Mon, 11 Nov 2019 10:32:50 +0000 (12:32 +0200)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Mon, 11 Nov 2019 20:04:55 +0000 (22:04 +0200)
The change made in 88d665830f27 ("mesa: check draw buffer completeness
on glClearBufferfi/glClearBufferiv") correctly updated the state prior
to checking the framebuffer completeness on glClearBufferiv but not in
glClearBufferfi.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Fixes: 88d665830f27 ("mesa: check draw buffer completeness on glClearBufferfi/glClearBufferiv")
Gitlab: https://gitlab.freedesktop.org/mesa/mesa/issues/2072

src/mesa/main/clear.c

index c5d612f4a6cff07d7cc893b9dc56620eaaa6fe0a..c12983f8dcd5371ad7ba004dd1399a0c062c7d7e 100644 (file)
@@ -692,12 +692,6 @@ clear_bufferfi(struct gl_context *ctx, GLenum buffer, GLint drawbuffer,
                      drawbuffer);
          return;
       }
-
-      if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
-         _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
-                     "glClearBufferfi(incomplete framebuffer)");
-         return;
-      }
    }
 
    if (ctx->RasterDiscard)
@@ -707,6 +701,12 @@ clear_bufferfi(struct gl_context *ctx, GLenum buffer, GLint drawbuffer,
       _mesa_update_state( ctx );
    }
 
+   if (!no_error && ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
+      _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
+                  "glClearBufferfi(incomplete framebuffer)");
+      return;
+   }
+
    if (ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer)
       mask |= BUFFER_BIT_DEPTH;
    if (ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Renderbuffer)