From b8ad676fb8cbe0a43617df41daaf284ab4421c75 Mon Sep 17 00:00:00 2001 From: Mary Date: Sun, 18 Jul 2021 13:05:11 +0200 Subject: 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. --- .../Renderer/Dsp/Command/AuxiliaryBufferCommand.cs | 23 ++++------------------ 1 file changed, 4 insertions(+), 19 deletions(-) (limited to 'Ryujinx.Audio/Renderer/Dsp/Command/AuxiliaryBufferCommand.cs') 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 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 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()); - ZeroFill(context.MemoryManager, BufferInfo.ReturnBufferInfo, Unsafe.SizeOf()); + context.MemoryManager.Fill(BufferInfo.SendBufferInfo, (ulong)Unsafe.SizeOf(), 0); + context.MemoryManager.Fill(BufferInfo.ReturnBufferInfo, (ulong)Unsafe.SizeOf(), 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++; - } - } } } -- cgit v1.2.3