From 5e86d5e17884ac0f030850a74c4dcb6ce43f142a Mon Sep 17 00:00:00 2001 From: sunshineinabox Date: Sun, 1 Sep 2024 21:33:05 -0700 Subject: [PATCH] There will still be an issue with extension is supported and dynmaic state is not --- src/Ryujinx.Graphics.Vulkan/PipelineBase.cs | 2 +- .../PipelineConverter.cs | 2 +- src/Ryujinx.Graphics.Vulkan/PipelineState.cs | 18 ++++++++++-------- .../ShaderCollection.cs | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs index a302f730f5..4fa591ced0 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs @@ -134,7 +134,7 @@ namespace Ryujinx.Graphics.Vulkan _supportExtDynamic2 = gd.Capabilities.SupportsExtendedDynamicState2.ExtendedDynamicState2; - _newState.Initialize(_supportExtDynamic, gd.Capabilities.SupportsExtendedDynamicState2); + _newState.Initialize(gd.Capabilities); } public void Initialize() diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs b/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs index 36bd1ff455..c45b0fd13a 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs @@ -159,7 +159,7 @@ namespace Ryujinx.Graphics.Vulkan var extendedDynamicState = gd.Capabilities.SupportsExtendedDynamicState; PipelineState pipeline = new(); - pipeline.Initialize(extendedDynamicState, extendedDynamicState2); + pipeline.Initialize(gd.Capabilities); // It is assumed that Dynamic State is enabled when this conversion is used. pipeline.DepthBoundsTestEnable = false; // Not implemented. diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineState.cs b/src/Ryujinx.Graphics.Vulkan/PipelineState.cs index f447d0f20e..0fb70f92a8 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineState.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineState.cs @@ -255,10 +255,10 @@ namespace Ryujinx.Graphics.Vulkan private bool _supportsExtDynamicState; private PhysicalDeviceExtendedDynamicState2FeaturesEXT _supportsExtDynamicState2; + private bool _supportsFeedBackLoopDynamicState; - public void Initialize(bool supportsExtDynamicState, - PhysicalDeviceExtendedDynamicState2FeaturesEXT extendedDynamicState2) + public void Initialize(HardwareCapabilities capabilities) { HasTessellationControlShader = false; Stages = new NativeArray(Constants.MaxShaderStages); @@ -273,10 +273,14 @@ namespace Ryujinx.Graphics.Vulkan PolygonMode = PolygonMode.Fill; DepthBoundsTestEnable = false; - FeedbackLoopAspects = FeedbackLoopAspects.None; + _supportsExtDynamicState = capabilities.SupportsExtendedDynamicState; + _supportsExtDynamicState2 = capabilities.SupportsExtendedDynamicState2; + _supportsFeedBackLoopDynamicState = capabilities.SupportsDynamicAttachmentFeedbackLoop; - _supportsExtDynamicState = supportsExtDynamicState; - _supportsExtDynamicState2 = extendedDynamicState2; + if (_supportsFeedBackLoopDynamicState || !capabilities.SupportsAttachmentFeedbackLoop) + { + FeedbackLoopAspects = FeedbackLoopAspects.None; + } if (_supportsExtDynamicState) { @@ -577,8 +581,6 @@ namespace Ryujinx.Graphics.Vulkan colorBlendState.PNext = &colorBlendAdvancedState; } - bool supportsFeedbackLoopDynamicState = gd.Capabilities.SupportsDynamicAttachmentFeedbackLoop; - DynamicState* dynamicStates = stackalloc DynamicState[MaxDynamicStatesCount]; uint dynamicStatesCount = 7; @@ -633,7 +635,7 @@ namespace Ryujinx.Graphics.Vulkan } } - if (supportsFeedbackLoopDynamicState) + if (_supportsFeedBackLoopDynamicState) { dynamicStates[dynamicStatesCount++] = DynamicState.AttachmentFeedbackLoopEnableExt; } diff --git a/src/Ryujinx.Graphics.Vulkan/ShaderCollection.cs b/src/Ryujinx.Graphics.Vulkan/ShaderCollection.cs index 232a093b89..e670d840b2 100644 --- a/src/Ryujinx.Graphics.Vulkan/ShaderCollection.cs +++ b/src/Ryujinx.Graphics.Vulkan/ShaderCollection.cs @@ -531,7 +531,7 @@ namespace Ryujinx.Graphics.Vulkan public void CreateBackgroundComputePipeline() { PipelineState pipeline = new(); - pipeline.Initialize(_gd.Capabilities.SupportsExtendedDynamicState, _gd.Capabilities.SupportsExtendedDynamicState2); + pipeline.Initialize(_gd.Capabilities); pipeline.Stages[0] = _shaders[0].GetInfo(); pipeline.StagesCount = 1;