GS/HW: avoid divide by zero's in draw rect calculations

This commit is contained in:
refractionpcsx2 2023-07-04 10:24:31 +01:00
parent 08649b7aa8
commit 92b6c1c08d
2 changed files with 2 additions and 2 deletions

View File

@ -491,7 +491,7 @@ GSVector4i GSLocalMemory::GetRectForPageOffset(u32 base_bp, u32 offset_bp, u32 b
const u32 page_offset = (offset_bp - base_bp) >> 5;
const GSVector2i& pgs = m_psm[psm].pgs;
const GSVector2i page_offset_xy = GSVector2i(page_offset % bw, page_offset / bw);
const GSVector2i page_offset_xy = GSVector2i(page_offset % bw, page_offset / std::max(1U, bw));
return GSVector4i(pgs * page_offset_xy).xyxy() + GSVector4i::loadh(pgs);
}

View File

@ -914,7 +914,7 @@ GSVector4i GSRendererHW::GetSplitTextureShuffleDrawRect() const
GSVector4i GSRendererHW::GetDrawRectForPages(u32 bw, u32 psm, u32 num_pages)
{
const GSVector2i& pgs = GSLocalMemory::m_psm[psm].pgs;
const GSVector2i size = GSVector2i(static_cast<int>(bw) * pgs.x, static_cast<int>(num_pages / bw) * pgs.y);
const GSVector2i size = GSVector2i(static_cast<int>(bw) * pgs.x, static_cast<int>(num_pages / std::max(1U, bw)) * pgs.y);
return GSVector4i::loadh(size);
}