From ece36b274da3957d727387d2f7c96adbd0f29bc3 Mon Sep 17 00:00:00 2001 From: riperiperi Date: Thu, 24 Nov 2022 07:50:59 +0000 Subject: GAL: Send all buffer assignments at once rather than individually (#3881) * GAL: Send all buffer assignments at once rather than individually The `(int first, BufferRange[] ranges)` method call has very significant performance implications when the bindings are spread out, which they generally always are in Vulkan. This change makes it so that these methods are only called a maximum of one time per draw. Significantly improves GPU thread performance in Pokemon Scarlet/Violet. * Address Feedback Removed SetUniformBuffers(int first, ReadOnlySpan buffers) --- .../Multithreading/Commands/SetStorageBuffersCommand.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'Ryujinx.Graphics.GAL/Multithreading/Commands/SetStorageBuffersCommand.cs') diff --git a/Ryujinx.Graphics.GAL/Multithreading/Commands/SetStorageBuffersCommand.cs b/Ryujinx.Graphics.GAL/Multithreading/Commands/SetStorageBuffersCommand.cs index c2963373..610603ca 100644 --- a/Ryujinx.Graphics.GAL/Multithreading/Commands/SetStorageBuffersCommand.cs +++ b/Ryujinx.Graphics.GAL/Multithreading/Commands/SetStorageBuffersCommand.cs @@ -6,19 +6,17 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands struct SetStorageBuffersCommand : IGALCommand { public CommandType CommandType => CommandType.SetStorageBuffers; - private int _first; - private SpanRef _buffers; + private SpanRef _buffers; - public void Set(int first, SpanRef buffers) + public void Set(SpanRef buffers) { - _first = first; _buffers = buffers; } public static void Run(ref SetStorageBuffersCommand command, ThreadedRenderer threaded, IRenderer renderer) { - Span buffers = command._buffers.Get(threaded); - renderer.Pipeline.SetStorageBuffers(command._first, threaded.Buffers.MapBufferRanges(buffers)); + Span buffers = command._buffers.Get(threaded); + renderer.Pipeline.SetStorageBuffers(threaded.Buffers.MapBufferRanges(buffers)); command._buffers.Dispose(threaded); } } -- cgit v1.2.3