From e7fc3de90cba050f494f38b102fe4d6355a1056e Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 16 Apr 2023 02:15:48 +1000 Subject: [PATCH] GS/HW: Ensure region texture mipmaps don't go out of bounds --- pcsx2/GS/Renderers/HW/GSTextureCache.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pcsx2/GS/Renderers/HW/GSTextureCache.cpp b/pcsx2/GS/Renderers/HW/GSTextureCache.cpp index e72bdc264a..b468c8201b 100644 --- a/pcsx2/GS/Renderers/HW/GSTextureCache.cpp +++ b/pcsx2/GS/Renderers/HW/GSTextureCache.cpp @@ -5127,13 +5127,13 @@ GSTextureCache::SourceRegion GSTextureCache::SourceRegion::AdjustForMipmap(u32 l if (HasX()) { const u32 new_minx = GetMinX() >> level; - const u32 new_maxx = std::max(GetMaxX() >> level, new_minx + 1); + const u32 new_maxx = new_minx + std::max(GetWidth() >> level, 1u); ret.SetX(new_minx, new_maxx); } if (HasY()) { const u32 new_miny = GetMinY() >> level; - const u32 new_maxy = std::max(GetMaxY() >> level, new_miny + 1); + const u32 new_maxy = new_miny + std::max(GetHeight() >> level, 1u); ret.SetY(new_miny, new_maxy); } return ret;