From d2de2bf65215d9f0a301571950ecd2b047f264a6 Mon Sep 17 00:00:00 2001 From: raven02 Date: Mon, 22 Jun 2015 09:04:34 -0700 Subject: [PATCH 1/3] gl4 : clear depth and stencil seperately using the DSA version --- src/xenia/gpu/gl4/command_processor.cc | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/xenia/gpu/gl4/command_processor.cc b/src/xenia/gpu/gl4/command_processor.cc index 455d42eb5..2c33fb818 100644 --- a/src/xenia/gpu/gl4/command_processor.cc +++ b/src/xenia/gpu/gl4/command_processor.cc @@ -2871,21 +2871,16 @@ 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); } From 68e12a4664a5d1b050905f28d2f1fbab32694711 Mon Sep 17 00:00:00 2001 From: raven02 Date: Mon, 22 Jun 2015 09:07:55 -0700 Subject: [PATCH 2/3] typo fix --- src/xenia/gpu/gl4/command_processor.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/xenia/gpu/gl4/command_processor.cc b/src/xenia/gpu/gl4/command_processor.cc index 2c33fb818..16d1cd68f 100644 --- a/src/xenia/gpu/gl4/command_processor.cc +++ b/src/xenia/gpu/gl4/command_processor.cc @@ -2878,9 +2878,9 @@ bool CommandProcessor::IssueCopy() { glDepthMask(GL_TRUE); glStencilMask(0xFF); glClearNamedFramebufferfv(source_framebuffer->framebuffer, GL_DEPTH, - 0, @depth); + 0, &depth); glClearNamedFramebufferiv(source_framebuffer->framebuffer, GL_STENCIL, - 0, #stencil); + 0, &stencil); glDepthMask(old_depth_mask); glStencilMask(old_stencil_mask); } From 1fb2ccb552ce4b80e8a2b4a53b99fc8731f21f3f Mon Sep 17 00:00:00 2001 From: raven02 Date: Mon, 22 Jun 2015 09:22:31 -0700 Subject: [PATCH 3/3] Add back the comment and we can check it again in future --- src/xenia/gpu/gl4/command_processor.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/xenia/gpu/gl4/command_processor.cc b/src/xenia/gpu/gl4/command_processor.cc index 16d1cd68f..f890d99f5 100644 --- a/src/xenia/gpu/gl4/command_processor.cc +++ b/src/xenia/gpu/gl4/command_processor.cc @@ -2877,6 +2877,10 @@ bool CommandProcessor::IssueCopy() { glGetIntegerv(GL_STENCIL_WRITEMASK, &old_stencil_mask); 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);*/ glClearNamedFramebufferfv(source_framebuffer->framebuffer, GL_DEPTH, 0, &depth); glClearNamedFramebufferiv(source_framebuffer->framebuffer, GL_STENCIL,