Skip to content

Commit

Permalink
GS/HW: If HW Move is outside of target, make a new target instead
Browse files Browse the repository at this point in the history
  • Loading branch information
refractionpcsx2 committed Jan 12, 2025
1 parent c965bda commit 4214033
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pcsx2/GS/Renderers/HW/GSTextureCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3766,6 +3766,19 @@ bool GSTextureCache::Move(u32 SBP, u32 SBW, u32 SPSM, int sx, int sy, u32 DBP, u
if (alpha_only && (!dst || GSLocalMemory::m_psm[dst->m_TEX0.PSM].bpp != 32))
return false;

// Beware of the case where a game might create a larger texture by moving a bunch of chunks around.
if (dst && DBP == SBP && dy > dst->m_unscaled_size.y)
{
u32 new_DBP = DBP + (((dy / GSLocalMemory::m_psm[dst->m_TEX0.PSM].pgs.y) * DBW) << 5);

dst = nullptr;

DBP = new_DBP;
dy = 0;

dst = GetExactTarget(DBP, DBW, dpsm_s.depth ? DepthStencil : RenderTarget, DBP);
}

// Beware of the case where a game might create a larger texture by moving a bunch of chunks around.
// We use dx/dy == 0 and the TBW check as a safeguard to make sure these go through to local memory.
// We can also recreate the target if it's previously been created in the height cache with a valid size.
Expand Down

0 comments on commit 4214033

Please sign in to comment.