gsdx tc: partial support of pseudo depth for Dx

Fix #1457 (GTA)

The game uses a depth format for a pure color buffer (cokes do ravage
in gaming industry)

However I'm really afraid that it migth break another effect in other games.
This commit is contained in:
Gregory Hainaut 2016-07-22 20:38:46 +02:00
parent d58c07d697
commit aea75f51bd
1 changed files with 11 additions and 8 deletions

View File

@ -87,11 +87,6 @@ void GSTextureCache::RemoveAll()
GSTextureCache::Source* GSTextureCache::LookupDepthSource(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, const GSVector4i& r, bool palette) GSTextureCache::Source* GSTextureCache::LookupDepthSource(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, const GSVector4i& r, bool palette)
{ {
if (!CanConvertDepth()) {
GL_CACHE("LookupDepthSource not supported (0x%x, F:0x%x)", TEX0.TBP0, TEX0.PSM);
throw GSDXRecoverableError();
}
const GSLocalMemory::psm_t& psm_s = GSLocalMemory::m_psm[TEX0.PSM]; const GSLocalMemory::psm_t& psm_s = GSLocalMemory::m_psm[TEX0.PSM];
Source* src = NULL; Source* src = NULL;
@ -110,6 +105,17 @@ GSTextureCache::Source* GSTextureCache::LookupDepthSource(const GIFRegTEX0& TEX0
} }
} }
if (!CanConvertDepth()) {
if (dst) {
GL_CACHE("LookupDepthSource not supported (0x%x, F:0x%x)", TEX0.TBP0, TEX0.PSM);
throw GSDXRecoverableError();
} else {
// LookupSource call LookupDepthSource, I'm sure it is nice testcase for formal tools ;)
GL_CACHE("LookupDepthSource not supported let's try standard LookupSource");
return LookupSource(TEX0, TEXA, r);
}
}
if (!dst) { if (!dst) {
// Retry on the render target (Silent Hill 4) // Retry on the render target (Silent Hill 4)
for(auto t : m_dst[RenderTarget]) { for(auto t : m_dst[RenderTarget]) {
@ -617,9 +623,6 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int
// must invalidate the Target/Depth respectively // must invalidate the Target/Depth respectively
void GSTextureCache::InvalidateVideoMemType(int type, uint32 bp) void GSTextureCache::InvalidateVideoMemType(int type, uint32 bp)
{ {
if (!CanConvertDepth())
return;
for(list<Target*>::iterator i = m_dst[type].begin(); i != m_dst[type].end(); i++) for(list<Target*>::iterator i = m_dst[type].begin(); i != m_dst[type].end(); i++)
{ {
Target* t = *i; Target* t = *i;