aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.OpenGL
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2020-07-26 18:11:28 -0300
committerGitHub <noreply@github.com>2020-07-26 18:11:28 -0300
commit51fbc1fde4363760bb47a2a5c960476ffceeac17 (patch)
treedbda81cd56f3747cff4328da227a898910832392 /Ryujinx.Graphics.OpenGL
parent8dbcae1ff88927dc0734d5f0e24fbf8781d68590 (diff)
Use polygon offset clamp if supported (#1429)
Diffstat (limited to 'Ryujinx.Graphics.OpenGL')
-rw-r--r--Ryujinx.Graphics.OpenGL/HwCapabilities.cs2
-rw-r--r--Ryujinx.Graphics.OpenGL/Pipeline.cs11
2 files changed, 10 insertions, 3 deletions
diff --git a/Ryujinx.Graphics.OpenGL/HwCapabilities.cs b/Ryujinx.Graphics.OpenGL/HwCapabilities.cs
index 14515b61..9278c59e 100644
--- a/Ryujinx.Graphics.OpenGL/HwCapabilities.cs
+++ b/Ryujinx.Graphics.OpenGL/HwCapabilities.cs
@@ -7,6 +7,7 @@ namespace Ryujinx.Graphics.OpenGL
{
private static readonly Lazy<bool> _supportsAstcCompression = new Lazy<bool>(() => HasExtension("GL_KHR_texture_compression_astc_ldr"));
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> _supportsViewportSwizzle = new Lazy<bool>(() => HasExtension("GL_NV_viewport_swizzle"));
private static readonly Lazy<int> _maximumComputeSharedMemorySize = new Lazy<int>(() => GetLimit(All.MaxComputeSharedMemorySize));
@@ -28,6 +29,7 @@ namespace Ryujinx.Graphics.OpenGL
public static bool SupportsAstcCompression => _supportsAstcCompression.Value;
public static bool SupportsImageLoadFormatted => _supportsImageLoadFormatted.Value;
+ public static bool SupportsPolygonOffsetClamp => _supportsPolygonOffsetClamp.Value;
public static bool SupportsViewportSwizzle => _supportsViewportSwizzle.Value;
public static bool SupportsNonConstantTextureOffset => _gpuVendor.Value == GpuVendor.Nvidia;
diff --git a/Ryujinx.Graphics.OpenGL/Pipeline.cs b/Ryujinx.Graphics.OpenGL/Pipeline.cs
index 09ba9be0..4f3c2a29 100644
--- a/Ryujinx.Graphics.OpenGL/Pipeline.cs
+++ b/Ryujinx.Graphics.OpenGL/Pipeline.cs
@@ -610,9 +610,14 @@ namespace Ryujinx.Graphics.OpenGL
return;
}
- GL.PolygonOffset(factor, units / 2f);
- // TODO: Enable when GL_EXT_polygon_offset_clamp is supported.
- // GL.PolygonOffsetClamp(factor, units, clamp);
+ if (HwCapabilities.SupportsPolygonOffsetClamp)
+ {
+ GL.PolygonOffsetClamp(factor, units, clamp);
+ }
+ else
+ {
+ GL.PolygonOffset(factor, units);
+ }
}
public void SetDepthClamp(bool clamp)