mirror of https://github.com/PCSX2/pcsx2.git
GS/HW: Ensure region texture mipmaps don't go out of bounds
This commit is contained in:
parent
bde81380c3
commit
e7fc3de90c
|
@ -5127,13 +5127,13 @@ GSTextureCache::SourceRegion GSTextureCache::SourceRegion::AdjustForMipmap(u32 l
|
||||||
if (HasX())
|
if (HasX())
|
||||||
{
|
{
|
||||||
const u32 new_minx = GetMinX() >> level;
|
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);
|
ret.SetX(new_minx, new_maxx);
|
||||||
}
|
}
|
||||||
if (HasY())
|
if (HasY())
|
||||||
{
|
{
|
||||||
const u32 new_miny = GetMinY() >> level;
|
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);
|
ret.SetY(new_miny, new_maxy);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue