Merge pull request #274 from raven02/patch-4

gl4 : clear depth and stencil seperately using the DSA version
This commit is contained in:
Ben Vanik 2015-06-22 09:23:10 -07:00
commit 08acb6bc1a
1 changed files with 4 additions and 5 deletions

View File

@ -2871,21 +2871,20 @@ bool CommandProcessor::IssueCopy() {
// TODO(benvanik): verify format.
GLfloat depth = {(copy_depth_clear & 0xFFFFFF00) / float(0xFFFFFF00)};
GLint stencil = copy_depth_clear & 0xFF;
GLint old_draw_framebuffer;
GLboolean old_depth_mask;
GLint old_stencil_mask;
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &old_draw_framebuffer);
glGetBooleanv(GL_DEPTH_WRITEMASK, &old_depth_mask);
glGetIntegerv(GL_STENCIL_WRITEMASK, &old_stencil_mask);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, source_framebuffer->framebuffer);
glDepthMask(GL_TRUE);
glStencilMask(0xFF);
// HACK: this should work, but throws INVALID_ENUM on nvidia drivers.
/* glClearNamedFramebufferfi(source_framebuffer->framebuffer,
GL_DEPTH_STENCIL,
depth, stencil);*/
glClearBufferfi(GL_DEPTH_STENCIL, 0, depth, stencil);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, old_draw_framebuffer);
glClearNamedFramebufferfv(source_framebuffer->framebuffer, GL_DEPTH,
0, &depth);
glClearNamedFramebufferiv(source_framebuffer->framebuffer, GL_STENCIL,
0, &stencil);
glDepthMask(old_depth_mask);
glStencilMask(old_stencil_mask);
}