From b066cfc1a3e31bf7197ddbd0f4d774b886cd9d65 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Mon, 12 Oct 2020 21:40:50 -0300 Subject: Add support for shader constant buffer slot indexing (#1608) * Add support for shader constant buffer slot indexing * Fix typo --- Ryujinx.Graphics.Gpu/Memory/BufferManager.cs | 46 ++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'Ryujinx.Graphics.Gpu/Memory') diff --git a/Ryujinx.Graphics.Gpu/Memory/BufferManager.cs b/Ryujinx.Graphics.Gpu/Memory/BufferManager.cs index 68f4929d..41067a11 100644 --- a/Ryujinx.Graphics.Gpu/Memory/BufferManager.cs +++ b/Ryujinx.Graphics.Gpu/Memory/BufferManager.cs @@ -147,6 +147,13 @@ namespace Ryujinx.Graphics.Gpu.Memory } } + /// + /// Sets a transform feedback buffer on the graphics pipeline. + /// The output from the vertex transformation stages are written into the feedback buffer. + /// + /// Index of the transform feedback buffer + /// Start GPU virtual address of the buffer + /// Size in bytes of the transform feedback buffer public void SetTransformFeedbackBuffer(int index, ulong gpuVa, ulong size) { ulong address = TranslateAndCreateBuffer(gpuVa, size); @@ -264,6 +271,25 @@ namespace Ryujinx.Graphics.Gpu.Memory _cpUniformBuffers.EnableMask = mask; } + /// + /// Gets a bit mask indicating which compute uniform buffers are currently bound. + /// + /// Mask where each bit set indicates a bound constant buffer + public uint GetComputeUniformBufferUseMask() + { + uint mask = 0; + + for (int i = 0; i < _cpUniformBuffers.Buffers.Length; i++) + { + if (_cpUniformBuffers.Buffers[i].Address != 0) + { + mask |= 1u << i; + } + } + + return mask; + } + /// /// Sets the enabled uniform buffers mask on the graphics pipeline. /// Each bit set on the mask indicates that the respective buffer index is enabled. @@ -277,6 +303,26 @@ namespace Ryujinx.Graphics.Gpu.Memory _gpUniformBuffersDirty = true; } + /// + /// Gets a bit mask indicating which graphics uniform buffers are currently bound. + /// + /// Index of the shader stage + /// Mask where each bit set indicates a bound constant buffer + public uint GetGraphicsUniformBufferUseMask(int stage) + { + uint mask = 0; + + for (int i = 0; i < _gpUniformBuffers[stage].Buffers.Length; i++) + { + if (_gpUniformBuffers[stage].Buffers[i].Address != 0) + { + mask |= 1u << i; + } + } + + return mask; + } + /// /// Performs address translation of the GPU virtual address, and creates a /// new buffer, if needed, for the specified range. -- cgit v1.2.3