From 91c3ac27010dad8c6ac5cba9fad591003c5c9684 Mon Sep 17 00:00:00 2001 From: sunshineinabox Date: Mon, 2 Sep 2024 14:37:29 -0700 Subject: [PATCH] Revert a change --- src/Ryujinx.Graphics.Vulkan/PipelineBase.cs | 9 +-------- src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs | 9 +++++---- src/Ryujinx.Graphics.Vulkan/PipelineState.cs | 7 ++++--- src/Ryujinx.Graphics.Vulkan/ShaderCollection.cs | 6 +----- 4 files changed, 11 insertions(+), 20 deletions(-) diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs index cb00aaf188..406372dc83 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs @@ -1080,8 +1080,6 @@ namespace Ryujinx.Graphics.Vulkan _newState.HasTessellationControlShader = internalProgram.HasTessellationControlShader; _newState.StagesCount = (uint)stages.Length; - _newState.Topology = internalProgram.ShaderTopology; - stages.CopyTo(_newState.Stages.AsSpan()[..stages.Length]); SignalStateChange(); @@ -1702,7 +1700,7 @@ namespace Ryujinx.Graphics.Vulkan { DynamicState.SetFeedbackLoop(aspects); } - else + else if (Gd.Capabilities.SupportsAttachmentFeedbackLoop) { _newState.FeedbackLoopAspects = aspects; } @@ -1718,11 +1716,6 @@ namespace Ryujinx.Graphics.Vulkan [MethodImpl(MethodImplOptions.AggressiveInlining)] private bool UpdateFeedbackLoop() { - if (!Gd.Capabilities.SupportsAttachmentFeedbackLoop) - { - return false; - } - List hazards = _descriptorSetUpdater.FeedbackLoopHazards; if ((hazards?.Count ?? 0) > 0) diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs b/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs index f1423fd093..27f1c047b5 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs @@ -153,13 +153,15 @@ namespace Ryujinx.Graphics.Vulkan 0); } - public static PipelineState ToVulkanPipelineState(this ProgramPipelineState state, VulkanRenderer gd, bool hasTCS) + public static PipelineState ToVulkanPipelineState(this ProgramPipelineState state, VulkanRenderer gd) { var extendedDynamicState2 = gd.Capabilities.SupportsExtendedDynamicState2; var extendedDynamicState = gd.Capabilities.SupportsExtendedDynamicState; + var topology = extendedDynamicState ? gd.TopologyRemap(state.Topology).Convert().ConvertToClass() : gd.TopologyRemap(state.Topology).Convert(); + PipelineState pipeline = new(); - pipeline.Initialize(gd.Capabilities); + pipeline.Initialize(gd.Capabilities, topology); // It is assumed that Dynamic State is enabled when this conversion is used. pipeline.DepthBoundsTestEnable = false; // Not implemented. @@ -225,8 +227,7 @@ namespace Ryujinx.Graphics.Vulkan pipeline.StencilBackDepthFailOp = extendedDynamicState ? 0 : state.StencilTest.BackDpFail.Convert(); pipeline.StencilBackCompareOp = extendedDynamicState ? 0 : state.StencilTest.BackFunc.Convert(); - var topology = hasTCS ? PrimitiveTopology.Patches : state.Topology; - pipeline.Topology = extendedDynamicState ? gd.TopologyRemap(topology).Convert().ConvertToClass() : gd.TopologyRemap(topology).Convert(); + pipeline.Topology = topology; int vaCount = Math.Min(Constants.MaxVertexAttributes, state.VertexAttribCount); int vbCount = Math.Min(Constants.MaxVertexBuffers, state.VertexBufferCount); diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineState.cs b/src/Ryujinx.Graphics.Vulkan/PipelineState.cs index 0fb70f92a8..8739aaec56 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineState.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineState.cs @@ -258,7 +258,7 @@ namespace Ryujinx.Graphics.Vulkan private bool _supportsFeedBackLoopDynamicState; - public void Initialize(HardwareCapabilities capabilities) + public void Initialize(HardwareCapabilities capabilities, PrimitiveTopology topology = default) { HasTessellationControlShader = false; Stages = new NativeArray(Constants.MaxShaderStages); @@ -277,13 +277,14 @@ namespace Ryujinx.Graphics.Vulkan _supportsExtDynamicState2 = capabilities.SupportsExtendedDynamicState2; _supportsFeedBackLoopDynamicState = capabilities.SupportsDynamicAttachmentFeedbackLoop; - if (_supportsFeedBackLoopDynamicState || !capabilities.SupportsAttachmentFeedbackLoop) + if (!capabilities.SupportsAttachmentFeedbackLoop) { FeedbackLoopAspects = FeedbackLoopAspects.None; } if (_supportsExtDynamicState) { + Topology = topology; StencilFrontFailOp = 0; StencilFrontPassOp = 0; StencilFrontDepthFailOp = 0; @@ -649,7 +650,7 @@ namespace Ryujinx.Graphics.Vulkan PipelineCreateFlags flags = 0; - if (gd.Capabilities.SupportsAttachmentFeedbackLoop) + if (gd.Capabilities.SupportsAttachmentFeedbackLoop && !_supportsFeedBackLoopDynamicState) { FeedbackLoopAspects aspects = FeedbackLoopAspects; diff --git a/src/Ryujinx.Graphics.Vulkan/ShaderCollection.cs b/src/Ryujinx.Graphics.Vulkan/ShaderCollection.cs index e670d840b2..ae4a2faac8 100644 --- a/src/Ryujinx.Graphics.Vulkan/ShaderCollection.cs +++ b/src/Ryujinx.Graphics.Vulkan/ShaderCollection.cs @@ -24,8 +24,6 @@ namespace Ryujinx.Graphics.Vulkan public bool IsCompute { get; } public bool HasTessellationControlShader => (Stages & (1u << 3)) != 0; - public PrimitiveTopology ShaderTopology; - public bool UpdateTexturesWithoutTemplate { get; } public uint Stages { get; } @@ -552,9 +550,7 @@ namespace Ryujinx.Graphics.Vulkan // The active attachment formats have been provided by the abstraction layer. var renderPass = CreateDummyRenderPass(); - PipelineState pipeline = _state.ToVulkanPipelineState(_gd, HasTessellationControlShader); - - ShaderTopology = pipeline.Topology; + PipelineState pipeline = _state.ToVulkanPipelineState(_gd); // Copy the shader stage info to the pipeline. var stages = pipeline.Stages.AsSpan();