GS/HW: Ensure region texture mipmaps don't go out of bounds

This commit is contained in:
Stenzek authored and refractionpcsx2 committed 2023-04-15 20:10:15 +01:00
1 parent bde81380c3
commit e7fc3de90c
1 file changed
+2 -2
+2 -2
View File
@@ -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<u32>(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<u32>(GetMaxY() >> level, new_miny + 1);
const u32 new_maxy = new_miny + std::max(GetHeight() >> level, 1u);
ret.SetY(new_miny, new_maxy);
}
return ret;