aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.OpenGL/Pipeline.cs
diff options
context:
space:
mode:
authorriperiperi <rhy3756547@hotmail.com>2022-11-24 07:50:59 +0000
committerGitHub <noreply@github.com>2022-11-24 07:50:59 +0000
commitece36b274da3957d727387d2f7c96adbd0f29bc3 (patch)
treee4f024265342c69eba254083a4308c32a5aad83d /Ryujinx.Graphics.OpenGL/Pipeline.cs
parentf3cc2e5703e5df5c359ce1789a4fb0d73fb9a637 (diff)
GAL: Send all buffer assignments at once rather than individually (#3881)1.1.377
* 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<BufferRange> buffers)
Diffstat (limited to 'Ryujinx.Graphics.OpenGL/Pipeline.cs')
-rw-r--r--Ryujinx.Graphics.OpenGL/Pipeline.cs17
1 files changed, 9 insertions, 8 deletions
diff --git a/Ryujinx.Graphics.OpenGL/Pipeline.cs b/Ryujinx.Graphics.OpenGL/Pipeline.cs
index 3b234eb0..8bcaf4c7 100644
--- a/Ryujinx.Graphics.OpenGL/Pipeline.cs
+++ b/Ryujinx.Graphics.OpenGL/Pipeline.cs
@@ -1296,9 +1296,9 @@ namespace Ryujinx.Graphics.OpenGL
_stencilFrontMask = stencilTest.FrontMask;
}
- public void SetStorageBuffers(int first, ReadOnlySpan<BufferRange> buffers)
+ public void SetStorageBuffers(ReadOnlySpan<BufferAssignment> buffers)
{
- SetBuffers(first, buffers, isStorage: true);
+ SetBuffers(buffers, isStorage: true);
}
public void SetTextureAndSampler(ShaderStage stage, int binding, ITexture texture, ISampler sampler)
@@ -1366,9 +1366,9 @@ namespace Ryujinx.Graphics.OpenGL
}
}
- public void SetUniformBuffers(int first, ReadOnlySpan<BufferRange> buffers)
+ public void SetUniformBuffers(ReadOnlySpan<BufferAssignment> buffers)
{
- SetBuffers(first, buffers, isStorage: false);
+ SetBuffers(buffers, isStorage: false);
}
public void SetUserClipDistance(int index, bool enableClip)
@@ -1460,21 +1460,22 @@ namespace Ryujinx.Graphics.OpenGL
GL.MemoryBarrier(MemoryBarrierFlags.TextureFetchBarrierBit);
}
- private void SetBuffers(int first, ReadOnlySpan<BufferRange> buffers, bool isStorage)
+ private void SetBuffers(ReadOnlySpan<BufferAssignment> buffers, bool isStorage)
{
BufferRangeTarget target = isStorage ? BufferRangeTarget.ShaderStorageBuffer : BufferRangeTarget.UniformBuffer;
for (int index = 0; index < buffers.Length; index++)
{
- BufferRange buffer = buffers[index];
+ BufferAssignment assignment = buffers[index];
+ BufferRange buffer = assignment.Range;
if (buffer.Handle == BufferHandle.Null)
{
- GL.BindBufferRange(target, first + index, 0, IntPtr.Zero, 0);
+ GL.BindBufferRange(target, assignment.Binding, 0, IntPtr.Zero, 0);
continue;
}
- GL.BindBufferRange(target, first + index, buffer.Handle.ToInt32(), (IntPtr)buffer.Offset, buffer.Size);
+ GL.BindBufferRange(target, assignment.Binding, buffer.Handle.ToInt32(), (IntPtr)buffer.Offset, buffer.Size);
}
}