gsdx ogl: fix wrong depth clear

If a color buffer is still attached and is smaller than depth buffer,
the latter won't be fully cleared.

As a faster alternative, use GL4.4 clear texture function. Avoid to fiddle with
framebuffer and pixel tests.

Fix #1362x Ar Tolenico 2 map clip
This commit is contained in:
Gregory Hainaut 2016-05-15 14:57:37 +02:00
parent caacb1dc9f
commit c054b097e9
1 changed files with 20 additions and 11 deletions

View File

@ -603,19 +603,28 @@ void GSDeviceOGL::ClearDepth(GSTexture* t, float c)
GL_PUSH("Clear Depth %d", T->GetID());
OMSetFBO(m_fbo);
OMAttachDs(T);
// TODO: check size of scissor before toggling it
glDisable(GL_SCISSOR_TEST);
if (GLState::depth_mask) {
glClearBufferfv(GL_DEPTH, 0, &c);
if (GLLoader::found_GL_ARB_clear_texture) {
// Don't bother with Depth_Stencil insanity
ASSERT(c == 0.0f);
T->Clear(NULL);
} else {
glDepthMask(true);
glClearBufferfv(GL_DEPTH, 0, &c);
glDepthMask(false);
OMSetFBO(m_fbo);
// RT must be detached, if RT is too small, depth won't be fully cleared
// AT tolenico 2 map clip bug
OMAttachRt(NULL);
OMAttachDs(T);
// TODO: check size of scissor before toggling it
glDisable(GL_SCISSOR_TEST);
if (GLState::depth_mask) {
glClearBufferfv(GL_DEPTH, 0, &c);
} else {
glDepthMask(true);
glClearBufferfv(GL_DEPTH, 0, &c);
glDepthMask(false);
}
glEnable(GL_SCISSOR_TEST);
}
glEnable(GL_SCISSOR_TEST);
}
void GSDeviceOGL::ClearStencil(GSTexture* t, uint8 c)