GS/TC: Only adjust target start on full pages

This commit is contained in:
refractionpcsx2
2026-07-27 17:47:13 +02:00
committed by lightningterror
parent 8a7cb62b01
commit c0f1e713d3
+6 -2
View File
@@ -3877,9 +3877,13 @@ bool GSTextureCache::PreloadTarget(GIFRegTEX0 TEX0, const GSVector2i& size, cons
}
const int height_adjust = ((((dst_end_block + 31) - old_dst->m_TEX0.TBP0) >> 5) / std::max(old_dst->m_TEX0.TBW, 1U)) * GSLocalMemory::m_psm[old_dst->m_TEX0.PSM].pgs.y;
bool delete_target = true;
if (height_adjust < old_dst->m_unscaled_size.y)
// If it's only a partial overlap, we don't want to change the TBP, it needs to be on a page boundary, we can just lump it.
const GSVector4i dst_valid_rounded = GSVector4i(dst_valid.x, dst_valid.y, dst_valid.z, dst_valid.w & ~(GSLocalMemory::m_psm[dst->m_TEX0.PSM].pgs.y - 1));
const u32 dst_end_block_rounded = GSLocalMemory::GetEndBlockAddress(dst->m_TEX0.TBP0, dst->m_TEX0.TBW, dst->m_TEX0.PSM, dst_valid_rounded) + 1;
bool delete_target = (static_cast<int>(dst_end_block_rounded - old_dst->m_TEX0.TBP0) / 16) >= 1;
if (height_adjust < old_dst->m_unscaled_size.y && delete_target)
{
old_dst->m_TEX0.TBP0 = GSLocalMemory::GetStartBlockAddress(old_dst->m_TEX0.TBP0, old_dst->m_TEX0.TBW, old_dst->m_TEX0.PSM, GSVector4i(0, height_adjust, old_dst->m_valid.z, old_dst->m_valid.w));
old_dst->m_valid.w -= height_adjust;