Skip to content

Commit

Permalink
GS/TC: Ignore horizontal offset in invalidation start position
Browse files Browse the repository at this point in the history
  • Loading branch information
refractionpcsx2 committed Sep 7, 2023
1 parent ce90d81 commit 8552a89
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pcsx2/GS/Renderers/HW/GSTextureCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(sbp) - static_cast<int>(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<int>(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))
Expand Down Expand Up @@ -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.

This comment has been minimized.

Copy link
@landodragon141

landodragon141 Sep 8, 2023

typo in horizontal

This comment has been minimized.

Copy link
@refractionpcsx2

refractionpcsx2 Sep 8, 2023

Author Member

bit late now, but thanks.

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));

// 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);
Expand Down

0 comments on commit 8552a89

Please sign in to comment.