gsdx ogl: tentative hack to make FFX go along with depth option

Issue1: Depth buffer is wrongly invalidated only the first page is detected.

Issue2: First page seems to be partially written. Could be a GSdx transfer bug.
Anyway, invalidation only support a page granularity.

So here a quick workaround that will clear depth buffer in case of very small partial write.

Might worth to check regression on nocturne/digital saga
This commit is contained in:
Gregory Hainaut 2016-05-17 19:28:11 +02:00
parent df5035d975
commit a4c7541092
1 changed files with 14 additions and 2 deletions

View File

@ -773,9 +773,9 @@ void GSTextureCache::InvalidateVideoMem(GSOffset* off, const GSVector4i& rect, b
{
if(!found && GSUtil::HasCompatibleBits(psm, t->m_TEX0.PSM))
{
GL_CACHE("TC: Dirty Target(%s) %d (0x%x)", to_string(type),
GL_CACHE("TC: Dirty Target(%s) %d (0x%x) r(%d,%d,%d,%d)", to_string(type),
t->m_texture ? t->m_texture->GetID() : 0,
t->m_TEX0.TBP0);
t->m_TEX0.TBP0, r.x, r.y, r.z, r.w);
t->m_dirty.push_back(GSDirtyRect(r, psm));
t->m_TEX0.TBW = bw;
}
@ -1765,6 +1765,18 @@ void GSTextureCache::Target::Update()
m_renderer->m_dev->ClearDepth(m_texture, 0);
return;
} else if (m_type == DepthStencil && r.x == 0 && r.y == 0 && r.width() <= 64 && r.height() <= 32) {
GL_INS("ERROR: bad invalidation detected, depth buffer will be cleared");
// FFX2 menu. Invalidation of the depth is wrongly done and only the first
// page is invalidated. Technically a CRC hack will be better but I don't expect
// any games to only upload a single page of data for the depth.
//
// FFX2 menu got another bug. I'm not sure the top-left is properly written or not. It
// could be a gsdx transfer bug too due to unaligned-page transfer.
//
// So the quick and dirty solution is just to clean the depth buffer.
m_renderer->m_dev->ClearDepth(m_texture, 0);
return;
}
int w = r.width();