mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-18 07:26:43 +00:00
Add seamless cubemap flag in sampler parameters. (#1658)
* Add seamless cubemap flag in sampler parameters. * Check for the extension
This commit is contained in:
parent
e1da7df207
commit
4c6feb652f
5 changed files with 44 additions and 21 deletions
|
@ -5,6 +5,8 @@ namespace Ryujinx.Graphics.GAL
|
||||||
public MinFilter MinFilter { get; }
|
public MinFilter MinFilter { get; }
|
||||||
public MagFilter MagFilter { get; }
|
public MagFilter MagFilter { get; }
|
||||||
|
|
||||||
|
public bool SeamlessCubemap { get; }
|
||||||
|
|
||||||
public AddressMode AddressU { get; }
|
public AddressMode AddressU { get; }
|
||||||
public AddressMode AddressV { get; }
|
public AddressMode AddressV { get; }
|
||||||
public AddressMode AddressP { get; }
|
public AddressMode AddressP { get; }
|
||||||
|
@ -22,6 +24,7 @@ namespace Ryujinx.Graphics.GAL
|
||||||
public SamplerCreateInfo(
|
public SamplerCreateInfo(
|
||||||
MinFilter minFilter,
|
MinFilter minFilter,
|
||||||
MagFilter magFilter,
|
MagFilter magFilter,
|
||||||
|
bool seamlessCubemap,
|
||||||
AddressMode addressU,
|
AddressMode addressU,
|
||||||
AddressMode addressV,
|
AddressMode addressV,
|
||||||
AddressMode addressP,
|
AddressMode addressP,
|
||||||
|
@ -35,6 +38,7 @@ namespace Ryujinx.Graphics.GAL
|
||||||
{
|
{
|
||||||
MinFilter = minFilter;
|
MinFilter = minFilter;
|
||||||
MagFilter = magFilter;
|
MagFilter = magFilter;
|
||||||
|
SeamlessCubemap = seamlessCubemap;
|
||||||
AddressU = addressU;
|
AddressU = addressU;
|
||||||
AddressV = addressV;
|
AddressV = addressV;
|
||||||
AddressP = addressP;
|
AddressP = addressP;
|
||||||
|
|
|
@ -23,6 +23,8 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||||
MinFilter minFilter = descriptor.UnpackMinFilter();
|
MinFilter minFilter = descriptor.UnpackMinFilter();
|
||||||
MagFilter magFilter = descriptor.UnpackMagFilter();
|
MagFilter magFilter = descriptor.UnpackMagFilter();
|
||||||
|
|
||||||
|
bool seamlessCubemap = descriptor.UnpackSeamlessCubemap();
|
||||||
|
|
||||||
AddressMode addressU = descriptor.UnpackAddressU();
|
AddressMode addressU = descriptor.UnpackAddressU();
|
||||||
AddressMode addressV = descriptor.UnpackAddressV();
|
AddressMode addressV = descriptor.UnpackAddressV();
|
||||||
AddressMode addressP = descriptor.UnpackAddressP();
|
AddressMode addressP = descriptor.UnpackAddressP();
|
||||||
|
@ -49,6 +51,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||||
HostSampler = context.Renderer.CreateSampler(new SamplerCreateInfo(
|
HostSampler = context.Renderer.CreateSampler(new SamplerCreateInfo(
|
||||||
minFilter,
|
minFilter,
|
||||||
magFilter,
|
magFilter,
|
||||||
|
seamlessCubemap,
|
||||||
addressU,
|
addressU,
|
||||||
addressV,
|
addressV,
|
||||||
addressP,
|
addressP,
|
||||||
|
|
|
@ -184,6 +184,15 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||||
return MinFilter.Nearest;
|
return MinFilter.Nearest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Unpacks the seamless cubemap flag.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The seamless cubemap flag</returns>
|
||||||
|
public bool UnpackSeamlessCubemap()
|
||||||
|
{
|
||||||
|
return (Word1 & (1 << 9)) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Unpacks the reduction filter, used with texture minification linear filtering.
|
/// Unpacks the reduction filter, used with texture minification linear filtering.
|
||||||
/// This describes how the final value will be computed from neighbouring pixels.
|
/// This describes how the final value will be computed from neighbouring pixels.
|
||||||
|
|
|
@ -9,6 +9,7 @@ namespace Ryujinx.Graphics.OpenGL
|
||||||
private static readonly Lazy<bool> _supportsImageLoadFormatted = new Lazy<bool>(() => HasExtension("GL_EXT_shader_image_load_formatted"));
|
private static readonly Lazy<bool> _supportsImageLoadFormatted = new Lazy<bool>(() => HasExtension("GL_EXT_shader_image_load_formatted"));
|
||||||
private static readonly Lazy<bool> _supportsPolygonOffsetClamp = new Lazy<bool>(() => HasExtension("GL_EXT_polygon_offset_clamp"));
|
private static readonly Lazy<bool> _supportsPolygonOffsetClamp = new Lazy<bool>(() => HasExtension("GL_EXT_polygon_offset_clamp"));
|
||||||
private static readonly Lazy<bool> _supportsViewportSwizzle = new Lazy<bool>(() => HasExtension("GL_NV_viewport_swizzle"));
|
private static readonly Lazy<bool> _supportsViewportSwizzle = new Lazy<bool>(() => HasExtension("GL_NV_viewport_swizzle"));
|
||||||
|
private static readonly Lazy<bool> _supportsSeamlessCubemapPerTexture = new Lazy<bool>(() => HasExtension("GL_ARB_seamless_cubemap_per_texture"));
|
||||||
|
|
||||||
private static readonly Lazy<int> _maximumComputeSharedMemorySize = new Lazy<int>(() => GetLimit(All.MaxComputeSharedMemorySize));
|
private static readonly Lazy<int> _maximumComputeSharedMemorySize = new Lazy<int>(() => GetLimit(All.MaxComputeSharedMemorySize));
|
||||||
private static readonly Lazy<int> _storageBufferOffsetAlignment = new Lazy<int>(() => GetLimit(All.ShaderStorageBufferOffsetAlignment));
|
private static readonly Lazy<int> _storageBufferOffsetAlignment = new Lazy<int>(() => GetLimit(All.ShaderStorageBufferOffsetAlignment));
|
||||||
|
@ -31,6 +32,7 @@ namespace Ryujinx.Graphics.OpenGL
|
||||||
public static bool SupportsImageLoadFormatted => _supportsImageLoadFormatted.Value;
|
public static bool SupportsImageLoadFormatted => _supportsImageLoadFormatted.Value;
|
||||||
public static bool SupportsPolygonOffsetClamp => _supportsPolygonOffsetClamp.Value;
|
public static bool SupportsPolygonOffsetClamp => _supportsPolygonOffsetClamp.Value;
|
||||||
public static bool SupportsViewportSwizzle => _supportsViewportSwizzle.Value;
|
public static bool SupportsViewportSwizzle => _supportsViewportSwizzle.Value;
|
||||||
|
public static bool SupportsSeamlessCubemapPerTexture => _supportsSeamlessCubemapPerTexture.Value;
|
||||||
public static bool SupportsNonConstantTextureOffset => _gpuVendor.Value == GpuVendor.Nvidia;
|
public static bool SupportsNonConstantTextureOffset => _gpuVendor.Value == GpuVendor.Nvidia;
|
||||||
|
|
||||||
public static int MaximumComputeSharedMemorySize => _maximumComputeSharedMemorySize.Value;
|
public static int MaximumComputeSharedMemorySize => _maximumComputeSharedMemorySize.Value;
|
||||||
|
|
|
@ -14,6 +14,11 @@ namespace Ryujinx.Graphics.OpenGL.Image
|
||||||
GL.SamplerParameter(Handle, SamplerParameterName.TextureMinFilter, (int)info.MinFilter.Convert());
|
GL.SamplerParameter(Handle, SamplerParameterName.TextureMinFilter, (int)info.MinFilter.Convert());
|
||||||
GL.SamplerParameter(Handle, SamplerParameterName.TextureMagFilter, (int)info.MagFilter.Convert());
|
GL.SamplerParameter(Handle, SamplerParameterName.TextureMagFilter, (int)info.MagFilter.Convert());
|
||||||
|
|
||||||
|
if (HwCapabilities.SupportsSeamlessCubemapPerTexture)
|
||||||
|
{
|
||||||
|
GL.SamplerParameter(Handle, (SamplerParameterName)ArbSeamlessCubemapPerTexture.TextureCubeMapSeamless, info.SeamlessCubemap ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
GL.SamplerParameter(Handle, SamplerParameterName.TextureWrapS, (int)info.AddressU.Convert());
|
GL.SamplerParameter(Handle, SamplerParameterName.TextureWrapS, (int)info.AddressU.Convert());
|
||||||
GL.SamplerParameter(Handle, SamplerParameterName.TextureWrapT, (int)info.AddressV.Convert());
|
GL.SamplerParameter(Handle, SamplerParameterName.TextureWrapT, (int)info.AddressV.Convert());
|
||||||
GL.SamplerParameter(Handle, SamplerParameterName.TextureWrapR, (int)info.AddressP.Convert());
|
GL.SamplerParameter(Handle, SamplerParameterName.TextureWrapR, (int)info.AddressP.Convert());
|
||||||
|
|
Loading…
Reference in a new issue