mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2024-12-22 22:36:25 +00:00
Improved Min/Mip -> MinFilter enum conversion
This commit is contained in:
parent
1bb08742c1
commit
cdeeac163f
@ -94,10 +94,42 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
|
||||
public MinFilter UnpackMinFilter()
|
||||
{
|
||||
int minFilter = (int)(Word1 >> 4) & 3;
|
||||
int mipFilter = (int)(Word1 >> 6) & 3;
|
||||
SamplerMinFilter minFilter = (SamplerMinFilter)((Word1 >> 4) & 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()
|
||||
|
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
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user