From 985c6488601fa351849270bc64a7bf1fdff54ec1 Mon Sep 17 00:00:00 2001 From: sunshineinabox Date: Wed, 29 May 2024 22:34:23 -0700 Subject: [PATCH] Bring up pipeline converter inline with dynamic states. --- .../PipelineConverter.cs | 31 ++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs b/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs index e8fbea9992..ea2fb3080b 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs @@ -169,24 +169,41 @@ namespace Ryujinx.Graphics.Vulkan pipeline.HasDepthStencil = state.DepthStencilEnable; pipeline.LogicOpEnable = state.LogicOpEnable; - pipeline.LogicOp = state.LogicOp.Convert(); pipeline.MinDepthBounds = 0f; // Not implemented. pipeline.MaxDepthBounds = 0f; // Not implemented. - pipeline.PatchControlPoints = state.PatchControlPoints; pipeline.PolygonMode = PolygonMode.Fill; // Not implemented. - pipeline.PrimitiveRestartEnable = state.PrimitiveRestartEnable; - pipeline.RasterizerDiscardEnable = state.RasterizerDiscard; - pipeline.SamplesCount = (uint)state.SamplesCount; - pipeline.DepthBiasEnable = state.BiasEnable != 0; + if (!gd.Capabilities.SupportsExtendedDynamicState2) + { + pipeline.PrimitiveRestartEnable = state.PrimitiveRestartEnable; + pipeline.RasterizerDiscardEnable = state.RasterizerDiscard; + pipeline.DepthBiasEnable = state.BiasEnable != 0; + } + + if (!gd.ExtendedDynamicState2Features.ExtendedDynamicState2LogicOp) + { + pipeline.LogicOp = state.LogicOp.Convert(); + } + + if (!gd.ExtendedDynamicState2Features.ExtendedDynamicState2PatchControlPoints) + { + pipeline.PatchControlPoints = state.PatchControlPoints; + } + + pipeline.SamplesCount = (uint)state.SamplesCount; // Stencil masks and ref are dynamic, so are 0 in the Vulkan pipeline. if (!gd.Capabilities.SupportsExtendedDynamicState) { pipeline.DepthTestEnable = state.DepthTest.TestEnable; - pipeline.DepthWriteEnable = state.DepthTest.WriteEnable; + + if (pipeline.DepthTestEnable) + { + pipeline.DepthWriteEnable = state.DepthTest.WriteEnable; + } + pipeline.DepthCompareOp = state.DepthTest.Func.Convert(); pipeline.CullMode = state.CullEnable ? state.CullMode.Convert() : CullModeFlags.None;