From 06a5118a4a2b76df2c2c4190ac57fa15857ecf8c Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 24 Oct 2022 16:21:29 +0200 Subject: [PATCH] rhi: gl: Make sure stencil write is enabled when clearing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the last pipeline had a different stencil (write) mask, that would affect the clear. That is not ideal. Exercised by the upcoming stenciloutline manual tests. Pick-to: 6.4 6.2 Change-Id: I925e85a2b7fb884e5ae9ed327b4b05c9bf36484b Reviewed-by: Christian Strømme --- src/gui/rhi/qrhigles2.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp index e03bdb7d04b..4cb37a4cd6a 100644 --- a/src/gui/rhi/qrhigles2.cpp +++ b/src/gui/rhi/qrhigles2.cpp @@ -3019,8 +3019,10 @@ void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb) f->glDepthMask(GL_TRUE); f->glClearDepthf(cmd.args.clear.d); } - if (cmd.args.clear.mask & GL_STENCIL_BUFFER_BIT) + if (cmd.args.clear.mask & GL_STENCIL_BUFFER_BIT) { + f->glStencilMask(0xFF); f->glClearStencil(GLint(cmd.args.clear.s)); + } f->glClear(cmd.args.clear.mask); cbD->graphicsPassState.reset(); // altered depth/color write, invalidate in order to avoid confusing the state tracking break;