From 5626f2ca1c49342b20772224f956147df6957b5a Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sun, 21 May 2023 14:04:21 -0300 Subject: Replace ShaderBindings with new ResourceLayout structure for Vulkan (#5025) * Introduce ResourceLayout * Part 1: Use new ResourceSegments array on UpdateAndBind * Part 2: Use ResourceLayout to build PipelineLayout * Delete old code * XML docs * Fix shader cache load NRE * Fix typo --- .../PipelineLayoutCacheEntry.cs | 26 ++++++++++------------ 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'src/Ryujinx.Graphics.Vulkan/PipelineLayoutCacheEntry.cs') diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineLayoutCacheEntry.cs b/src/Ryujinx.Graphics.Vulkan/PipelineLayoutCacheEntry.cs index 2c966115..eeb25dc0 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineLayoutCacheEntry.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineLayoutCacheEntry.cs @@ -1,6 +1,7 @@ using Ryujinx.Graphics.GAL; using Silk.NET.Vulkan; using System.Collections.Generic; +using System.Collections.ObjectModel; namespace Ryujinx.Graphics.Vulkan { @@ -16,7 +17,7 @@ namespace Ryujinx.Graphics.Vulkan private readonly int[] _dsCacheCursor; private int _dsLastCbIndex; - private PipelineLayoutCacheEntry(VulkanRenderer gd, Device device) + private PipelineLayoutCacheEntry(VulkanRenderer gd, Device device, int setsCount) { _gd = gd; _device = device; @@ -25,27 +26,24 @@ namespace Ryujinx.Graphics.Vulkan for (int i = 0; i < CommandBufferPool.MaxCommandBuffers; i++) { - _dsCache[i] = new List>[PipelineBase.DescriptorSetLayouts]; + _dsCache[i] = new List>[setsCount]; - for (int j = 0; j < PipelineBase.DescriptorSetLayouts; j++) + for (int j = 0; j < _dsCache[i].Length; j++) { _dsCache[i][j] = new List>(); } } - _dsCacheCursor = new int[PipelineBase.DescriptorSetLayouts]; + _dsCacheCursor = new int[setsCount]; } - public PipelineLayoutCacheEntry(VulkanRenderer gd, Device device, uint stages, bool usePd) : this(gd, device) - { - DescriptorSetLayouts = PipelineLayoutFactory.Create(gd, device, stages, usePd, out var pipelineLayout); - PipelineLayout = pipelineLayout; - } - - public PipelineLayoutCacheEntry(VulkanRenderer gd, Device device, ShaderSource[] shaders) : this(gd, device) + public PipelineLayoutCacheEntry( + VulkanRenderer gd, + Device device, + ReadOnlyCollection setDescriptors, + bool usePushDescriptors) : this(gd, device, setDescriptors.Count) { - DescriptorSetLayouts = PipelineLayoutFactory.CreateMinimal(gd, device, shaders, out var pipelineLayout); - PipelineLayout = pipelineLayout; + (DescriptorSetLayouts, PipelineLayout) = PipelineLayoutFactory.Create(gd, device, setDescriptors, usePushDescriptors); } public Auto GetNewDescriptorSetCollection( @@ -58,7 +56,7 @@ namespace Ryujinx.Graphics.Vulkan { _dsLastCbIndex = commandBufferIndex; - for (int i = 0; i < PipelineBase.DescriptorSetLayouts; i++) + for (int i = 0; i < _dsCacheCursor.Length; i++) { _dsCacheCursor[i] = 0; } -- cgit v1.2.3