mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-10-10 18:09:00 +02:00
misc: Use nint/nuint instead of IntPtr/UIntPtr
This commit is contained in:
@@ -65,11 +65,11 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public unsafe IntPtr GetBufferPointer(int index)
|
||||
public unsafe nint GetBufferPointer(int index)
|
||||
{
|
||||
if (index >= 0 && index < _buffersEntryCount)
|
||||
{
|
||||
return (IntPtr)((float*)_buffersMemoryHandle.Pointer + index * _sampleCount);
|
||||
return (nint)((float*)_buffersMemoryHandle.Pointer + index * _sampleCount);
|
||||
}
|
||||
|
||||
throw new ArgumentOutOfRangeException(nameof(index), index, null);
|
||||
|
||||
@@ -90,8 +90,8 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||
statistics.Reset(_parameter.ChannelCount);
|
||||
}
|
||||
|
||||
Span<IntPtr> inputBuffers = stackalloc IntPtr[_parameter.ChannelCount];
|
||||
Span<IntPtr> outputBuffers = stackalloc IntPtr[_parameter.ChannelCount];
|
||||
Span<nint> inputBuffers = stackalloc nint[_parameter.ChannelCount];
|
||||
Span<nint> outputBuffers = stackalloc nint[_parameter.ChannelCount];
|
||||
Span<float> channelInput = stackalloc float[_parameter.ChannelCount];
|
||||
ExponentialMovingAverage inputMovingAverage = state.InputMovingAverage;
|
||||
float unknown4 = state.Unknown4;
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
private unsafe void ProcessDelayStereo(ref DelayState state, Span<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
|
||||
private unsafe void ProcessDelayStereo(ref DelayState state, Span<nint> outputBuffers, ReadOnlySpan<nint> inputBuffers, uint sampleCount)
|
||||
{
|
||||
const ushort ChannelCount = 2;
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
private unsafe void ProcessDelayQuadraphonic(ref DelayState state, Span<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
|
||||
private unsafe void ProcessDelayQuadraphonic(ref DelayState state, Span<nint> outputBuffers, ReadOnlySpan<nint> inputBuffers, uint sampleCount)
|
||||
{
|
||||
const ushort ChannelCount = 4;
|
||||
|
||||
@@ -168,7 +168,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
private unsafe void ProcessDelaySurround(ref DelayState state, Span<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
|
||||
private unsafe void ProcessDelaySurround(ref DelayState state, Span<nint> outputBuffers, ReadOnlySpan<nint> inputBuffers, uint sampleCount)
|
||||
{
|
||||
const ushort ChannelCount = 6;
|
||||
|
||||
@@ -227,8 +227,8 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||
|
||||
if (IsEffectEnabled && Parameter.IsChannelCountValid())
|
||||
{
|
||||
Span<IntPtr> inputBuffers = stackalloc IntPtr[Parameter.ChannelCount];
|
||||
Span<IntPtr> outputBuffers = stackalloc IntPtr[Parameter.ChannelCount];
|
||||
Span<nint> inputBuffers = stackalloc nint[Parameter.ChannelCount];
|
||||
Span<nint> outputBuffers = stackalloc nint[Parameter.ChannelCount];
|
||||
|
||||
for (int i = 0; i < Parameter.ChannelCount; i++)
|
||||
{
|
||||
|
||||
@@ -78,8 +78,8 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||
|
||||
if (IsEffectEnabled && _parameter.IsChannelCountValid())
|
||||
{
|
||||
Span<IntPtr> inputBuffers = stackalloc IntPtr[_parameter.ChannelCount];
|
||||
Span<IntPtr> outputBuffers = stackalloc IntPtr[_parameter.ChannelCount];
|
||||
Span<nint> inputBuffers = stackalloc nint[_parameter.ChannelCount];
|
||||
Span<nint> outputBuffers = stackalloc nint[_parameter.ChannelCount];
|
||||
|
||||
for (int i = 0; i < _parameter.ChannelCount; i++)
|
||||
{
|
||||
|
||||
@@ -96,8 +96,8 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||
statistics.Reset();
|
||||
}
|
||||
|
||||
Span<IntPtr> inputBuffers = stackalloc IntPtr[_parameter.ChannelCount];
|
||||
Span<IntPtr> outputBuffers = stackalloc IntPtr[_parameter.ChannelCount];
|
||||
Span<nint> inputBuffers = stackalloc nint[_parameter.ChannelCount];
|
||||
Span<nint> outputBuffers = stackalloc nint[_parameter.ChannelCount];
|
||||
|
||||
for (int i = 0; i < _parameter.ChannelCount; i++)
|
||||
{
|
||||
|
||||
@@ -87,30 +87,30 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void ProcessReverb3dMono(ref Reverb3dState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
|
||||
private void ProcessReverb3dMono(ref Reverb3dState state, ReadOnlySpan<nint> outputBuffers, ReadOnlySpan<nint> inputBuffers, uint sampleCount)
|
||||
{
|
||||
ProcessReverb3dGeneric(ref state, outputBuffers, inputBuffers, sampleCount, _outputEarlyIndicesTableMono, _targetEarlyDelayLineIndicesTableMono, _targetOutputFeedbackIndicesTableMono);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void ProcessReverb3dStereo(ref Reverb3dState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
|
||||
private void ProcessReverb3dStereo(ref Reverb3dState state, ReadOnlySpan<nint> outputBuffers, ReadOnlySpan<nint> inputBuffers, uint sampleCount)
|
||||
{
|
||||
ProcessReverb3dGeneric(ref state, outputBuffers, inputBuffers, sampleCount, _outputEarlyIndicesTableStereo, _targetEarlyDelayLineIndicesTableStereo, _targetOutputFeedbackIndicesTableStereo);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void ProcessReverb3dQuadraphonic(ref Reverb3dState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
|
||||
private void ProcessReverb3dQuadraphonic(ref Reverb3dState state, ReadOnlySpan<nint> outputBuffers, ReadOnlySpan<nint> inputBuffers, uint sampleCount)
|
||||
{
|
||||
ProcessReverb3dGeneric(ref state, outputBuffers, inputBuffers, sampleCount, _outputEarlyIndicesTableQuadraphonic, _targetEarlyDelayLineIndicesTableQuadraphonic, _targetOutputFeedbackIndicesTableQuadraphonic);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void ProcessReverb3dSurround(ref Reverb3dState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
|
||||
private void ProcessReverb3dSurround(ref Reverb3dState state, ReadOnlySpan<nint> outputBuffers, ReadOnlySpan<nint> inputBuffers, uint sampleCount)
|
||||
{
|
||||
ProcessReverb3dGeneric(ref state, outputBuffers, inputBuffers, sampleCount, _outputEarlyIndicesTableSurround, _targetEarlyDelayLineIndicesTableSurround, _targetOutputFeedbackIndicesTableSurround);
|
||||
}
|
||||
|
||||
private unsafe void ProcessReverb3dGeneric(ref Reverb3dState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount, ReadOnlySpan<int> outputEarlyIndicesTable, ReadOnlySpan<int> targetEarlyDelayLineIndicesTable, ReadOnlySpan<int> targetOutputFeedbackIndicesTable)
|
||||
private unsafe void ProcessReverb3dGeneric(ref Reverb3dState state, ReadOnlySpan<nint> outputBuffers, ReadOnlySpan<nint> inputBuffers, uint sampleCount, ReadOnlySpan<int> outputEarlyIndicesTable, ReadOnlySpan<int> targetEarlyDelayLineIndicesTable, ReadOnlySpan<int> targetOutputFeedbackIndicesTable)
|
||||
{
|
||||
const int DelayLineSampleIndexOffset = 1;
|
||||
|
||||
@@ -209,8 +209,8 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||
|
||||
if (IsEffectEnabled && Parameter.IsChannelCountValid())
|
||||
{
|
||||
Span<IntPtr> inputBuffers = stackalloc IntPtr[Parameter.ChannelCount];
|
||||
Span<IntPtr> outputBuffers = stackalloc IntPtr[Parameter.ChannelCount];
|
||||
Span<nint> inputBuffers = stackalloc nint[Parameter.ChannelCount];
|
||||
Span<nint> outputBuffers = stackalloc nint[Parameter.ChannelCount];
|
||||
|
||||
for (int i = 0; i < Parameter.ChannelCount; i++)
|
||||
{
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void ProcessReverbMono(ref ReverbState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
|
||||
private void ProcessReverbMono(ref ReverbState state, ReadOnlySpan<nint> outputBuffers, ReadOnlySpan<nint> inputBuffers, uint sampleCount)
|
||||
{
|
||||
ProcessReverbGeneric(
|
||||
ref state,
|
||||
@@ -101,7 +101,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void ProcessReverbStereo(ref ReverbState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
|
||||
private void ProcessReverbStereo(ref ReverbState state, ReadOnlySpan<nint> outputBuffers, ReadOnlySpan<nint> inputBuffers, uint sampleCount)
|
||||
{
|
||||
ProcessReverbGeneric(
|
||||
ref state,
|
||||
@@ -115,7 +115,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void ProcessReverbQuadraphonic(ref ReverbState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
|
||||
private void ProcessReverbQuadraphonic(ref ReverbState state, ReadOnlySpan<nint> outputBuffers, ReadOnlySpan<nint> inputBuffers, uint sampleCount)
|
||||
{
|
||||
ProcessReverbGeneric(
|
||||
ref state,
|
||||
@@ -129,7 +129,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void ProcessReverbSurround(ref ReverbState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
|
||||
private void ProcessReverbSurround(ref ReverbState state, ReadOnlySpan<nint> outputBuffers, ReadOnlySpan<nint> inputBuffers, uint sampleCount)
|
||||
{
|
||||
ProcessReverbGeneric(
|
||||
ref state,
|
||||
@@ -142,7 +142,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||
_outputIndicesTableSurround);
|
||||
}
|
||||
|
||||
private unsafe void ProcessReverbGeneric(ref ReverbState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount, ReadOnlySpan<int> outputEarlyIndicesTable, ReadOnlySpan<int> targetEarlyDelayLineIndicesTable, ReadOnlySpan<int> targetOutputFeedbackIndicesTable, ReadOnlySpan<int> outputIndicesTable)
|
||||
private unsafe void ProcessReverbGeneric(ref ReverbState state, ReadOnlySpan<nint> outputBuffers, ReadOnlySpan<nint> inputBuffers, uint sampleCount, ReadOnlySpan<int> outputEarlyIndicesTable, ReadOnlySpan<int> targetEarlyDelayLineIndicesTable, ReadOnlySpan<int> targetOutputFeedbackIndicesTable, ReadOnlySpan<int> outputIndicesTable)
|
||||
{
|
||||
bool isSurround = Parameter.ChannelCount == 6;
|
||||
|
||||
@@ -233,8 +233,8 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||
|
||||
if (IsEffectEnabled && Parameter.IsChannelCountValid())
|
||||
{
|
||||
Span<IntPtr> inputBuffers = stackalloc IntPtr[Parameter.ChannelCount];
|
||||
Span<IntPtr> outputBuffers = stackalloc IntPtr[Parameter.ChannelCount];
|
||||
Span<nint> inputBuffers = stackalloc nint[Parameter.ChannelCount];
|
||||
Span<nint> outputBuffers = stackalloc nint[Parameter.ChannelCount];
|
||||
|
||||
for (int i = 0; i < Parameter.ChannelCount; i++)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
||||
|
||||
private readonly unsafe ref MemoryPoolInfo MemoryPoolInfo => ref *_memoryPools;
|
||||
|
||||
public readonly unsafe bool HasMemoryPoolState => (IntPtr)_memoryPools != IntPtr.Zero;
|
||||
public readonly unsafe bool HasMemoryPoolState => (nint)_memoryPools != nint.Zero;
|
||||
|
||||
/// <summary>
|
||||
/// Create an new empty <see cref="AddressInfo"/>.
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
||||
[MarshalAs(UnmanagedType.I1)]
|
||||
public bool IsUsed;
|
||||
|
||||
public static unsafe MemoryPoolInfo* Null => (MemoryPoolInfo*)IntPtr.Zero.ToPointer();
|
||||
public static unsafe MemoryPoolInfo* Null => (MemoryPoolInfo*)nint.Zero.ToPointer();
|
||||
|
||||
/// <summary>
|
||||
/// Create a new <see cref="MemoryPoolInfo"/> with the given <see cref="LocationType"/>.
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Ryujinx.Audio.Renderer.Server.Mix
|
||||
/// <summary>
|
||||
/// The effect processing order storage.
|
||||
/// </summary>
|
||||
private readonly IntPtr _effectProcessingOrderArrayPointer;
|
||||
private readonly nint _effectProcessingOrderArrayPointer;
|
||||
|
||||
/// <summary>
|
||||
/// The max element count that can be found in the effect processing order storage.
|
||||
@@ -123,7 +123,7 @@ namespace Ryujinx.Audio.Renderer.Server.Mix
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_effectProcessingOrderArrayPointer == IntPtr.Zero)
|
||||
if (_effectProcessingOrderArrayPointer == nint.Zero)
|
||||
{
|
||||
return Span<int>.Empty;
|
||||
}
|
||||
@@ -153,7 +153,7 @@ namespace Ryujinx.Audio.Renderer.Server.Mix
|
||||
unsafe
|
||||
{
|
||||
// SAFETY: safe as effectProcessingOrderArray comes from the work buffer memory that is pinned.
|
||||
_effectProcessingOrderArrayPointer = (IntPtr)Unsafe.AsPointer(ref MemoryMarshal.GetReference(effectProcessingOrderArray.Span));
|
||||
_effectProcessingOrderArrayPointer = (nint)Unsafe.AsPointer(ref MemoryMarshal.GetReference(effectProcessingOrderArray.Span));
|
||||
}
|
||||
|
||||
EffectProcessingOrderArrayMaxCount = (uint)effectProcessingOrderArray.Length;
|
||||
|
||||
Reference in New Issue
Block a user