diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2020-10-12 21:40:50 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-12 21:40:50 -0300 |
| commit | b066cfc1a3e31bf7197ddbd0f4d774b886cd9d65 (patch) | |
| tree | 95a1d0bb640948c184857fd1bccb56cad90839fb /Ryujinx.Graphics.Gpu/Memory | |
| parent | 14fd9aa640936d2455c9f0929fc904a5bdb2fada (diff) | |
Add support for shader constant buffer slot indexing (#1608)
* Add support for shader constant buffer slot indexing
* Fix typo
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Memory')
| -rw-r--r-- | Ryujinx.Graphics.Gpu/Memory/BufferManager.cs | 46 |
1 files changed, 46 insertions, 0 deletions
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 } } + /// <summary> + /// Sets a transform feedback buffer on the graphics pipeline. + /// The output from the vertex transformation stages are written into the feedback buffer. + /// </summary> + /// <param name="index">Index of the transform feedback buffer</param> + /// <param name="gpuVa">Start GPU virtual address of the buffer</param> + /// <param name="size">Size in bytes of the transform feedback buffer</param> public void SetTransformFeedbackBuffer(int index, ulong gpuVa, ulong size) { ulong address = TranslateAndCreateBuffer(gpuVa, size); @@ -265,6 +272,25 @@ namespace Ryujinx.Graphics.Gpu.Memory } /// <summary> + /// Gets a bit mask indicating which compute uniform buffers are currently bound. + /// </summary> + /// <returns>Mask where each bit set indicates a bound constant buffer</returns> + 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; + } + + /// <summary> /// Sets the enabled uniform buffers mask on the graphics pipeline. /// Each bit set on the mask indicates that the respective buffer index is enabled. /// </summary> @@ -278,6 +304,26 @@ namespace Ryujinx.Graphics.Gpu.Memory } /// <summary> + /// Gets a bit mask indicating which graphics uniform buffers are currently bound. + /// </summary> + /// <param name="stage">Index of the shader stage</param> + /// <returns>Mask where each bit set indicates a bound constant buffer</returns> + 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; + } + + /// <summary> /// Performs address translation of the GPU virtual address, and creates a /// new buffer, if needed, for the specified range. /// </summary> |
