Mesa (master): mesa: check draw buffer completeness on glClearBufferfv/glClearBufferuiv
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon May 4 11:29:15 UTC 2020
Module: Mesa
Branch: master
Commit: 58bb8172574cf9a911af03326903034daa30a481
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=58bb8172574cf9a911af03326903034daa30a481
Author: Dmitriy Nester <dmitriynester at gmail.com>
Date: Thu Apr 30 16:25:04 2020 +0300
mesa: check draw buffer completeness on glClearBufferfv/glClearBufferuiv
>From OpenGL 4.6, section 9.4.4 "Effects of Framebuffer Completeness on
Framebuffer Operations", page 332:
"An INVALID_FRAMEBUFFER_OPERATION error is generated by attempts to render
to or read from a framebuffer which is not framebuffer complete.
This error is generated regardless of whether fragments are actually read
from or written to the framebuffer. For example, it is generated when a
rendering command is called and the framebuffer is incomplete, even if
RASTERIZER_DISCARD is enabled."
Signed-off-by: Dmytro Nester <dmytro.nester at globallogic.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4833>
---
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 fda4df59528..ca0ecd95b8c 100644
--- a/src/mesa/main/clear.c
+++ b/src/mesa/main/clear.c
@@ -467,6 +467,12 @@ clear_bufferuiv(struct gl_context *ctx, GLenum buffer, GLint drawbuffer,
_mesa_update_state( ctx );
}
+ if (!no_error && ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE) {
+ _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION,
+ "glClearBufferuiv(incomplete framebuffer)");
+ return;
+ }
+
switch (buffer) {
case GL_COLOR:
{
@@ -555,6 +561,12 @@ clear_bufferfv(struct gl_context *ctx, GLenum buffer, GLint drawbuffer,
_mesa_update_state( ctx );
}
+ if (!no_error && ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE) {
+ _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION,
+ "glClearBufferfv(incomplete framebuffer)");
+ return;
+ }
+
switch (buffer) {
case GL_DEPTH:
/* Page 264 (page 280 of the PDF) of the OpenGL 3.0 spec says:
More information about the mesa-commit
mailing list