summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2022-10-24 16:21:29 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-10-26 19:26:47 +0000
commit1ddfee7ae8c1ce2830d3b64674d5a3fa86e16998 (patch)
tree30bd0483e4c3bd0ca3581353b6016a378f49e288
parent5487b543020c066d6318f00a090016b4e3bf2dea (diff)
downloadqtbase-1ddfee7ae8c1ce2830d3b64674d5a3fa86e16998.tar.gz
rhi: gl: Make sure stencil write is enabled when clearing
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. Change-Id: I925e85a2b7fb884e5ae9ed327b4b05c9bf36484b Reviewed-by: Christian Strømme <christian.stromme@qt.io> (cherry picked from commit 06a5118a4a2b76df2c2c4190ac57fa15857ecf8c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/gui/rhi/qrhigles2.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp
index 074ed65882..6b3207e05d 100644
--- a/src/gui/rhi/qrhigles2.cpp
+++ b/src/gui/rhi/qrhigles2.cpp
@@ -3015,8 +3015,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;