From 40e94f88e008ee8ed36b4f7bff2bd005c5b7bb4a Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Fri, 1 Apr 2016 18:24:46 -1000 Subject: [PATCH] Mesa depth clear fix --- lib/graphicsdev/GL.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/graphicsdev/GL.cpp b/lib/graphicsdev/GL.cpp index 2a3ca76..08f10b7 100644 --- a/lib/graphicsdev/GL.cpp +++ b/lib/graphicsdev/GL.cpp @@ -913,6 +913,8 @@ struct GLCommandQueue : IGraphicsCommandQueue break; self->m_drawBuf = self->m_completeBuf; + glBindFramebuffer(GL_FRAMEBUFFER, 0); + if (self->m_pendingFboAdds.size()) { for (GLTextureR* tex : self->m_pendingFboAdds) @@ -1001,6 +1003,7 @@ struct GLCommandQueue : IGraphicsCommandQueue glClear(glFlags); if (cmd.flags & GL_DEPTH_BUFFER_BIT) { + glBindFramebuffer(GL_FRAMEBUFFER, 0); size_t texels = currentTarget->m_width * currentTarget->m_height; if (DepthInitializer.size() < texels) DepthInitializer.resize(texels, ~0); @@ -1009,6 +1012,7 @@ struct GLCommandQueue : IGraphicsCommandQueue currentTarget->m_width, currentTarget->m_height, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, DepthInitializer.data()); + glBindFramebuffer(GL_FRAMEBUFFER, currentTarget->m_fbo); } break; }