From 39b4fd47c756e8d3c9c0cc031ac0a7fab2b596ef Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 21 Jan 2024 15:41:58 +1000 Subject: [PATCH] GS/HW: Fix incorrect page mask in ClearGSLocalMemory() --- pcsx2/GS/Renderers/HW/GSRendererHW.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pcsx2/GS/Renderers/HW/GSRendererHW.cpp b/pcsx2/GS/Renderers/HW/GSRendererHW.cpp index dc08a99350..92f75901bb 100644 --- a/pcsx2/GS/Renderers/HW/GSRendererHW.cpp +++ b/pcsx2/GS/Renderers/HW/GSRendererHW.cpp @@ -6207,7 +6207,7 @@ void GSRendererHW::ClearGSLocalMemory(const GSOffset& off, const GSVector4i& r, pxAssert((off.bp() & (BLOCKS_PER_PAGE - 1)) == 0); for (u32 current_page = off.bp() >> 5; top < page_aligned_bottom; top += pgs.y, current_page += fbw) { - current_page &= 0x7ff; + current_page &= (MAX_PAGES - 1); GSVector4i* ptr = reinterpret_cast(m_mem.vm8() + current_page * PAGE_SIZE); GSVector4i* const ptr_end = ptr + iterations_per_page; while (ptr != ptr_end) @@ -6222,7 +6222,7 @@ void GSRendererHW::ClearGSLocalMemory(const GSOffset& off, const GSVector4i& r, pxAssert((off.bp() & (BLOCKS_PER_PAGE - 1)) == 0); for (u32 current_page = off.bp() >> 5; top < page_aligned_bottom; top += pgs.y, current_page += fbw) { - current_page &= 0x7ff; + current_page &= (MAX_PAGES - 1); GSVector4i* ptr = reinterpret_cast(m_mem.vm8() + current_page * PAGE_SIZE); GSVector4i* const ptr_end = ptr + iterations_per_page; while (ptr != ptr_end) @@ -6241,7 +6241,7 @@ void GSRendererHW::ClearGSLocalMemory(const GSOffset& off, const GSVector4i& r, pxAssert((off.bp() & (BLOCKS_PER_PAGE - 1)) == 0); for (u32 current_page = off.bp() >> 5; top < page_aligned_bottom; top += pgs.y, current_page += fbw) { - current_page &= 0x7ff; + current_page &= (MAX_PAGES - 1); GSVector4i* ptr = reinterpret_cast(m_mem.vm8() + current_page * PAGE_SIZE); GSVector4i* const ptr_end = ptr + iterations_per_page; while (ptr != ptr_end)