diff --git a/pcsx2/GS/Renderers/HW/GSTextureCache.cpp b/pcsx2/GS/Renderers/HW/GSTextureCache.cpp index f171f37117..85647feada 100644 --- a/pcsx2/GS/Renderers/HW/GSTextureCache.cpp +++ b/pcsx2/GS/Renderers/HW/GSTextureCache.cpp @@ -408,9 +408,6 @@ void GSTextureCache::DirtyRectByPage(u32 sbp, u32 spsm, u32 sbw, Target* t, GSVe GSVector4i in_rect = src_r; u32 target_bp = t->m_TEX0.TBP0; int block_offset = static_cast(sbp) - static_cast(target_bp); - int page_offset = (block_offset) >> 5; - const int start_page = page_offset + (src_r.x / src_info->pgs.x) + ((src_r.y / src_info->pgs.y) * std::max(static_cast(sbw), 1)); - // Different format needs to be page aligned, unless the block layout matches, then we can block align // Might be able to translate the original rect. if (!(src_info->bpp == dst_info->bpp)) @@ -454,6 +451,10 @@ void GSTextureCache::DirtyRectByPage(u32 sbp, u32 spsm, u32 sbw, Target* t, GSVe const int src_pg_width = std::max((src_width + (src_info->pgs.x - 1)) / src_info->pgs.x, 1); const int dst_pg_width = std::max((dst_width + (dst_info->pgs.x - 1)) / dst_info->pgs.x, 1); + int page_offset = (block_offset) >> 5; + // remove any hoizontal offset, this is added back on later. + const int start_page = (page_offset - (page_offset % src_pg_width)) + (src_r.x / src_info->pgs.x) + ((src_r.y / src_info->pgs.y) * std::max(static_cast(sbw), 1)); + // Pages aligned. const GSVector4i page_mask(GSVector4i((src_info->pgs.x - 1), (src_info->pgs.y - 1)).xyxy()); const GSVector4i page_masked_rect(in_rect & ~page_mask);