diff --git a/src/Ryujinx.Graphics.GAL/ProgramPipelineState.cs b/src/Ryujinx.Graphics.GAL/ProgramPipelineState.cs index c16722af7..6e80e3581 100644 --- a/src/Ryujinx.Graphics.GAL/ProgramPipelineState.cs +++ b/src/Ryujinx.Graphics.GAL/ProgramPipelineState.cs @@ -63,6 +63,9 @@ namespace Ryujinx.Graphics.GAL public bool PrimitiveRestartEnable; public uint PatchControlPoints; + public float DepthBiasUnits; + public float DepthBiasFactor; + public DepthMode DepthMode; public void SetVertexAttribs(ReadOnlySpan vertexAttribs) diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs index 1dc77b52d..1e8fe5c69 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs @@ -854,6 +854,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed enables |= (depthBias.FillEnable ? PolygonModeMask.Fill : 0); _pipeline.BiasEnable = enables; + _pipeline.DepthBiasUnits = units / 2f; + _pipeline.DepthBiasFactor = factor; + _context.Renderer.Pipeline.SetDepthBias(enables, factor, units / 2f, clamp); } diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs index 05430966e..755380188 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs @@ -893,11 +893,11 @@ namespace Ryujinx.Graphics.Vulkan { if (_supportExtDynamic) { - DynamicState.SetCullMode(enable ? face.Convert() : CullModeFlags.None); + DynamicState.SetCullMode(enable ? face.Convert() : default); } else { - _newState.CullMode = enable ? face.Convert() : CullModeFlags.None; + _newState.CullMode = enable ? face.Convert() : default; } SignalStateChange(); diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs b/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs index 34a9ca8f7..aa5dff3b1 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs @@ -173,7 +173,8 @@ namespace Ryujinx.Graphics.Vulkan pipeline.PrimitiveRestartEnable = extendedDynamicState2.ExtendedDynamicState2 ? false : state.PrimitiveRestartEnable; pipeline.RasterizerDiscardEnable = extendedDynamicState2.ExtendedDynamicState2 ? false : state.RasterizerDiscard; - pipeline.DepthBiasEnable = extendedDynamicState2.ExtendedDynamicState2 ? false : state.BiasEnable != 0; + pipeline.DepthBiasEnable = extendedDynamicState2.ExtendedDynamicState2 ? false : ((state.BiasEnable != 0) && + (state.DepthBiasFactor != 0 && state.DepthBiasUnits != 0)); pipeline.PatchControlPoints = extendedDynamicState2.ExtendedDynamicState2PatchControlPoints ? 0 : state.PatchControlPoints; @@ -185,7 +186,7 @@ namespace Ryujinx.Graphics.Vulkan if (!extendedDynamicState) { pipeline.DepthCompareOp = state.DepthTest.TestEnable ? state.DepthTest.Func.Convert() : default; - pipeline.CullMode = state.CullEnable ? state.CullMode.Convert() : CullModeFlags.None; + pipeline.CullMode = state.CullEnable ? state.CullMode.Convert() : default; } else {