mirror of
https://github.com/overte-org/overte.git
synced 2025-06-18 01:40:29 +02:00
Really fixing the depth write mask issue on clear...
This commit is contained in:
parent
e32e45ed2b
commit
70d64a7777
1 changed files with 9 additions and 7 deletions
|
@ -209,11 +209,18 @@ void GLBackend::do_clearFramebuffer(Batch& batch, uint32 paramOffset) {
|
||||||
int stencil = batch._params[paramOffset + 1]._int;
|
int stencil = batch._params[paramOffset + 1]._int;
|
||||||
int useScissor = batch._params[paramOffset + 0]._int;
|
int useScissor = batch._params[paramOffset + 0]._int;
|
||||||
|
|
||||||
bool restoreDepthMask = false;
|
|
||||||
GLuint glmask = 0;
|
GLuint glmask = 0;
|
||||||
if (masks & Framebuffer::BUFFER_STENCIL) {
|
if (masks & Framebuffer::BUFFER_STENCIL) {
|
||||||
glClearStencil(stencil);
|
glClearStencil(stencil);
|
||||||
glmask |= GL_STENCIL_BUFFER_BIT;
|
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"
|
||||||
|
}
|
||||||
|
|
||||||
|
bool restoreDepthMask = false;
|
||||||
|
if (masks & Framebuffer::BUFFER_DEPTH) {
|
||||||
|
glClearDepth(depth);
|
||||||
|
glmask |= GL_DEPTH_BUFFER_BIT;
|
||||||
|
|
||||||
bool cacheDepthMask = _pipeline._stateCache.depthTest.getWriteMask();
|
bool cacheDepthMask = _pipeline._stateCache.depthTest.getWriteMask();
|
||||||
if (!cacheDepthMask) {
|
if (!cacheDepthMask) {
|
||||||
|
@ -222,11 +229,6 @@ void GLBackend::do_clearFramebuffer(Batch& batch, uint32 paramOffset) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (masks & Framebuffer::BUFFER_DEPTH) {
|
|
||||||
glClearDepth(depth);
|
|
||||||
glmask |= GL_DEPTH_BUFFER_BIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<GLenum> drawBuffers;
|
std::vector<GLenum> drawBuffers;
|
||||||
if (masks & Framebuffer::BUFFER_COLORS) {
|
if (masks & Framebuffer::BUFFER_COLORS) {
|
||||||
for (unsigned int i = 0; i < Framebuffer::MAX_NUM_RENDER_BUFFERS; i++) {
|
for (unsigned int i = 0; i < Framebuffer::MAX_NUM_RENDER_BUFFERS; i++) {
|
||||||
|
@ -259,7 +261,7 @@ void GLBackend::do_clearFramebuffer(Batch& batch, uint32 paramOffset) {
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
// REstore write mask
|
// Restore write mask meaning turn back off
|
||||||
if (restoreDepthMask) {
|
if (restoreDepthMask) {
|
||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue