Switching to old depth buffer clear style.
This commit is contained in:
parent
1cf1568189
commit
b1afab5bb7
|
@ -2888,26 +2888,29 @@ bool CommandProcessor::IssueCopy() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(benvanik): figure out real condition here (maybe when color cleared?)
|
// TODO(benvanik): figure out real condition here (maybe when color cleared?)
|
||||||
|
// HACK: things seem to need their depth buffer cleared a lot more
|
||||||
|
// than as indicated by the depth_clear_enabled flag.
|
||||||
|
// if (depth_target != kAnyTarget) {
|
||||||
if (depth_clear_enabled && depth_target != kAnyTarget) {
|
if (depth_clear_enabled && depth_target != kAnyTarget) {
|
||||||
// Clear the current depth buffer.
|
// Clear the current depth buffer.
|
||||||
// TODO(benvanik): verify format.
|
// TODO(benvanik): verify format.
|
||||||
GLfloat depth = {(copy_depth_clear & 0xFFFFFF00) /
|
GLfloat depth = {(copy_depth_clear & 0xFFFFFF00) /
|
||||||
static_cast<float>(0xFFFFFF00)};
|
static_cast<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);
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
glStencilMask(0xFF);
|
glStencilMask(0xFF);
|
||||||
// HACK: this should work, but throws INVALID_ENUM on nvidia drivers.
|
// HACK: this should work, but throws INVALID_ENUM on nvidia drivers.
|
||||||
/* glClearNamedFramebufferfi(source_framebuffer->framebuffer,
|
// glClearNamedFramebufferfi(source_framebuffer->framebuffer,
|
||||||
GL_DEPTH_STENCIL,
|
// GL_DEPTH_STENCIL, depth, stencil);
|
||||||
depth, stencil);*/
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, source_framebuffer->framebuffer);
|
||||||
glClearNamedFramebufferfv(source_framebuffer->framebuffer, GL_DEPTH, 0,
|
glClearBufferfi(GL_DEPTH_STENCIL, 0, depth, stencil);
|
||||||
&depth);
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, old_draw_framebuffer);
|
||||||
glClearNamedFramebufferiv(source_framebuffer->framebuffer, GL_STENCIL, 0,
|
|
||||||
&stencil);
|
|
||||||
glDepthMask(old_depth_mask);
|
glDepthMask(old_depth_mask);
|
||||||
glStencilMask(old_stencil_mask);
|
glStencilMask(old_stencil_mask);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue