Skip to content

Commit

Permalink
GS/TC: Readd horizontal offset if not processed during invalidation
Browse files Browse the repository at this point in the history
  • Loading branch information
refractionpcsx2 committed Nov 16, 2023
1 parent 6967e66 commit 62c3575
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pcsx2/GS/Renderers/HW/GSTextureCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,9 @@ void GSTextureCache::DirtyRectByPage(u32 sbp, u32 spsm, u32 sbw, Target* t, GSVe

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<int>(sbw), 1));
int start_page = page_offset + (src_r.x / src_info->pgs.x) + ((src_r.y / src_info->pgs.y) * std::max(static_cast<int>(sbw), 1));
const int horizontal_pages = (start_page % src_pg_width);
start_page -= horizontal_pages;

// Pages aligned.
const GSVector4i page_mask(GSVector4i((src_info->pgs.x - 1), (src_info->pgs.y - 1)).xyxy());
Expand Down Expand Up @@ -512,6 +514,9 @@ void GSTextureCache::DirtyRectByPage(u32 sbp, u32 spsm, u32 sbw, Target* t, GSVe
// Update the block offset.
block_offset = static_cast<int>(sbp) - static_cast<int>(target_bp);
}

if (!x_offset)
start_page += horizontal_pages;

const bool matched_format = (src_info->bpp == dst_info->bpp);
const bool block_matched_format = matched_format && block_aligned_rect;
Expand Down

0 comments on commit 62c3575

Please sign in to comment.