Clamp amount of mipmap levels to max allowed for all backends (#7197)

* Clamp amount of mipmap levels to max allowed for all backends

* XML docs

* Remove using
This commit is contained in:
gdkchan 2024-08-12 17:45:25 -03:00 committed by GitHub
parent 8d8983049e
commit 4f75e26ec7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 36 additions and 25 deletions

View file

@ -1,6 +1,5 @@
using Ryujinx.Common;
using System;
using System.Numerics;
namespace Ryujinx.Graphics.GAL
{
@ -113,25 +112,6 @@ namespace Ryujinx.Graphics.GAL
return 1;
}
public int GetLevelsClamped()
{
int maxSize = Width;
if (Target != Target.Texture1D &&
Target != Target.Texture1DArray)
{
maxSize = Math.Max(maxSize, Height);
}
if (Target == Target.Texture3D)
{
maxSize = Math.Max(maxSize, Depth);
}
int maxLevels = BitOperations.Log2((uint)maxSize) + 1;
return Math.Min(Levels, maxLevels);
}
private static int GetLevelSize(int size, int level)
{
return Math.Max(1, size >> level);