mirror of https://github.com/PCSX2/pcsx2.git
gsdx-tc: Depth and Target are interchangeable on the GS !!!
Extend the texture cache to search Color target in Depth target
This commit is contained in:
parent
76160505f7
commit
2d812deb84
|
@ -240,23 +240,31 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int
|
||||||
GL_CACHE("TC: Lookup Target(T%d) %dx%d, hit: %d (0x%x)", type, w, h, dst->m_texture->GetID(), bp);
|
GL_CACHE("TC: Lookup Target(T%d) %dx%d, hit: %d (0x%x)", type, w, h, dst->m_texture->GetID(), bp);
|
||||||
|
|
||||||
dst->Update();
|
dst->Update();
|
||||||
} else {
|
} else if (CanConvertDepth()) {
|
||||||
|
|
||||||
if (type == DepthStencil && CanConvertDepth()) {
|
int rev_type = (type == DepthStencil) ? RenderTarget : DepthStencil;
|
||||||
// Depth stencil can be an older RT but only check recent RT to avoid to pick
|
GSVector4 sRect(0, 0, 1.0, 1.0);
|
||||||
|
GSVector4 dRect(0, 0, w, h);
|
||||||
|
|
||||||
|
// Depth stencil/RT can be an older RT/DS but only check recent RT/DS to avoid to pick
|
||||||
// some bad data.
|
// some bad data.
|
||||||
for(list<Target*>::iterator i = m_dst[RenderTarget].begin(); i != m_dst[RenderTarget].end(); i++)
|
|
||||||
|
for(list<Target*>::iterator i = m_dst[rev_type].begin(); i != m_dst[rev_type].end(); i++)
|
||||||
{
|
{
|
||||||
Target* t = *i;
|
Target* t = *i;
|
||||||
|
|
||||||
if(!t->m_age && bp == t->m_TEX0.TBP0)
|
if(!t->m_age && bp == t->m_TEX0.TBP0)
|
||||||
{
|
{
|
||||||
GL_CACHE("TC: Lookup Target(Depth) %dx%d, hit Color (0x%x)", w, h, bp);
|
|
||||||
// Convert the RenderTarget into a Depth Buffer
|
|
||||||
dst = CreateTarget(TEX0, w, h, type);
|
dst = CreateTarget(TEX0, w, h, type);
|
||||||
GSVector4 sRect(0, 0, 1.0, 1.0);
|
if (type == DepthStencil) {
|
||||||
GSVector4 dRect(0, 0, w, h);
|
GL_CACHE("TC: Lookup Target(Depth) %dx%d, hit Color (0x%x)", w, h, bp);
|
||||||
m_renderer->m_dev->StretchRect(t->m_texture, sRect, dst->m_texture, dRect, 12, false);
|
m_renderer->m_dev->StretchRect(t->m_texture, sRect, dst->m_texture, dRect, 12, false);
|
||||||
|
} else {
|
||||||
|
GL_CACHE("TC: Lookup Target(Color) %dx%d, hit Depth (0x%x)", w, h, bp);
|
||||||
|
m_renderer->m_dev->StretchRect(t->m_texture, sRect, dst->m_texture, dRect, 11, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -268,11 +276,8 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int
|
||||||
dst = CreateTarget(TEX0, w, h, type);
|
dst = CreateTarget(TEX0, w, h, type);
|
||||||
|
|
||||||
if(dst == NULL)
|
if(dst == NULL)
|
||||||
{
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(m_renderer->CanUpscale())
|
if(m_renderer->CanUpscale())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue