forked from Mirror/Ryujinx
Use polygon offset clamp if supported (#1429)
This commit is contained in:
parent
8dbcae1ff8
commit
51fbc1fde4
3 changed files with 12 additions and 5 deletions
|
@ -568,7 +568,7 @@ namespace Ryujinx.Graphics.Gpu.Engine
|
||||||
enables |= (depthBias.LineEnable ? PolygonModeMask.Line : 0);
|
enables |= (depthBias.LineEnable ? PolygonModeMask.Line : 0);
|
||||||
enables |= (depthBias.FillEnable ? PolygonModeMask.Fill : 0);
|
enables |= (depthBias.FillEnable ? PolygonModeMask.Fill : 0);
|
||||||
|
|
||||||
_context.Renderer.Pipeline.SetDepthBias(enables, factor, units, clamp);
|
_context.Renderer.Pipeline.SetDepthBias(enables, factor, units / 2f, clamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -697,7 +697,7 @@ namespace Ryujinx.Graphics.Gpu.Engine
|
||||||
float size = state.Get<float>(MethodOffset.PointSize);
|
float size = state.Get<float>(MethodOffset.PointSize);
|
||||||
bool isProgramPointSize = state.Get<Boolean32>(MethodOffset.VertexProgramPointSize);
|
bool isProgramPointSize = state.Get<Boolean32>(MethodOffset.VertexProgramPointSize);
|
||||||
bool enablePointSprite = state.Get<Boolean32>(MethodOffset.PointSpriteEnable);
|
bool enablePointSprite = state.Get<Boolean32>(MethodOffset.PointSpriteEnable);
|
||||||
|
|
||||||
// TODO: Need to figure out a way to map PointCoordReplace enable bit.
|
// TODO: Need to figure out a way to map PointCoordReplace enable bit.
|
||||||
Origin origin = (state.Get<int>(MethodOffset.PointCoordReplace) & 4) == 0 ? Origin.LowerLeft : Origin.UpperLeft;
|
Origin origin = (state.Get<int>(MethodOffset.PointCoordReplace) & 4) == 0 ? Origin.LowerLeft : Origin.UpperLeft;
|
||||||
|
|
||||||
|
|
|
@ -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> _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> _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<bool> _supportsViewportSwizzle = new Lazy<bool>(() => HasExtension("GL_NV_viewport_swizzle"));
|
||||||
|
|
||||||
private static readonly Lazy<int> _maximumComputeSharedMemorySize = new Lazy<int>(() => GetLimit(All.MaxComputeSharedMemorySize));
|
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 SupportsAstcCompression => _supportsAstcCompression.Value;
|
||||||
public static bool SupportsImageLoadFormatted => _supportsImageLoadFormatted.Value;
|
public static bool SupportsImageLoadFormatted => _supportsImageLoadFormatted.Value;
|
||||||
|
public static bool SupportsPolygonOffsetClamp => _supportsPolygonOffsetClamp.Value;
|
||||||
public static bool SupportsViewportSwizzle => _supportsViewportSwizzle.Value;
|
public static bool SupportsViewportSwizzle => _supportsViewportSwizzle.Value;
|
||||||
public static bool SupportsNonConstantTextureOffset => _gpuVendor.Value == GpuVendor.Nvidia;
|
public static bool SupportsNonConstantTextureOffset => _gpuVendor.Value == GpuVendor.Nvidia;
|
||||||
|
|
||||||
|
|
|
@ -610,9 +610,14 @@ namespace Ryujinx.Graphics.OpenGL
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GL.PolygonOffset(factor, units / 2f);
|
if (HwCapabilities.SupportsPolygonOffsetClamp)
|
||||||
// TODO: Enable when GL_EXT_polygon_offset_clamp is supported.
|
{
|
||||||
// GL.PolygonOffsetClamp(factor, units, clamp);
|
GL.PolygonOffsetClamp(factor, units, clamp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GL.PolygonOffset(factor, units);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetDepthClamp(bool clamp)
|
public void SetDepthClamp(bool clamp)
|
||||||
|
|
Loading…
Reference in a new issue