make sure the writting mask is on for depth buffer

This commit is contained in:
samcake 2015-07-29 18:06:46 -07:00
parent ac46b2bd17
commit e32e45ed2b
2 changed files with 12 additions and 2 deletions

View file

@ -1019,8 +1019,6 @@ void Application::paintGL() {
// Back to the default framebuffer;
gpu::Batch batch;
batch.resetStages();
// TODO: Testing the water here, it is maybe not needed at all,
// i would like to keep it like that until we merge with DisplayPlugin
renderArgs._context->render(batch);
}

View file

@ -209,10 +209,17 @@ void GLBackend::do_clearFramebuffer(Batch& batch, uint32 paramOffset) {
int stencil = batch._params[paramOffset + 1]._int;
int useScissor = batch._params[paramOffset + 0]._int;
bool restoreDepthMask = false;
GLuint glmask = 0;
if (masks & Framebuffer::BUFFER_STENCIL) {
glClearStencil(stencil);
glmask |= GL_STENCIL_BUFFER_BIT;
bool cacheDepthMask = _pipeline._stateCache.depthTest.getWriteMask();
if (!cacheDepthMask) {
restoreDepthMask = true;
glDepthMask(GL_TRUE);
}
}
if (masks & Framebuffer::BUFFER_DEPTH) {
@ -252,6 +259,11 @@ void GLBackend::do_clearFramebuffer(Batch& batch, uint32 paramOffset) {
glDisable(GL_SCISSOR_TEST);
}
// REstore write mask
if (restoreDepthMask) {
glDepthMask(GL_FALSE);
}
// Restore the color draw buffers only if a frmaebuffer is bound
if (_output._framebuffer && !drawBuffers.empty()) {
auto glFramebuffer = syncGPUObject(*_output._framebuffer);