GS/HW: Ignore any preload outside of the valid area

This commit is contained in:
refractionpcsx2 2024-06-27 00:06:22 +01:00
parent cd300c21d9
commit b38d008a96
1 changed files with 5 additions and 2 deletions

View File

@ -2471,9 +2471,9 @@ bool GSTextureCache::PreloadTarget(GIFRegTEX0 TEX0, const GSVector2i& size, cons
break;
const u32 transfer_end = GSLocalMemory::GetUnwrappedEndBlockAddress(iter->blit.DBP, iter->blit.DBW, iter->blit.DPSM, iter->rect);
const u32 transfer_start = GSLocalMemory::GetStartBlockAddress(iter->blit.DBP, iter->blit.DBW, iter->blit.DPSM, iter->rect);
// If the format, and location doesn't overlap
if (transfer_end >= TEX0.TBP0 && iter->blit.DBP <= rect_end && GSUtil::HasCompatibleBits(iter->blit.DPSM, TEX0.PSM))
if (transfer_end >= TEX0.TBP0 && transfer_start <= rect_end && GSUtil::HasCompatibleBits(iter->blit.DPSM, TEX0.PSM))
{
GSVector4i targetr = {};
const bool can_translate = CanTranslate(iter->blit.DBP, iter->blit.DBW, iter->blit.DPSM, iter->rect, TEX0.TBP0, TEX0.PSM, TEX0.TBW);
@ -2545,6 +2545,9 @@ bool GSTextureCache::PreloadTarget(GIFRegTEX0 TEX0, const GSVector2i& size, cons
}
}
// It's possible some games (like Valkyrie Profile 2) will dirty an area outside of the valid area, which we don't care about.
eerect = eerect.rintersect(newrect);
if (!eerect.rempty())
{
const GSVector4i save_rect = preserve_target ? newrect : eerect;