GS/HW: Compare dirty rects by valid bounds

This commit is contained in:
refractionpcsx2 2024-03-21 20:11:12 +00:00
parent 4ba43b8496
commit 2a6d71cd5a
1 changed files with 5 additions and 4 deletions

View File

@ -160,11 +160,12 @@ void GSTextureCache::AddDirtyRectTarget(Target* target, GSVector4i rect, u32 psm
skipdirty = true; skipdirty = true;
break; break;
} }
const GSVector4i valid_rect = rect.rintersect(target->m_valid);
const GSVector4i dirty_rect = it[0].r.rintersect(target->m_valid);
// Edges lined up so just expand the dirty rect // Edges lined up so just expand the dirty rect
if ((it[0].r.xzxz().eq(rect.xzxz()) && (it[0].r.wwww().eq(rect.yyyy()) || it[0].r.yyyy().eq(rect.wwww()))) || if ((dirty_rect.xzxz().eq(valid_rect.xzxz()) && (dirty_rect.wwww().eq(valid_rect.yyyy()) || dirty_rect.yyyy().eq(valid_rect.wwww()))) ||
(it[0].r.ywyw().eq(rect.ywyw()) && (it[0].r.zzzz().eq(rect.xxxx()) || it[0].r.xxxx().eq(rect.zzzz()))) || (dirty_rect.ywyw().eq(valid_rect.ywyw()) && (dirty_rect.zzzz().eq(valid_rect.xxxx()) || dirty_rect.xxxx().eq(valid_rect.zzzz()))) ||
it[0].r.rintersect(rect).eq(it[0].r)) // If the new rect completely envelops the old one. dirty_rect.rintersect(valid_rect).eq(dirty_rect)) // If the new rect completely envelops the old one.
{ {
rect = rect.runion(it[0].r); rect = rect.runion(it[0].r);
it = target->m_dirty.erase(it); it = target->m_dirty.erase(it);