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,38 +240,43 @@ 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);
|
||||||
// some bad data.
|
GSVector4 dRect(0, 0, w, h);
|
||||||
for(list<Target*>::iterator i = m_dst[RenderTarget].begin(); i != m_dst[RenderTarget].end(); i++)
|
|
||||||
|
// Depth stencil/RT can be an older RT/DS but only check recent RT/DS to avoid to pick
|
||||||
|
// some bad data.
|
||||||
|
|
||||||
|
for(list<Target*>::iterator i = m_dst[rev_type].begin(); i != m_dst[rev_type].end(); i++)
|
||||||
|
{
|
||||||
|
Target* t = *i;
|
||||||
|
|
||||||
|
if(!t->m_age && bp == t->m_TEX0.TBP0)
|
||||||
{
|
{
|
||||||
Target* t = *i;
|
dst = CreateTarget(TEX0, w, h, type);
|
||||||
|
if (type == DepthStencil) {
|
||||||
if(!t->m_age && bp == t->m_TEX0.TBP0)
|
|
||||||
{
|
|
||||||
GL_CACHE("TC: Lookup Target(Depth) %dx%d, hit Color (0x%x)", w, h, bp);
|
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);
|
|
||||||
GSVector4 sRect(0, 0, 1.0, 1.0);
|
|
||||||
GSVector4 dRect(0, 0, w, h);
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(dst == NULL)
|
||||||
|
{
|
||||||
|
GL_CACHE("TC: Lookup Target(T%d) %dx%d, miss (0x%x)", type, w, h, bp);
|
||||||
|
|
||||||
|
dst = CreateTarget(TEX0, w, h, type);
|
||||||
|
|
||||||
if(dst == NULL)
|
if(dst == NULL)
|
||||||
{
|
return NULL;
|
||||||
GL_CACHE("TC: Lookup Target(T%d) %dx%d, miss (0x%x)", type, w, h, bp);
|
|
||||||
|
|
||||||
dst = CreateTarget(TEX0, w, h, type);
|
|
||||||
|
|
||||||
if(dst == NULL)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_renderer->CanUpscale())
|
if(m_renderer->CanUpscale())
|
||||||
|
|
Loading…
Reference in New Issue