diff options
| author | Mary <me@thog.eu> | 2021-07-18 13:05:11 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-18 13:05:11 +0200 |
| commit | b8ad676fb8cbe0a43617df41daaf284ab4421c75 (patch) | |
| tree | 743775369a175af0859f3e27e14e4ed4ce8b6877 /Ryujinx.Audio/Renderer/Dsp/Command/CircularBufferSinkCommand.cs | |
| parent | 97a21332071aceeef6f5035178a3523177570448 (diff) | |
Amadeus: DSP code generation improvements (#2460)
This improve RyuJIT codegen drastically on the DSP side.
This may reduce CPU usage of the DSP thread quite a lot.
Diffstat (limited to 'Ryujinx.Audio/Renderer/Dsp/Command/CircularBufferSinkCommand.cs')
| -rw-r--r-- | Ryujinx.Audio/Renderer/Dsp/Command/CircularBufferSinkCommand.cs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/Ryujinx.Audio/Renderer/Dsp/Command/CircularBufferSinkCommand.cs b/Ryujinx.Audio/Renderer/Dsp/Command/CircularBufferSinkCommand.cs index e4c635d5..f82ea070 100644 --- a/Ryujinx.Audio/Renderer/Dsp/Command/CircularBufferSinkCommand.cs +++ b/Ryujinx.Audio/Renderer/Dsp/Command/CircularBufferSinkCommand.cs @@ -69,20 +69,23 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command { for (int i = 0; i < InputCount; i++) { - ReadOnlySpan<float> inputBuffer = context.GetBuffer(Input[i]); + unsafe + { + float* inputBuffer = (float*)context.GetBufferPointer(Input[i]); - ulong targetOffset = CircularBuffer + currentOffset; + ulong targetOffset = CircularBuffer + currentOffset; - for (int y = 0; y < context.SampleCount; y++) - { - context.MemoryManager.Write(targetOffset + (ulong)y * targetChannelCount, PcmHelper.Saturate(inputBuffer[y])); - } + for (int y = 0; y < context.SampleCount; y++) + { + context.MemoryManager.Write(targetOffset + (ulong)y * targetChannelCount, PcmHelper.Saturate(inputBuffer[y])); + } - currentOffset += context.SampleCount * targetChannelCount; + currentOffset += context.SampleCount * targetChannelCount; - if (currentOffset >= CircularBufferSize) - { - currentOffset = 0; + if (currentOffset >= CircularBufferSize) + { + currentOffset = 0; + } } } } |
