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.

Pick-to: 6.4 6.2
Change-Id: I925e85a2b7fb884e5ae9ed327b4b05c9bf36484b
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
This commit is contained in:
Laszlo Agocs 2022-10-24 16:21:29 +02:00 committed by Christian Strømme
parent fbf586db2c
commit 06a5118a4a

View File

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