GS/TC: When preloading new targets, include the preloaded size as valid

This commit is contained in:
refractionpcsx2 2024-03-30 20:30:11 +00:00
parent 553ad0a372
commit 8a73f98b1f
1 changed files with 5 additions and 3 deletions

View File

@ -2367,7 +2367,7 @@ GSTextureCache::Target* GSTextureCache::CreateTarget(GIFRegTEX0 TEX0, const GSVe
dst->m_last_draw = GSState::s_n; dst->m_last_draw = GSState::s_n;
if (dst->m_dirty.empty() && (GSUtil::GetChannelMask(TEX0.PSM) & 0x8)) if (dst->m_dirty.empty() && GSLocalMemory::m_psm[TEX0.PSM].depth == 0 && (GSUtil::GetChannelMask(TEX0.PSM) & 0x8))
dst->m_rt_alpha_scale = true; dst->m_rt_alpha_scale = true;
else else
dst->m_last_draw -= 1; // If we preload and it needs to decorrect and we couldn't catch it early, we need to make sure it decorrects the data. dst->m_last_draw -= 1; // If we preload and it needs to decorrect and we couldn't catch it early, we need to make sure it decorrects the data.
@ -2494,6 +2494,8 @@ bool GSTextureCache::PreloadTarget(GIFRegTEX0 TEX0, const GSVector2i& size, cons
if (!eerect.rempty()) if (!eerect.rempty())
{ {
if(!hw_clear)
dst->UpdateValidity(newrect);
GL_INS("Preloading the RT DATA from updated GS Memory"); GL_INS("Preloading the RT DATA from updated GS Memory");
AddDirtyRectTarget(dst, newrect, TEX0.PSM, TEX0.TBW, rgba, GSLocalMemory::m_psm[TEX0.PSM].trbpp >= 16); AddDirtyRectTarget(dst, newrect, TEX0.PSM, TEX0.TBW, rgba, GSLocalMemory::m_psm[TEX0.PSM].trbpp >= 16);
} }
@ -2511,12 +2513,12 @@ bool GSTextureCache::PreloadTarget(GIFRegTEX0 TEX0, const GSVector2i& size, cons
} }
} }
GL_INS("Preloading the RT DATA"); GL_INS("Preloading the RT DATA");
// Don't set valid here, because we have no guarantee this is the data we want.
AddDirtyRectTarget(dst, newrect, TEX0.PSM, TEX0.TBW, rgba, GSLocalMemory::m_psm[TEX0.PSM].trbpp >= 16); AddDirtyRectTarget(dst, newrect, TEX0.PSM, TEX0.TBW, rgba, GSLocalMemory::m_psm[TEX0.PSM].trbpp >= 16);
} }
} }
dst->UpdateValidity(GSVector4i::loadh(valid_size));
// Can't do channel writes to depth targets, and DirectX can't partial copy depth targets. // Can't do channel writes to depth targets, and DirectX can't partial copy depth targets.
if (psm_s.depth == 0) if (psm_s.depth == 0)
{ {