GS/HW: Allow previous frame in depth source lookup

Fixes pulling random junk from local memory in Black after adjusting
vsync timing.
This commit is contained in:
Stenzek 2023-02-10 23:33:36 +10:00 committed by refractionpcsx2
parent 59cbdc79f5
commit 6f595b7d87
1 changed files with 2 additions and 2 deletions

View File

@ -148,7 +148,7 @@ GSTextureCache::Source* GSTextureCache::LookupDepthSource(const GIFRegTEX0& TEX0
for (auto t : m_dst[RenderTarget])
{
// FIXME: do I need to allow m_age == 1 as a potential match (as DepthStencil) ???
if (!t->m_age && t->m_used && t->m_dirty.empty() && GSUtil::HasSharedBits(bp, psm, t->m_TEX0.TBP0, t->m_TEX0.PSM))
if (t->m_age <= 1 && t->m_used && t->m_dirty.empty() && GSUtil::HasSharedBits(bp, psm, t->m_TEX0.TBP0, t->m_TEX0.PSM))
{
ASSERT(GSLocalMemory::m_psm[t->m_TEX0.PSM].depth);
dst = t;
@ -504,7 +504,7 @@ GSTextureCache::Source* GSTextureCache::LookupSource(const GIFRegTEX0& TEX0, con
// 1/ Check only current frame, I guess it is only used as a postprocessing effect
for (auto t : m_dst[DepthStencil])
{
if (!t->m_age && t->m_used && t->m_dirty.empty() && GSUtil::HasSharedBits(bp, psm, t->m_TEX0.TBP0, t->m_TEX0.PSM))
if (t->m_age <= 1 && t->m_used && t->m_dirty.empty() && GSUtil::HasSharedBits(bp, psm, t->m_TEX0.TBP0, t->m_TEX0.PSM))
{
GL_INS("TC: Warning depth format read as color format. Pixels will be scrambled");
// Let's fetch a depth format texture. Rational, it will avoid the texture allocation and the