From 88d665830f27087cb2188e03b0b734acc144c593 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Fri, 1 Nov 2019 19:43:00 +0200 Subject: [PATCH] mesa: check draw buffer completeness on glClearBufferfi/glClearBufferiv MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Lionel Landwerlin Cc: Reviewed-by: Marek Olšák --- 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 9221c7287a3..c5d612f4a6c 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) -- 2.30.2