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

This commit is contained in:
Stenzek 2023-04-16 02:15:48 +10:00 committed by refractionpcsx2
parent bde81380c3
commit e7fc3de90c
1 changed files with 2 additions and 2 deletions

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;