GS/TC: Check for y offset when calculating block offset.

Make sure the rect starts at the beginning.
This commit is contained in:
lightningterror 2025-10-04 00:04:26 +02:00
parent 96ac35a4bd
commit b451602f69

View File

@ -8014,7 +8014,9 @@ GSTextureCache::SurfaceOffset GSTextureCache::ComputeSurfaceOffset(const Surface
if (a_el.bp >= b_el.bp)
{
// A starts after B, search <x,y> offset from B to A in B coords.
for (b2a_offset.y = b_rect.y; b2a_offset.y < b_rect.w; b2a_offset.y += dy)
const u32 b_bw = b_psm_s.trbpp > 8 ? std::max(1U, b_el.bw) : std::max(1U, b_el.bw / 2);
const int y_page_offset = std::max(b_rect.y, static_cast<int>((((a_el.bp >= b_el.bp) >> 5) / b_bw) * b_psm_s.pgs.y));
for (b2a_offset.y = y_page_offset; b2a_offset.y < b_rect.w; b2a_offset.y += dy)
{
for (b2a_offset.x = b_rect.x; b2a_offset.x < b_rect.z; b2a_offset.x += dx)
{