diff options
author | riperiperi <rhy3756547@hotmail.com> | 2023-06-01 08:05:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-01 09:05:39 +0200 |
commit | 4741a05df95dd8964543f9770d8bfe15d842beaf (patch) | |
tree | 74263d1eddd3fdf2fbbc691316618be9d42dbc3d /src | |
parent | c6676007bfdc65724afebac27990c47a5d6aa3dd (diff) |
Vulkan: Include DepthMode in ProgramPipelineState (#5185)1.1.849
Diffstat (limited to 'src')
4 files changed, 23 insertions, 1 deletions
diff --git a/src/Ryujinx.Graphics.GAL/ProgramPipelineState.cs b/src/Ryujinx.Graphics.GAL/ProgramPipelineState.cs index 41afb34b..96fd667a 100644 --- a/src/Ryujinx.Graphics.GAL/ProgramPipelineState.cs +++ b/src/Ryujinx.Graphics.GAL/ProgramPipelineState.cs @@ -63,6 +63,8 @@ namespace Ryujinx.Graphics.GAL public bool PrimitiveRestartEnable; public uint PatchControlPoints; + public DepthMode DepthMode; + public void SetVertexAttribs(ReadOnlySpan<VertexAttribDescriptor> vertexAttribs) { VertexAttribCount = vertexAttribs.Length; diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs index 4feb8baf..5fa4702b 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs @@ -771,7 +771,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// </summary> private void UpdateDepthMode() { - _context.Renderer.Pipeline.SetDepthMode(GetDepthMode()); + DepthMode mode = GetDepthMode(); + + _pipeline.DepthMode = mode; + + _context.Renderer.Pipeline.SetDepthMode(mode); } /// <summary> diff --git a/src/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs b/src/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs index b2c4fccd..9b0c8b9b 100644 --- a/src/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs +++ b/src/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs @@ -737,6 +737,19 @@ namespace Ryujinx.Graphics.Gpu.Shader } /// <summary> + /// Populates pipeline state that doesn't exist in older caches with default values + /// based on specialization state. + /// </summary> + /// <param name="pipelineState">Pipeline state to prepare</param> + private void PreparePipelineState(ref ProgramPipelineState pipelineState) + { + if (!_compute) + { + pipelineState.DepthMode = GraphicsState.DepthMode ? DepthMode.MinusOneToOne : DepthMode.ZeroToOne; + } + } + + /// <summary> /// Reads shader specialization state that has been serialized. /// </summary> /// <param name="dataReader">Data reader</param> @@ -776,6 +789,8 @@ namespace Ryujinx.Graphics.Gpu.Shader { ProgramPipelineState pipelineState = default; dataReader.ReadWithMagicAndSize(ref pipelineState, PgpsMagic); + + specState.PreparePipelineState(ref pipelineState); specState.PipelineState = pipelineState; } diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs b/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs index 79179ce0..a52b4462 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs @@ -165,6 +165,7 @@ namespace Ryujinx.Graphics.Vulkan pipeline.DepthTestEnable = state.DepthTest.TestEnable; pipeline.DepthWriteEnable = state.DepthTest.WriteEnable; pipeline.DepthCompareOp = state.DepthTest.Func.Convert(); + pipeline.DepthMode = state.DepthMode == DepthMode.MinusOneToOne; pipeline.FrontFace = state.FrontFace.Convert(); |