Module: Mesa
Branch: staging/19.2
Commit: aab604398d53c9a49af6d7703e7dddad68cdd517
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=aab604398d53c9a49af6d7703e7dddad68cdd517

Author: Lionel Landwerlin <[email protected]>
Date:   Fri Nov  1 19:43:00 2019 +0200

mesa: check draw buffer completeness on glClearBufferfi/glClearBufferiv

Signed-off-by: Lionel Landwerlin <[email protected]>
Cc: <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
(cherry picked from commit 88d665830f27087cb2188e03b0b734acc144c593)

---

 src/mesa/main/clear.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c
index 6beff9ed842..14d548d3689 100644
--- a/src/mesa/main/clear.c
+++ b/src/mesa/main/clear.c
@@ -350,6 +350,12 @@ clear_bufferiv(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,
+                  "glClearBufferiv(incomplete framebuffer)");
+      return;
+   }
+
    switch (buffer) {
    case GL_STENCIL:
       /* Page 264 (page 280 of the PDF) of the OpenGL 3.0 spec says:
@@ -686,6 +692,12 @@ 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)

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to