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>
This commit is contained in:
Laszlo Agocs 2022-10-24 16:21:29 +02:00 committed by Qt Cherry-pick Bot
parent 5487b54302
commit 1ddfee7ae8

View File

@ -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;