Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-carvalho committed Jan 5, 2025
1 parent 07c5ab9 commit 3ce9c78
Show file tree
Hide file tree
Showing 36 changed files with 181 additions and 181 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ private bool TryAllocateRegWithoutSpill(AllocationContext context, LiveInterval
{
RegisterType regType = current.Local.Type.ToRegisterType();

Span<int> freePositions = stackalloc int[registersCount];
Span<int> freePositions = [registersCount];

context.GetFreePositions(regType, freePositions, out int freePositionsCount);

Expand Down Expand Up @@ -320,8 +320,8 @@ private void AllocateRegWithSpill(AllocationContext context, LiveInterval curren
{
RegisterType regType = current.Local.Type.ToRegisterType();

Span<int> usePositions = stackalloc int[registersCount];
Span<int> blockedPositions = stackalloc int[registersCount];
Span<int> usePositions = [registersCount];
Span<int> blockedPositions = [registersCount];

context.GetFreePositions(regType, usePositions, out _);
context.GetFreePositions(regType, blockedPositions, out _);
Expand Down
6 changes: 3 additions & 3 deletions src/Ryujinx.Audio/Renderer/Dsp/Command/CompressorCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ private unsafe void ProcessCompressor(CommandList context, ref CompressorState s
statistics.Reset(_parameter.ChannelCount);
}

Span<nint> inputBuffers = stackalloc nint[_parameter.ChannelCount];
Span<nint> outputBuffers = stackalloc nint[_parameter.ChannelCount];
Span<float> channelInput = stackalloc float[_parameter.ChannelCount];
Span<nint> inputBuffers = [_parameter.ChannelCount];
Span<nint> outputBuffers = [_parameter.ChannelCount];
Span<float> channelInput = [_parameter.ChannelCount];
ExponentialMovingAverage inputMovingAverage = state.InputMovingAverage;
float unknown4 = state.Unknown4;
ExponentialMovingAverage compressionGainAverage = state.CompressionGainAverage;
Expand Down
4 changes: 2 additions & 2 deletions src/Ryujinx.Audio/Renderer/Dsp/Command/DelayCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ private unsafe void ProcessDelay(CommandList context, ref DelayState state)

if (IsEffectEnabled && Parameter.IsChannelCountValid())
{
Span<nint> inputBuffers = stackalloc nint[Parameter.ChannelCount];
Span<nint> outputBuffers = stackalloc nint[Parameter.ChannelCount];
Span<nint> inputBuffers = [Parameter.ChannelCount];
Span<nint> outputBuffers = [Parameter.ChannelCount];

for (int i = 0; i < Parameter.ChannelCount; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ private unsafe void ProcessLimiter(CommandList context, ref LimiterState state)

if (IsEffectEnabled && _parameter.IsChannelCountValid())
{
Span<nint> inputBuffers = stackalloc nint[_parameter.ChannelCount];
Span<nint> outputBuffers = stackalloc nint[_parameter.ChannelCount];
Span<nint> inputBuffers = [_parameter.ChannelCount];
Span<nint> outputBuffers = [_parameter.ChannelCount];

for (int i = 0; i < _parameter.ChannelCount; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ private unsafe void ProcessLimiter(CommandList context, ref LimiterState state)
statistics.Reset();
}

Span<nint> inputBuffers = stackalloc nint[_parameter.ChannelCount];
Span<nint> outputBuffers = stackalloc nint[_parameter.ChannelCount];
Span<nint> inputBuffers = [_parameter.ChannelCount];
Span<nint> outputBuffers = [_parameter.ChannelCount];

for (int i = 0; i < _parameter.ChannelCount; i++)
{
Expand Down
14 changes: 7 additions & 7 deletions src/Ryujinx.Audio/Renderer/Dsp/Command/Reverb3dCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ private unsafe void ProcessReverb3dGeneric(ref Reverb3dState state, ReadOnlySpan
bool isMono = Parameter.ChannelCount == 1;
bool isSurround = Parameter.ChannelCount == 6;

Span<float> outputValues = stackalloc float[Constants.ChannelCountMax];
Span<float> channelInput = stackalloc float[Parameter.ChannelCount];
Span<float> feedbackValues = stackalloc float[4];
Span<float> feedbackOutputValues = stackalloc float[4];
Span<float> values = stackalloc float[4];
Span<float> outputValues = [Constants.ChannelCountMax];
Span<float> channelInput = [Parameter.ChannelCount];
Span<float> feedbackValues = [4];
Span<float> feedbackOutputValues = [4];
Span<float> values = [4];

for (int sampleIndex = 0; sampleIndex < sampleCount; sampleIndex++)
{
Expand Down Expand Up @@ -193,8 +193,8 @@ public void ProcessReverb3d(CommandList context, ref Reverb3dState state)

if (IsEffectEnabled && Parameter.IsChannelCountValid())
{
Span<nint> inputBuffers = stackalloc nint[Parameter.ChannelCount];
Span<nint> outputBuffers = stackalloc nint[Parameter.ChannelCount];
Span<nint> inputBuffers = [Parameter.ChannelCount];
Span<nint> outputBuffers = [Parameter.ChannelCount];

for (int i = 0; i < Parameter.ChannelCount; i++)
{
Expand Down
12 changes: 6 additions & 6 deletions src/Ryujinx.Audio/Renderer/Dsp/Command/ReverbCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ private unsafe void ProcessReverbGeneric(ref ReverbState state, ReadOnlySpan<nin
float outGain = FixedPointHelper.ToFloat(Parameter.OutGain, FixedPointPrecision);
float dryGain = FixedPointHelper.ToFloat(Parameter.DryGain, FixedPointPrecision);

Span<float> outputValues = stackalloc float[Constants.ChannelCountMax];
Span<float> feedbackValues = stackalloc float[4];
Span<float> feedbackOutputValues = stackalloc float[4];
Span<float> channelInput = stackalloc float[Parameter.ChannelCount];
Span<float> outputValues = [Constants.ChannelCountMax];
Span<float> feedbackValues = [4];
Span<float> feedbackOutputValues = [4];
Span<float> channelInput = [Parameter.ChannelCount];

for (int sampleIndex = 0; sampleIndex < sampleCount; sampleIndex++)
{
Expand Down Expand Up @@ -223,8 +223,8 @@ private void ProcessReverb(CommandList context, ref ReverbState state)

if (IsEffectEnabled && Parameter.IsChannelCountValid())
{
Span<nint> inputBuffers = stackalloc nint[Parameter.ChannelCount];
Span<nint> outputBuffers = stackalloc nint[Parameter.ChannelCount];
Span<nint> inputBuffers = [Parameter.ChannelCount];
Span<nint> outputBuffers = [Parameter.ChannelCount];

for (int i = 0; i < Parameter.ChannelCount; i++)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.Audio/Renderer/Dsp/DataSourceHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static void ProcessWaveBuffers(IVirtualMemoryManager memoryManager, Span<
{
const int TempBufferSize = 0x3F00;

Span<short> tempBuffer = stackalloc short[TempBufferSize];
Span<short> tempBuffer = [TempBufferSize];

float sampleRateRatio = (float)info.SourceSampleRate / targetSampleRate * info.Pitch;

Expand Down
12 changes: 6 additions & 6 deletions src/Ryujinx.Common/Extensions/StreamExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static void Write(this Stream stream, ReadOnlySpan<int> buffer)
}
else
{
Span<byte> byteBuffer = stackalloc byte[sizeof(int)];
Span<byte> byteBuffer = [sizeof(int)];

foreach (int value in buffer)
{
Expand All @@ -47,7 +47,7 @@ public static void Write(this Stream stream, ReadOnlySpan<int> buffer)
/// <param name="value">The value to be written</param>
public static void Write(this Stream stream, int value)
{
Span<byte> buffer = stackalloc byte[sizeof(int)];
Span<byte> buffer = [sizeof(int)];
BinaryPrimitives.WriteInt32LittleEndian(buffer, value);
stream.Write(buffer);
}
Expand All @@ -60,7 +60,7 @@ public static void Write(this Stream stream, int value)
/// <param name="value">The value to be written</param>
public static void Write(this Stream stream, long value)
{
Span<byte> buffer = stackalloc byte[sizeof(long)];
Span<byte> buffer = [sizeof(long)];
BinaryPrimitives.WriteInt64LittleEndian(buffer, value);
stream.Write(buffer);
}
Expand All @@ -73,7 +73,7 @@ public static void Write(this Stream stream, long value)
/// <param name="value">The value to be written</param>
public static void Write(this Stream stream, uint value)
{
Span<byte> buffer = stackalloc byte[sizeof(uint)];
Span<byte> buffer = [sizeof(uint)];
BinaryPrimitives.WriteUInt32LittleEndian(buffer, value);
stream.Write(buffer);
}
Expand All @@ -86,7 +86,7 @@ public static void Write(this Stream stream, uint value)
/// <param name="value">The value to be written</param>
public static void Write(this Stream stream, ulong value)
{
Span<byte> buffer = stackalloc byte[sizeof(ulong)];
Span<byte> buffer = [sizeof(ulong)];
BinaryPrimitives.WriteUInt64LittleEndian(buffer, value);
stream.Write(buffer);
}
Expand Down Expand Up @@ -120,7 +120,7 @@ public static void WriteByte(this Stream stream, byte value, int count)
int blockCount = count / BlockSize;
if (blockCount > 0)
{
Span<byte> span = stackalloc byte[BlockSize];
Span<byte> span = [BlockSize];
span.Fill(value);
for (int x = 0; x < blockCount; x++)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.Common/Hash128.cs
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ private static ulong Xxh3MergeAccs(Span<ulong> acc, ReadOnlySpan<byte> secret, u
[SkipLocalsInit]
private static Hash128 Xxh3HashLong128bInternal(ReadOnlySpan<byte> input, ReadOnlySpan<byte> secret)
{
Span<ulong> acc = stackalloc ulong[AccNb];
Span<ulong> acc = [AccNb];
_xxh3InitAcc.CopyTo(acc);

Xxh3HashLongInternalLoop(acc, input, secret);
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.Common/SystemInterop/StdErrAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void Dispose()

private static (int, int) MakePipe()
{
Span<int> pipefd = stackalloc int[2];
Span<int> pipefd = [2];

if (pipe(pipefd) == 0)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.Cpu/LightningJit/Arm32/RegisterAllocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void EnsureTempGprRegisters(int count)
{
if (count != 0)
{
Span<int> registers = stackalloc int[count];
Span<int> registers = [count];

for (int index = 0; index < count; index++)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.Cpu/LightningJit/Arm64/RegisterAllocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public RegisterAllocator(MemoryManagerType mmType, uint gprMask, uint fpSimdMask

BuildRegisterMap(_registerMap);

Span<int> tempRegisters = stackalloc int[CalculateMaxTemps(mmType)];
Span<int> tempRegisters = [CalculateMaxTemps(mmType)];

for (int index = 0; index < tempRegisters.Length; index++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public BufferRange GetOrCreateTopologyRemapBuffer(PrimitiveTopology topology, in
private IndexBuffer CreateTopologyRemapBuffer(PrimitiveTopology topology, int count)
{
// Size can't be zero as creating zero sized buffers is invalid.
Span<int> data = new int[Math.Max(GetPrimitivesCount(topology, count) * GetVerticesPerPrimitive(topology), 1)];
Span<int> data = [Math.Max(GetPrimitivesCount(topology, count) * GetVerticesPerPrimitive(topology), 1)];

switch (topology)
{
Expand Down Expand Up @@ -536,7 +536,7 @@ public BufferHandle GetSequentialIndexBuffer(int count)
_sequentialIndexBuffer = _context.Renderer.CreateBuffer(count * sizeof(uint), BufferAccess.DeviceMemory);
_sequentialIndexBufferCount = count;

Span<int> data = new int[count];
Span<int> data = [count];

for (int index = 0; index < count; index++)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,7 @@ private void UpdateRtColorMask()
{
bool rtColorMaskShared = _state.State.RtColorMaskShared;

Span<uint> componentMasks = stackalloc uint[Constants.TotalRenderTargets];
Span<uint> componentMasks = [Constants.TotalRenderTargets];

for (int index = 0; index < Constants.TotalRenderTargets; index++)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.Graphics.Metal/HelperShader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ public void ConvertIndexBuffer(
// Save current state
_pipeline.SwapState(_helperShaderState);

Span<int> shaderParams = stackalloc int[ParamsBufferSize / sizeof(int)];
Span<int> shaderParams = [ParamsBufferSize / sizeof(int)];

shaderParams[8] = pattern.PrimitiveVertices;
shaderParams[9] = pattern.PrimitiveVerticesOut;
Expand Down
Loading

0 comments on commit 3ce9c78

Please sign in to comment.