mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-17 05:58:28 +02:00
Merge pull request #10674 from samcake/brown
Fix bug in clearFramebuffer with Stencil Buffer
This commit is contained in:
commit
90c4d7d666
1 changed files with 13 additions and 2 deletions
|
@ -63,11 +63,17 @@ void GLBackend::do_clearFramebuffer(const Batch& batch, size_t paramOffset) {
|
|||
int useScissor = batch._params[paramOffset + 0]._int;
|
||||
|
||||
GLuint glmask = 0;
|
||||
bool restoreStencilMask = false;
|
||||
uint8_t cacheStencilMask = 0xFF;
|
||||
if (masks & Framebuffer::BUFFER_STENCIL) {
|
||||
glClearStencil(stencil);
|
||||
glmask |= GL_STENCIL_BUFFER_BIT;
|
||||
// TODO: we will probably need to also check the write mask of stencil like we do
|
||||
// for depth buffer, but as would say a famous Fez owner "We'll cross that bridge when we come to it"
|
||||
|
||||
cacheStencilMask = _pipeline._stateCache.stencilActivation.getWriteMaskFront();
|
||||
if (cacheStencilMask != 0xFF) {
|
||||
restoreStencilMask = true;
|
||||
glStencilMask( 0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
bool restoreDepthMask = false;
|
||||
|
@ -121,6 +127,11 @@ void GLBackend::do_clearFramebuffer(const Batch& batch, size_t paramOffset) {
|
|||
glDisable(GL_SCISSOR_TEST);
|
||||
}
|
||||
|
||||
// Restore Stencil write mask
|
||||
if (restoreStencilMask) {
|
||||
glStencilMask(cacheStencilMask);
|
||||
}
|
||||
|
||||
// Restore write mask meaning turn back off
|
||||
if (restoreDepthMask) {
|
||||
glDepthMask(GL_FALSE);
|
||||
|
|
Loading…
Reference in a new issue