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/AuxiliaryBufferCommand.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/AuxiliaryBufferCommand.cs')
| -rw-r--r-- | Ryujinx.Audio/Renderer/Dsp/Command/AuxiliaryBufferCommand.cs | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/Ryujinx.Audio/Renderer/Dsp/Command/AuxiliaryBufferCommand.cs b/Ryujinx.Audio/Renderer/Dsp/Command/AuxiliaryBufferCommand.cs index 5ff3a6b4..78d7ea87 100644 --- a/Ryujinx.Audio/Renderer/Dsp/Command/AuxiliaryBufferCommand.cs +++ b/Ryujinx.Audio/Renderer/Dsp/Command/AuxiliaryBufferCommand.cs @@ -65,6 +65,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command IsEffectEnabled = isEnabled; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] private uint Read(IVirtualMemoryManager memoryManager, ulong bufferAddress, uint countMax, Span<int> outBuffer, uint count, uint readOffset, uint updateCount) { if (countMax == 0 || bufferAddress == 0) @@ -104,6 +105,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command return count; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] private uint Write(IVirtualMemoryManager memoryManager, ulong outBufferAddress, uint countMax, ReadOnlySpan<int> buffer, uint count, uint writeOffset, uint updateCount) { if (countMax == 0 || outBufferAddress == 0) @@ -175,8 +177,8 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command } else { - ZeroFill(context.MemoryManager, BufferInfo.SendBufferInfo, Unsafe.SizeOf<AuxiliaryBufferInfo>()); - ZeroFill(context.MemoryManager, BufferInfo.ReturnBufferInfo, Unsafe.SizeOf<AuxiliaryBufferInfo>()); + context.MemoryManager.Fill(BufferInfo.SendBufferInfo, (ulong)Unsafe.SizeOf<AuxiliaryBufferInfo>(), 0); + context.MemoryManager.Fill(BufferInfo.ReturnBufferInfo, (ulong)Unsafe.SizeOf<AuxiliaryBufferInfo>(), 0); if (InputBufferIndex != OutputBufferIndex) { @@ -184,22 +186,5 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command } } } - - private static void ZeroFill(IVirtualMemoryManager memoryManager, ulong address, int size) - { - ulong endAddress = address + (ulong)size; - - while (address + 7UL < endAddress) - { - memoryManager.Write(address, 0UL); - address += 8; - } - - while (address < endAddress) - { - memoryManager.Write(address, (byte)0); - address++; - } - } } } |
