Improved Min/Mip -> MinFilter enum conversion
This commit is contained in:
parent
1bb08742c1
commit
cdeeac163f
3 changed files with 52 additions and 3 deletions
|
@ -94,10 +94,42 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||||
|
|
||||||
public MinFilter UnpackMinFilter()
|
public MinFilter UnpackMinFilter()
|
||||||
{
|
{
|
||||||
int minFilter = (int)(Word1 >> 4) & 3;
|
SamplerMinFilter minFilter = (SamplerMinFilter)((Word1 >> 4) & 3);
|
||||||
int mipFilter = (int)(Word1 >> 6) & 3;
|
SamplerMipFilter mipFilter = (SamplerMipFilter)((Word1 >> 6) & 3);
|
||||||
|
|
||||||
return (MinFilter)(minFilter + (mipFilter - 1) * 2);
|
return ConvertFilter(minFilter, mipFilter);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static MinFilter ConvertFilter(SamplerMinFilter minFilter, SamplerMipFilter mipFilter)
|
||||||
|
{
|
||||||
|
switch (mipFilter)
|
||||||
|
{
|
||||||
|
case SamplerMipFilter.None:
|
||||||
|
switch (minFilter)
|
||||||
|
{
|
||||||
|
case SamplerMinFilter.Nearest: return MinFilter.Nearest;
|
||||||
|
case SamplerMinFilter.Linear: return MinFilter.Linear;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SamplerMipFilter.Nearest:
|
||||||
|
switch (minFilter)
|
||||||
|
{
|
||||||
|
case SamplerMinFilter.Nearest: return MinFilter.NearestMipmapNearest;
|
||||||
|
case SamplerMinFilter.Linear: return MinFilter.LinearMipmapNearest;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SamplerMipFilter.Linear:
|
||||||
|
switch (minFilter)
|
||||||
|
{
|
||||||
|
case SamplerMinFilter.Nearest: return MinFilter.NearestMipmapLinear;
|
||||||
|
case SamplerMinFilter.Linear: return MinFilter.LinearMipmapLinear;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return MinFilter.Nearest;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReductionFilter UnpackReductionFilter()
|
public ReductionFilter UnpackReductionFilter()
|
||||||
|
|
8
Ryujinx.Graphics.Gpu/Image/SamplerMinFilter.cs
Normal file
8
Ryujinx.Graphics.Gpu/Image/SamplerMinFilter.cs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
namespace Ryujinx.Graphics.Gpu.Image
|
||||||
|
{
|
||||||
|
enum SamplerMinFilter
|
||||||
|
{
|
||||||
|
Nearest = 1,
|
||||||
|
Linear
|
||||||
|
}
|
||||||
|
}
|
9
Ryujinx.Graphics.Gpu/Image/SamplerMipFilter.cs
Normal file
9
Ryujinx.Graphics.Gpu/Image/SamplerMipFilter.cs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
namespace Ryujinx.Graphics.Gpu.Image
|
||||||
|
{
|
||||||
|
enum SamplerMipFilter
|
||||||
|
{
|
||||||
|
None = 1,
|
||||||
|
Nearest,
|
||||||
|
Linear
|
||||||
|
}
|
||||||
|
}
|
Reference in a new issue