gl4 : clear depth and stencil seperately using the DSA version

This commit is contained in:
raven02 2015-06-22 09:04:34 -07:00
parent e8fceb0d19
commit d2de2bf652

View File

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