diff --git a/src/ARMeilleure/CodeGen/RegisterAllocators/LinearScanAllocator.cs b/src/ARMeilleure/CodeGen/RegisterAllocators/LinearScanAllocator.cs index 20530eaac6..7017da4865 100644 --- a/src/ARMeilleure/CodeGen/RegisterAllocators/LinearScanAllocator.cs +++ b/src/ARMeilleure/CodeGen/RegisterAllocators/LinearScanAllocator.cs @@ -210,7 +210,7 @@ private bool TryAllocateRegWithoutSpill(AllocationContext context, LiveInterval { RegisterType regType = current.Local.Type.ToRegisterType(); - Span freePositions = stackalloc int[registersCount]; + Span freePositions = [registersCount]; context.GetFreePositions(regType, freePositions, out int freePositionsCount); @@ -320,8 +320,8 @@ private void AllocateRegWithSpill(AllocationContext context, LiveInterval curren { RegisterType regType = current.Local.Type.ToRegisterType(); - Span usePositions = stackalloc int[registersCount]; - Span blockedPositions = stackalloc int[registersCount]; + Span usePositions = [registersCount]; + Span blockedPositions = [registersCount]; context.GetFreePositions(regType, usePositions, out _); context.GetFreePositions(regType, blockedPositions, out _); diff --git a/src/Ryujinx.Audio/Renderer/Dsp/Command/CompressorCommand.cs b/src/Ryujinx.Audio/Renderer/Dsp/Command/CompressorCommand.cs index c6c0956a63..16f6773ca7 100644 --- a/src/Ryujinx.Audio/Renderer/Dsp/Command/CompressorCommand.cs +++ b/src/Ryujinx.Audio/Renderer/Dsp/Command/CompressorCommand.cs @@ -82,9 +82,9 @@ private unsafe void ProcessCompressor(CommandList context, ref CompressorState s statistics.Reset(_parameter.ChannelCount); } - Span inputBuffers = stackalloc nint[_parameter.ChannelCount]; - Span outputBuffers = stackalloc nint[_parameter.ChannelCount]; - Span channelInput = stackalloc float[_parameter.ChannelCount]; + Span inputBuffers = [_parameter.ChannelCount]; + Span outputBuffers = [_parameter.ChannelCount]; + Span channelInput = [_parameter.ChannelCount]; ExponentialMovingAverage inputMovingAverage = state.InputMovingAverage; float unknown4 = state.Unknown4; ExponentialMovingAverage compressionGainAverage = state.CompressionGainAverage; diff --git a/src/Ryujinx.Audio/Renderer/Dsp/Command/DelayCommand.cs b/src/Ryujinx.Audio/Renderer/Dsp/Command/DelayCommand.cs index 21cf695042..7c091be5ba 100644 --- a/src/Ryujinx.Audio/Renderer/Dsp/Command/DelayCommand.cs +++ b/src/Ryujinx.Audio/Renderer/Dsp/Command/DelayCommand.cs @@ -219,8 +219,8 @@ private unsafe void ProcessDelay(CommandList context, ref DelayState state) if (IsEffectEnabled && Parameter.IsChannelCountValid()) { - Span inputBuffers = stackalloc nint[Parameter.ChannelCount]; - Span outputBuffers = stackalloc nint[Parameter.ChannelCount]; + Span inputBuffers = [Parameter.ChannelCount]; + Span outputBuffers = [Parameter.ChannelCount]; for (int i = 0; i < Parameter.ChannelCount; i++) { diff --git a/src/Ryujinx.Audio/Renderer/Dsp/Command/LimiterCommandVersion1.cs b/src/Ryujinx.Audio/Renderer/Dsp/Command/LimiterCommandVersion1.cs index 4e7f67e78d..fd82fc6012 100644 --- a/src/Ryujinx.Audio/Renderer/Dsp/Command/LimiterCommandVersion1.cs +++ b/src/Ryujinx.Audio/Renderer/Dsp/Command/LimiterCommandVersion1.cs @@ -70,8 +70,8 @@ private unsafe void ProcessLimiter(CommandList context, ref LimiterState state) if (IsEffectEnabled && _parameter.IsChannelCountValid()) { - Span inputBuffers = stackalloc nint[_parameter.ChannelCount]; - Span outputBuffers = stackalloc nint[_parameter.ChannelCount]; + Span inputBuffers = [_parameter.ChannelCount]; + Span outputBuffers = [_parameter.ChannelCount]; for (int i = 0; i < _parameter.ChannelCount; i++) { diff --git a/src/Ryujinx.Audio/Renderer/Dsp/Command/LimiterCommandVersion2.cs b/src/Ryujinx.Audio/Renderer/Dsp/Command/LimiterCommandVersion2.cs index b0032c5b75..9eaf7041a8 100644 --- a/src/Ryujinx.Audio/Renderer/Dsp/Command/LimiterCommandVersion2.cs +++ b/src/Ryujinx.Audio/Renderer/Dsp/Command/LimiterCommandVersion2.cs @@ -88,8 +88,8 @@ private unsafe void ProcessLimiter(CommandList context, ref LimiterState state) statistics.Reset(); } - Span inputBuffers = stackalloc nint[_parameter.ChannelCount]; - Span outputBuffers = stackalloc nint[_parameter.ChannelCount]; + Span inputBuffers = [_parameter.ChannelCount]; + Span outputBuffers = [_parameter.ChannelCount]; for (int i = 0; i < _parameter.ChannelCount; i++) { diff --git a/src/Ryujinx.Audio/Renderer/Dsp/Command/Reverb3dCommand.cs b/src/Ryujinx.Audio/Renderer/Dsp/Command/Reverb3dCommand.cs index 4b1912f197..95f3f9134e 100644 --- a/src/Ryujinx.Audio/Renderer/Dsp/Command/Reverb3dCommand.cs +++ b/src/Ryujinx.Audio/Renderer/Dsp/Command/Reverb3dCommand.cs @@ -101,11 +101,11 @@ private unsafe void ProcessReverb3dGeneric(ref Reverb3dState state, ReadOnlySpan bool isMono = Parameter.ChannelCount == 1; bool isSurround = Parameter.ChannelCount == 6; - Span outputValues = stackalloc float[Constants.ChannelCountMax]; - Span channelInput = stackalloc float[Parameter.ChannelCount]; - Span feedbackValues = stackalloc float[4]; - Span feedbackOutputValues = stackalloc float[4]; - Span values = stackalloc float[4]; + Span outputValues = [Constants.ChannelCountMax]; + Span channelInput = [Parameter.ChannelCount]; + Span feedbackValues = [4]; + Span feedbackOutputValues = [4]; + Span values = [4]; for (int sampleIndex = 0; sampleIndex < sampleCount; sampleIndex++) { @@ -193,8 +193,8 @@ public void ProcessReverb3d(CommandList context, ref Reverb3dState state) if (IsEffectEnabled && Parameter.IsChannelCountValid()) { - Span inputBuffers = stackalloc nint[Parameter.ChannelCount]; - Span outputBuffers = stackalloc nint[Parameter.ChannelCount]; + Span inputBuffers = [Parameter.ChannelCount]; + Span outputBuffers = [Parameter.ChannelCount]; for (int i = 0; i < Parameter.ChannelCount; i++) { diff --git a/src/Ryujinx.Audio/Renderer/Dsp/Command/ReverbCommand.cs b/src/Ryujinx.Audio/Renderer/Dsp/Command/ReverbCommand.cs index af7a218f3d..1b34e86a4b 100644 --- a/src/Ryujinx.Audio/Renderer/Dsp/Command/ReverbCommand.cs +++ b/src/Ryujinx.Audio/Renderer/Dsp/Command/ReverbCommand.cs @@ -141,10 +141,10 @@ private unsafe void ProcessReverbGeneric(ref ReverbState state, ReadOnlySpan outputValues = stackalloc float[Constants.ChannelCountMax]; - Span feedbackValues = stackalloc float[4]; - Span feedbackOutputValues = stackalloc float[4]; - Span channelInput = stackalloc float[Parameter.ChannelCount]; + Span outputValues = [Constants.ChannelCountMax]; + Span feedbackValues = [4]; + Span feedbackOutputValues = [4]; + Span channelInput = [Parameter.ChannelCount]; for (int sampleIndex = 0; sampleIndex < sampleCount; sampleIndex++) { @@ -223,8 +223,8 @@ private void ProcessReverb(CommandList context, ref ReverbState state) if (IsEffectEnabled && Parameter.IsChannelCountValid()) { - Span inputBuffers = stackalloc nint[Parameter.ChannelCount]; - Span outputBuffers = stackalloc nint[Parameter.ChannelCount]; + Span inputBuffers = [Parameter.ChannelCount]; + Span outputBuffers = [Parameter.ChannelCount]; for (int i = 0; i < Parameter.ChannelCount; i++) { diff --git a/src/Ryujinx.Audio/Renderer/Dsp/DataSourceHelper.cs b/src/Ryujinx.Audio/Renderer/Dsp/DataSourceHelper.cs index ba065a36f6..15a80d6628 100644 --- a/src/Ryujinx.Audio/Renderer/Dsp/DataSourceHelper.cs +++ b/src/Ryujinx.Audio/Renderer/Dsp/DataSourceHelper.cs @@ -46,7 +46,7 @@ public static void ProcessWaveBuffers(IVirtualMemoryManager memoryManager, Span< { const int TempBufferSize = 0x3F00; - Span tempBuffer = stackalloc short[TempBufferSize]; + Span tempBuffer = [TempBufferSize]; float sampleRateRatio = (float)info.SourceSampleRate / targetSampleRate * info.Pitch; diff --git a/src/Ryujinx.Common/Extensions/StreamExtensions.cs b/src/Ryujinx.Common/Extensions/StreamExtensions.cs index 59ff44edc0..b14f898873 100644 --- a/src/Ryujinx.Common/Extensions/StreamExtensions.cs +++ b/src/Ryujinx.Common/Extensions/StreamExtensions.cs @@ -29,7 +29,7 @@ public static void Write(this Stream stream, ReadOnlySpan buffer) } else { - Span byteBuffer = stackalloc byte[sizeof(int)]; + Span byteBuffer = [sizeof(int)]; foreach (int value in buffer) { @@ -47,7 +47,7 @@ public static void Write(this Stream stream, ReadOnlySpan buffer) /// The value to be written public static void Write(this Stream stream, int value) { - Span buffer = stackalloc byte[sizeof(int)]; + Span buffer = [sizeof(int)]; BinaryPrimitives.WriteInt32LittleEndian(buffer, value); stream.Write(buffer); } @@ -60,7 +60,7 @@ public static void Write(this Stream stream, int value) /// The value to be written public static void Write(this Stream stream, long value) { - Span buffer = stackalloc byte[sizeof(long)]; + Span buffer = [sizeof(long)]; BinaryPrimitives.WriteInt64LittleEndian(buffer, value); stream.Write(buffer); } @@ -73,7 +73,7 @@ public static void Write(this Stream stream, long value) /// The value to be written public static void Write(this Stream stream, uint value) { - Span buffer = stackalloc byte[sizeof(uint)]; + Span buffer = [sizeof(uint)]; BinaryPrimitives.WriteUInt32LittleEndian(buffer, value); stream.Write(buffer); } @@ -86,7 +86,7 @@ public static void Write(this Stream stream, uint value) /// The value to be written public static void Write(this Stream stream, ulong value) { - Span buffer = stackalloc byte[sizeof(ulong)]; + Span buffer = [sizeof(ulong)]; BinaryPrimitives.WriteUInt64LittleEndian(buffer, value); stream.Write(buffer); } @@ -120,7 +120,7 @@ public static void WriteByte(this Stream stream, byte value, int count) int blockCount = count / BlockSize; if (blockCount > 0) { - Span span = stackalloc byte[BlockSize]; + Span span = [BlockSize]; span.Fill(value); for (int x = 0; x < blockCount; x++) { diff --git a/src/Ryujinx.Common/Hash128.cs b/src/Ryujinx.Common/Hash128.cs index baee3e7d2b..b5f41352a2 100644 --- a/src/Ryujinx.Common/Hash128.cs +++ b/src/Ryujinx.Common/Hash128.cs @@ -508,7 +508,7 @@ private static ulong Xxh3MergeAccs(Span acc, ReadOnlySpan secret, u [SkipLocalsInit] private static Hash128 Xxh3HashLong128bInternal(ReadOnlySpan input, ReadOnlySpan secret) { - Span acc = stackalloc ulong[AccNb]; + Span acc = [AccNb]; _xxh3InitAcc.CopyTo(acc); Xxh3HashLongInternalLoop(acc, input, secret); diff --git a/src/Ryujinx.Common/SystemInterop/StdErrAdapter.cs b/src/Ryujinx.Common/SystemInterop/StdErrAdapter.cs index a04c404d8f..d3f7d5b0a9 100644 --- a/src/Ryujinx.Common/SystemInterop/StdErrAdapter.cs +++ b/src/Ryujinx.Common/SystemInterop/StdErrAdapter.cs @@ -80,7 +80,7 @@ public void Dispose() private static (int, int) MakePipe() { - Span pipefd = stackalloc int[2]; + Span pipefd = [2]; if (pipe(pipefd) == 0) { diff --git a/src/Ryujinx.Cpu/LightningJit/Arm32/RegisterAllocator.cs b/src/Ryujinx.Cpu/LightningJit/Arm32/RegisterAllocator.cs index 4a3f03b8a2..3a7471fa32 100644 --- a/src/Ryujinx.Cpu/LightningJit/Arm32/RegisterAllocator.cs +++ b/src/Ryujinx.Cpu/LightningJit/Arm32/RegisterAllocator.cs @@ -74,7 +74,7 @@ public void EnsureTempGprRegisters(int count) { if (count != 0) { - Span registers = stackalloc int[count]; + Span registers = [count]; for (int index = 0; index < count; index++) { diff --git a/src/Ryujinx.Cpu/LightningJit/Arm64/RegisterAllocator.cs b/src/Ryujinx.Cpu/LightningJit/Arm64/RegisterAllocator.cs index 1c6eab0de2..39b1ebb974 100644 --- a/src/Ryujinx.Cpu/LightningJit/Arm64/RegisterAllocator.cs +++ b/src/Ryujinx.Cpu/LightningJit/Arm64/RegisterAllocator.cs @@ -53,7 +53,7 @@ public RegisterAllocator(MemoryManagerType mmType, uint gprMask, uint fpSimdMask BuildRegisterMap(_registerMap); - Span tempRegisters = stackalloc int[CalculateMaxTemps(mmType)]; + Span tempRegisters = [CalculateMaxTemps(mmType)]; for (int index = 0; index < tempRegisters.Length; index++) { diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/ComputeDraw/VtgAsComputeContext.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/ComputeDraw/VtgAsComputeContext.cs index 08b446f54d..ad5d72775a 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/ComputeDraw/VtgAsComputeContext.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/ComputeDraw/VtgAsComputeContext.cs @@ -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 data = new int[Math.Max(GetPrimitivesCount(topology, count) * GetVerticesPerPrimitive(topology), 1)]; + Span data = [Math.Max(GetPrimitivesCount(topology, count) * GetVerticesPerPrimitive(topology), 1)]; switch (topology) { @@ -536,7 +536,7 @@ public BufferHandle GetSequentialIndexBuffer(int count) _sequentialIndexBuffer = _context.Renderer.CreateBuffer(count * sizeof(uint), BufferAccess.DeviceMemory); _sequentialIndexBufferCount = count; - Span data = new int[count]; + Span data = [count]; for (int index = 0; index < count; index++) { diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs index d0f8543239..61ab98d075 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs @@ -1229,7 +1229,7 @@ private void UpdateRtColorMask() { bool rtColorMaskShared = _state.State.RtColorMaskShared; - Span componentMasks = stackalloc uint[Constants.TotalRenderTargets]; + Span componentMasks = [Constants.TotalRenderTargets]; for (int index = 0; index < Constants.TotalRenderTargets; index++) { diff --git a/src/Ryujinx.Graphics.Metal/HelperShader.cs b/src/Ryujinx.Graphics.Metal/HelperShader.cs index e167245970..aa3edb1f3a 100644 --- a/src/Ryujinx.Graphics.Metal/HelperShader.cs +++ b/src/Ryujinx.Graphics.Metal/HelperShader.cs @@ -651,7 +651,7 @@ public void ConvertIndexBuffer( // Save current state _pipeline.SwapState(_helperShaderState); - Span shaderParams = stackalloc int[ParamsBufferSize / sizeof(int)]; + Span shaderParams = [ParamsBufferSize / sizeof(int)]; shaderParams[8] = pattern.PrimitiveVertices; shaderParams[9] = pattern.PrimitiveVerticesOut; diff --git a/src/Ryujinx.Graphics.Nvdec.Vp9/Dsp/InvTxfm.cs b/src/Ryujinx.Graphics.Nvdec.Vp9/Dsp/InvTxfm.cs index c4f45bfda7..81674b723e 100644 --- a/src/Ryujinx.Graphics.Nvdec.Vp9/Dsp/InvTxfm.cs +++ b/src/Ryujinx.Graphics.Nvdec.Vp9/Dsp/InvTxfm.cs @@ -97,7 +97,7 @@ public static void Iwht4x416Add(ReadOnlySpan input, Span dest, int st /* 4-point reversible, orthonormal inverse Walsh-Hadamard in 3.5 adds, 0.5 shifts per pixel. */ int i; - Span output = stackalloc int[16]; + Span output = [16]; long a1, b1, c1, d1, e1; ReadOnlySpan ip = input; Span op = output; @@ -152,7 +152,7 @@ public static void Iwht4x41Add(ReadOnlySpan input, Span dest, int str { int i; long a1, e1; - Span tmp = stackalloc int[4]; + Span tmp = [4]; ReadOnlySpan ip = input; Span op = tmp; @@ -219,7 +219,7 @@ public static void Iadst4(ReadOnlySpan input, Span output) [SkipLocalsInit] public static void Idct4(ReadOnlySpan input, Span output) { - Span step = stackalloc short[4]; + Span step = [4]; long temp1, temp2; // stage 1 @@ -243,10 +243,10 @@ public static void Idct4(ReadOnlySpan input, Span output) public static void Idct4x416Add(ReadOnlySpan input, Span dest, int stride) { int i, j; - Span output = stackalloc int[4 * 4]; + Span output = [4 * 4]; Span outptr = output; - Span tempIn = stackalloc int[4]; - Span tempOut = stackalloc int[4]; + Span tempIn = [4]; + Span tempOut = [4]; // Rows for (i = 0; i < 4; ++i) @@ -372,8 +372,8 @@ public static void Iadst8(ReadOnlySpan input, Span output) [SkipLocalsInit] public static void Idct8(ReadOnlySpan input, Span output) { - Span step1 = stackalloc short[8]; - Span step2 = stackalloc short[8]; + Span step1 = [8]; + Span step2 = [8]; long temp1, temp2; // stage 1 @@ -431,10 +431,10 @@ public static void Idct8(ReadOnlySpan input, Span output) public static void Idct8x864Add(ReadOnlySpan input, Span dest, int stride) { int i, j; - Span output = stackalloc int[8 * 8]; + Span output = [8 * 8]; Span outptr = output; - Span tempIn = stackalloc int[8]; - Span tempOut = stackalloc int[8]; + Span tempIn = [8]; + Span tempOut = [8]; // First transform rows for (i = 0; i < 8; ++i) @@ -465,10 +465,10 @@ public static void Idct8x864Add(ReadOnlySpan input, Span dest, int st public static void Idct8x812Add(ReadOnlySpan input, Span dest, int stride) { int i, j; - Span output = stackalloc int[8 * 8]; + Span output = [8 * 8]; Span outptr = output; - Span tempIn = stackalloc int[8]; - Span tempOut = stackalloc int[8]; + Span tempIn = [8]; + Span tempOut = [8]; output.Clear(); @@ -689,8 +689,8 @@ public static void Iadst16(ReadOnlySpan input, Span output) [SkipLocalsInit] public static void Idct16(ReadOnlySpan input, Span output) { - Span step1 = stackalloc short[16]; - Span step2 = stackalloc short[16]; + Span step1 = [16]; + Span step2 = [16]; long temp1, temp2; // stage 1 @@ -858,10 +858,10 @@ public static void Idct16(ReadOnlySpan input, Span output) public static void Idct16x16256Add(ReadOnlySpan input, Span dest, int stride) { int i, j; - Span output = stackalloc int[16 * 16]; + Span output = [16 * 16]; Span outptr = output; - Span tempIn = stackalloc int[16]; - Span tempOut = stackalloc int[16]; + Span tempIn = [16]; + Span tempOut = [16]; // First transform rows for (i = 0; i < 16; ++i) @@ -891,10 +891,10 @@ public static void Idct16x16256Add(ReadOnlySpan input, Span dest, int public static void Idct16x1638Add(ReadOnlySpan input, Span dest, int stride) { int i, j; - Span output = stackalloc int[16 * 16]; + Span output = [16 * 16]; Span outptr = output; - Span tempIn = stackalloc int[16]; - Span tempOut = stackalloc int[16]; + Span tempIn = [16]; + Span tempOut = [16]; output.Clear(); @@ -927,10 +927,10 @@ public static void Idct16x1638Add(ReadOnlySpan input, Span dest, int public static void Idct16x1610Add(ReadOnlySpan input, Span dest, int stride) { int i, j; - Span output = stackalloc int[16 * 16]; + Span output = [16 * 16]; Span outptr = output; - Span tempIn = stackalloc int[16]; - Span tempOut = stackalloc int[16]; + Span tempIn = [16]; + Span tempOut = [16]; output.Clear(); @@ -981,8 +981,8 @@ public static void Idct16x161Add(ReadOnlySpan input, Span dest, int s [SkipLocalsInit] public static void Idct32(ReadOnlySpan input, Span output) { - Span step1 = stackalloc short[32]; - Span step2 = stackalloc short[32]; + Span step1 = [32]; + Span step2 = [32]; long temp1, temp2; // stage 1 @@ -1352,10 +1352,10 @@ public static void Idct32(ReadOnlySpan input, Span output) public static void Idct32x321024Add(ReadOnlySpan input, Span dest, int stride) { int i, j; - Span output = stackalloc int[32 * 32]; + Span output = [32 * 32]; Span outptr = output; - Span tempIn = stackalloc int[32]; - Span tempOut = stackalloc int[32]; + Span tempIn = [32]; + Span tempOut = [32]; // Rows for (i = 0; i < 32; ++i) @@ -1399,10 +1399,10 @@ public static void Idct32x321024Add(ReadOnlySpan input, Span dest, in public static void Idct32x32135Add(ReadOnlySpan input, Span dest, int stride) { int i, j; - Span output = stackalloc int[32 * 32]; + Span output = [32 * 32]; Span outptr = output; - Span tempIn = stackalloc int[32]; - Span tempOut = stackalloc int[32]; + Span tempIn = [32]; + Span tempOut = [32]; output.Clear(); @@ -1435,10 +1435,10 @@ public static void Idct32x32135Add(ReadOnlySpan input, Span dest, int public static void Idct32x3234Add(ReadOnlySpan input, Span dest, int stride) { int i, j; - Span output = stackalloc int[32 * 32]; + Span output = [32 * 32]; Span outptr = output; - Span tempIn = stackalloc int[32]; - Span tempOut = stackalloc int[32]; + Span tempIn = [32]; + Span tempOut = [32]; output.Clear(); @@ -1493,7 +1493,7 @@ public static void HighbdIwht4x416Add(ReadOnlySpan input, Span dest /* 4-point reversible, orthonormal inverse Walsh-Hadamard in 3.5 adds, 0.5 shifts per pixel. */ int i; - Span output = stackalloc int[16]; + Span output = [16]; long a1, b1, c1, d1, e1; ReadOnlySpan ip = input; Span op = output; @@ -1548,7 +1548,7 @@ public static void HighbdIwht4x41Add(ReadOnlySpan input, Span dest, { int i; long a1, e1; - Span tmp = stackalloc int[4]; + Span tmp = [4]; ReadOnlySpan ip = input; Span op = tmp; @@ -1622,7 +1622,7 @@ public static void HighbdIadst4(ReadOnlySpan input, Span output, int b [SkipLocalsInit] public static void HighbdIdct4(ReadOnlySpan input, Span output, int bd) { - Span step = stackalloc int[4]; + Span step = [4]; long temp1, temp2; if (DetectInvalidHighbdInput(input, 4) != 0) @@ -1654,10 +1654,10 @@ public static void HighbdIdct4(ReadOnlySpan input, Span output, int bd public static void HighbdIdct4x416Add(ReadOnlySpan input, Span dest, int stride, int bd) { int i, j; - Span output = stackalloc int[4 * 4]; + Span output = [4 * 4]; Span outptr = output; - Span tempIn = stackalloc int[4]; - Span tempOut = stackalloc int[4]; + Span tempIn = [4]; + Span tempOut = [4]; // Rows for (i = 0; i < 4; ++i) @@ -1791,8 +1791,8 @@ public static void HighbdIadst8(ReadOnlySpan input, Span output, int b [SkipLocalsInit] public static void HighbdIdct8(ReadOnlySpan input, Span output, int bd) { - Span step1 = stackalloc int[8]; - Span step2 = stackalloc int[8]; + Span step1 = [8]; + Span step2 = [8]; long temp1, temp2; if (DetectInvalidHighbdInput(input, 8) != 0) @@ -1849,10 +1849,10 @@ public static void HighbdIdct8(ReadOnlySpan input, Span output, int bd public static void HighbdIdct8x864Add(ReadOnlySpan input, Span dest, int stride, int bd) { int i, j; - Span output = stackalloc int[8 * 8]; + Span output = [8 * 8]; Span outptr = output; - Span tempIn = stackalloc int[8]; - Span tempOut = stackalloc int[8]; + Span tempIn = [8]; + Span tempOut = [8]; // First transform rows for (i = 0; i < 8; ++i) @@ -1882,10 +1882,10 @@ public static void HighbdIdct8x864Add(ReadOnlySpan input, Span dest public static void HighbdIdct8x812Add(ReadOnlySpan input, Span dest, int stride, int bd) { int i, j; - Span output = stackalloc int[8 * 8]; + Span output = [8 * 8]; Span outptr = output; - Span tempIn = stackalloc int[8]; - Span tempOut = stackalloc int[8]; + Span tempIn = [8]; + Span tempOut = [8]; output.Clear(); @@ -2114,8 +2114,8 @@ public static void HighbdIadst16(ReadOnlySpan input, Span output, int [SkipLocalsInit] public static void HighbdIdct16(ReadOnlySpan input, Span output, int bd) { - Span step1 = stackalloc int[16]; - Span step2 = stackalloc int[16]; + Span step1 = [16]; + Span step2 = [16]; long temp1, temp2; if (DetectInvalidHighbdInput(input, 16) != 0) @@ -2291,10 +2291,10 @@ public static void HighbdIdct16(ReadOnlySpan input, Span output, int b public static void HighbdIdct16x16256Add(ReadOnlySpan input, Span dest, int stride, int bd) { int i, j; - Span output = stackalloc int[16 * 16]; + Span output = [16 * 16]; Span outptr = output; - Span tempIn = stackalloc int[16]; - Span tempOut = stackalloc int[16]; + Span tempIn = [16]; + Span tempOut = [16]; // First transform rows for (i = 0; i < 16; ++i) @@ -2324,10 +2324,10 @@ public static void HighbdIdct16x16256Add(ReadOnlySpan input, Span d public static void HighbdIdct16x1638Add(ReadOnlySpan input, Span dest, int stride, int bd) { int i, j; - Span output = stackalloc int[16 * 16]; + Span output = [16 * 16]; Span outptr = output; - Span tempIn = stackalloc int[16]; - Span tempOut = stackalloc int[16]; + Span tempIn = [16]; + Span tempOut = [16]; output.Clear(); @@ -2362,10 +2362,10 @@ public static void HighbdIdct16x1638Add(ReadOnlySpan input, Span de public static void HighbdIdct16x1610Add(ReadOnlySpan input, Span dest, int stride, int bd) { int i, j; - Span output = stackalloc int[16 * 16]; + Span output = [16 * 16]; Span outptr = output; - Span tempIn = stackalloc int[16]; - Span tempOut = stackalloc int[16]; + Span tempIn = [16]; + Span tempOut = [16]; output.Clear(); @@ -2416,8 +2416,8 @@ public static void HighbdIdct16x161Add(ReadOnlySpan input, Span des [SkipLocalsInit] public static void HighbdIdct32(ReadOnlySpan input, Span output, int bd) { - Span step1 = stackalloc int[32]; - Span step2 = stackalloc int[32]; + Span step1 = [32]; + Span step2 = [32]; long temp1, temp2; if (DetectInvalidHighbdInput(input, 32) != 0) @@ -2795,10 +2795,10 @@ public static void HighbdIdct32(ReadOnlySpan input, Span output, int b public static void HighbdIdct32x321024Add(ReadOnlySpan input, Span dest, int stride, int bd) { int i, j; - Span output = stackalloc int[32 * 32]; + Span output = [32 * 32]; Span outptr = output; - Span tempIn = stackalloc int[32]; - Span tempOut = stackalloc int[32]; + Span tempIn = [32]; + Span tempOut = [32]; // Rows for (i = 0; i < 32; ++i) @@ -2842,10 +2842,10 @@ public static void HighbdIdct32x321024Add(ReadOnlySpan input, Span public static void HighbdIdct32x32135Add(ReadOnlySpan input, Span dest, int stride, int bd) { int i, j; - Span output = stackalloc int[32 * 32]; + Span output = [32 * 32]; Span outptr = output; - Span tempIn = stackalloc int[32]; - Span tempOut = stackalloc int[32]; + Span tempIn = [32]; + Span tempOut = [32]; output.Clear(); @@ -2880,10 +2880,10 @@ public static void HighbdIdct32x32135Add(ReadOnlySpan input, Span d public static void HighbdIdct32x3234Add(ReadOnlySpan input, Span dest, int stride, int bd) { int i, j; - Span output = stackalloc int[32 * 32]; + Span output = [32 * 32]; Span outptr = output; - Span tempIn = stackalloc int[32]; - Span tempOut = stackalloc int[32]; + Span tempIn = [32]; + Span tempOut = [32]; output.Clear(); diff --git a/src/Ryujinx.Graphics.Nvdec.Vp9/Idct.cs b/src/Ryujinx.Graphics.Nvdec.Vp9/Idct.cs index e75398f269..08d0f678c0 100644 --- a/src/Ryujinx.Graphics.Nvdec.Vp9/Idct.cs +++ b/src/Ryujinx.Graphics.Nvdec.Vp9/Idct.cs @@ -42,10 +42,10 @@ public HighbdTransform2D(HighbdTransform1D cols, HighbdTransform1D rows) public static void Iht4x416Add(ReadOnlySpan input, Span dest, int stride, int txType) { int i, j; - Span output = stackalloc int[4 * 4]; + Span output = [4 * 4]; Span outptr = output; - Span tempIn = stackalloc int[4]; - Span tempOut = stackalloc int[4]; + Span tempIn = [4]; + Span tempOut = [4]; // Inverse transform row vectors for (i = 0; i < 4; ++i) @@ -81,10 +81,10 @@ public static void Iht4x416Add(ReadOnlySpan input, Span dest, int str public static void Iht8x864Add(ReadOnlySpan input, Span dest, int stride, int txType) { int i, j; - Span output = stackalloc int[8 * 8]; + Span output = [8 * 8]; Span outptr = output; - Span tempIn = stackalloc int[8]; - Span tempOut = stackalloc int[8]; + Span tempIn = [8]; + Span tempOut = [8]; Transform2D ht = _iht8[txType]; // Inverse transform row vectors @@ -121,10 +121,10 @@ public static void Iht8x864Add(ReadOnlySpan input, Span dest, int str public static void Iht16x16256Add(ReadOnlySpan input, Span dest, int stride, int txType) { int i, j; - Span output = stackalloc int[16 * 16]; + Span output = [16 * 16]; Span outptr = output; - Span tempIn = stackalloc int[16]; - Span tempOut = stackalloc int[16]; + Span tempIn = [16]; + Span tempOut = [16]; Transform2D ht = _iht16[txType]; // Rows @@ -290,10 +290,10 @@ public static void Iht16x16Add(TxType txType, ReadOnlySpan input, Span input, Span dest, int stride, int txType, int bd) { int i, j; - Span output = stackalloc int[4 * 4]; + Span output = [4 * 4]; Span outptr = output; - Span tempIn = stackalloc int[4]; - Span tempOut = stackalloc int[4]; + Span tempIn = [4]; + Span tempOut = [4]; // Inverse transform row vectors. for (i = 0; i < 4; ++i) @@ -329,10 +329,10 @@ public static void HighbdIht4x416Add(ReadOnlySpan input, Span dest, public static void HighbdIht8x864Add(ReadOnlySpan input, Span dest, int stride, int txType, int bd) { int i, j; - Span output = stackalloc int[8 * 8]; + Span output = [8 * 8]; Span outptr = output; - Span tempIn = stackalloc int[8]; - Span tempOut = stackalloc int[8]; + Span tempIn = [8]; + Span tempOut = [8]; HighbdTransform2D ht = _highIht8[txType]; // Inverse transform row vectors. @@ -369,10 +369,10 @@ public static void HighbdIht8x864Add(ReadOnlySpan input, Span dest, public static void HighbdIht16x16256Add(ReadOnlySpan input, Span dest, int stride, int txType, int bd) { int i, j; - Span output = stackalloc int[16 * 16]; + Span output = [16 * 16]; Span outptr = output; - Span tempIn = stackalloc int[16]; - Span tempOut = stackalloc int[16]; + Span tempIn = [16]; + Span tempOut = [16]; HighbdTransform2D ht = _highIht16[txType]; // Rows diff --git a/src/Ryujinx.Graphics.OpenGL/Pipeline.cs b/src/Ryujinx.Graphics.OpenGL/Pipeline.cs index d51e0e9ef1..656bc0a739 100644 --- a/src/Ryujinx.Graphics.OpenGL/Pipeline.cs +++ b/src/Ryujinx.Graphics.OpenGL/Pipeline.cs @@ -1199,7 +1199,7 @@ public void SetScissors(ReadOnlySpan> regions) { int count = Math.Min(regions.Length, Constants.MaxViewports); - Span v = stackalloc int[count * 4]; + Span v = [count * 4]; for (int index = 0; index < count; index++) { diff --git a/src/Ryujinx.Graphics.Texture/Astc/AstcDecoder.cs b/src/Ryujinx.Graphics.Texture/Astc/AstcDecoder.cs index d6974596df..d07388bee3 100644 --- a/src/Ryujinx.Graphics.Texture/Astc/AstcDecoder.cs +++ b/src/Ryujinx.Graphics.Texture/Astc/AstcDecoder.cs @@ -119,7 +119,7 @@ public void ProcessBlock(int index) { Buffer16 inputBlock = MemoryMarshal.Cast(InputBuffer.Span)[index]; - Span decompressedData = stackalloc int[144]; + Span decompressedData = [144]; try { @@ -356,7 +356,7 @@ public static bool DecompressBlock( int planeIndices; int partitionIndex; - Span colorEndpointMode = stackalloc uint[4]; + Span colorEndpointMode = [4]; BitStream128 colorEndpointStream = new(); @@ -443,7 +443,7 @@ public static bool DecompressBlock( tempColorEndpointMode >>= 1; } - Span m = stackalloc byte[4]; + Span m = [4]; for (int i = 0; i < numberPartitions; i++) { @@ -483,7 +483,7 @@ public static bool DecompressBlock( Debug.Assert(bitStream.BitsLeft == texelParams.GetPackedBitSize()); // Decode both color data and texel weight data - Span colorValues = stackalloc int[32]; // Four values * two endpoints * four maximum partitions + Span colorValues = [32]; // Four values * two endpoints * four maximum partitions DecodeColorValues(colorValues, ref colorEndpointStream, colorEndpointMode, numberPartitions, colorDataBits); EndPointSet endPoints; diff --git a/src/Ryujinx.Graphics.Texture/Astc/IntegerEncoded.cs b/src/Ryujinx.Graphics.Texture/Astc/IntegerEncoded.cs index dc82aad1cc..f1451b5901 100644 --- a/src/Ryujinx.Graphics.Texture/Astc/IntegerEncoded.cs +++ b/src/Ryujinx.Graphics.Texture/Astc/IntegerEncoded.cs @@ -98,7 +98,7 @@ public static void DecodeTritBlock( int numberBitsPerValue) { // Implement the algorithm in section C.2.12 - Span m = stackalloc int[5]; + Span m = [5]; m[0] = bitStream.ReadBits(numberBitsPerValue); int encoded = bitStream.ReadBits(2); @@ -132,7 +132,7 @@ public static void DecodeQuintBlock( ReadOnlySpan interleavedBits = [3, 2, 2]; // Implement the algorithm in section C.2.12 - Span m = stackalloc int[3]; + Span m = [3]; ulong encoded = 0; int encodedBitsRead = 0; diff --git a/src/Ryujinx.Graphics.Texture/BC7Decoder.cs b/src/Ryujinx.Graphics.Texture/BC7Decoder.cs index d8c6c1edc2..31f1909ce1 100644 --- a/src/Ryujinx.Graphics.Texture/BC7Decoder.cs +++ b/src/Ryujinx.Graphics.Texture/BC7Decoder.cs @@ -116,7 +116,7 @@ private static void DecodeBlock(Block block, Span output, int w, int h, in byte[] partitionTable = BC67Tables.PartitionTable[modeInfo.SubsetCount - 1][partition]; byte[] fixUpTable = BC67Tables.FixUpIndices[modeInfo.SubsetCount - 1][partition]; - Span colorIndices = stackalloc byte[16]; + Span colorIndices = [16]; for (int i = 0; i < 16; i++) { @@ -127,7 +127,7 @@ private static void DecodeBlock(Block block, Span output, int w, int h, in Debug.Assert(colorIndices[i] < 16); } - Span alphaIndices = stackalloc byte[16]; + Span alphaIndices = [16]; if (modeInfo.AlphaIndexBitCount != 0) { diff --git a/src/Ryujinx.Graphics.Texture/BCnDecoder.cs b/src/Ryujinx.Graphics.Texture/BCnDecoder.cs index d7b1f0fa9d..d90d988b96 100644 --- a/src/Ryujinx.Graphics.Texture/BCnDecoder.cs +++ b/src/Ryujinx.Graphics.Texture/BCnDecoder.cs @@ -24,7 +24,7 @@ public static MemoryOwner DecodeBC1(ReadOnlySpan data, int width, in MemoryOwner output = MemoryOwner.Rent(size); - Span tile = stackalloc byte[BlockWidth * BlockHeight * 4]; + Span tile = [BlockWidth * BlockHeight * 4]; Span tileAsUint = MemoryMarshal.Cast(tile); Span outputAsUint = MemoryMarshal.Cast(output.Span); @@ -112,7 +112,7 @@ public static MemoryOwner DecodeBC2(ReadOnlySpan data, int width, in MemoryOwner output = MemoryOwner.Rent(size); - Span tile = stackalloc byte[BlockWidth * BlockHeight * 4]; + Span tile = [BlockWidth * BlockHeight * 4]; Span tileAsUint = MemoryMarshal.Cast(tile); Span outputAsUint = MemoryMarshal.Cast(output.Span); @@ -207,8 +207,8 @@ public static MemoryOwner DecodeBC3(ReadOnlySpan data, int width, in MemoryOwner output = MemoryOwner.Rent(size); - Span tile = stackalloc byte[BlockWidth * BlockHeight * 4]; - Span rPal = stackalloc byte[8]; + Span tile = [BlockWidth * BlockHeight * 4]; + Span rPal = [8]; Span tileAsUint = MemoryMarshal.Cast(tile); Span outputAsUint = MemoryMarshal.Cast(output.Span); @@ -310,8 +310,8 @@ public static MemoryOwner DecodeBC4(ReadOnlySpan data, int width, in ReadOnlySpan data64 = MemoryMarshal.Cast(data); - Span tile = stackalloc byte[BlockWidth * BlockHeight]; - Span rPal = stackalloc byte[8]; + Span tile = [BlockWidth * BlockHeight]; + Span rPal = [8]; Span tileAsUint = MemoryMarshal.Cast(tile); @@ -417,10 +417,10 @@ public static MemoryOwner DecodeBC5(ReadOnlySpan data, int width, in ReadOnlySpan data64 = MemoryMarshal.Cast(data); - Span rTile = stackalloc byte[BlockWidth * BlockHeight * 2]; - Span gTile = stackalloc byte[BlockWidth * BlockHeight * 2]; - Span rPal = stackalloc byte[8]; - Span gPal = stackalloc byte[8]; + Span rTile = [BlockWidth * BlockHeight * 2]; + Span gTile = [BlockWidth * BlockHeight * 2]; + Span rPal = [8]; + Span gPal = [8]; Span outputAsUshort = MemoryMarshal.Cast(output.Span); @@ -748,7 +748,7 @@ private unsafe static void BCnDecodeTileAlphaRgba(Span output, Span private unsafe static void BC1DecodeTileRgb(Span output, ReadOnlySpan input) { - Span clut = stackalloc uint[4]; + Span clut = [4]; uint c0c1 = BinaryPrimitives.ReadUInt32LittleEndian(input); uint c0 = (ushort)c0c1; @@ -764,7 +764,7 @@ private unsafe static void BC1DecodeTileRgb(Span output, ReadOnlySpan output, ReadOnlySpan input) { - Span clut = stackalloc uint[4]; + Span clut = [4]; uint c0c1 = BinaryPrimitives.ReadUInt32LittleEndian(input); uint c0 = (ushort)c0c1; diff --git a/src/Ryujinx.Graphics.Texture/ETC2Decoder.cs b/src/Ryujinx.Graphics.Texture/ETC2Decoder.cs index 8928850239..72c7a9ffaf 100644 --- a/src/Ryujinx.Graphics.Texture/ETC2Decoder.cs +++ b/src/Ryujinx.Graphics.Texture/ETC2Decoder.cs @@ -59,7 +59,7 @@ public static MemoryOwner DecodeRgb(ReadOnlySpan data, int width, in MemoryOwner output = MemoryOwner.Rent(CalculateOutputSize(width, height, depth, levels, layers)); Span outputUint = MemoryMarshal.Cast(output.Span); - Span tile = stackalloc uint[BlockWidth * BlockHeight]; + Span tile = [BlockWidth * BlockHeight]; int imageBaseOOffs = 0; @@ -121,7 +121,7 @@ public static MemoryOwner DecodePta(ReadOnlySpan data, int width, in MemoryOwner output = MemoryOwner.Rent(CalculateOutputSize(width, height, depth, levels, layers)); Span outputUint = MemoryMarshal.Cast(output.Span); - Span tile = stackalloc uint[BlockWidth * BlockHeight]; + Span tile = [BlockWidth * BlockHeight]; int imageBaseOOffs = 0; @@ -178,7 +178,7 @@ public static MemoryOwner DecodeRgba(ReadOnlySpan data, int width, i MemoryOwner output = MemoryOwner.Rent(CalculateOutputSize(width, height, depth, levels, layers)); Span outputUint = MemoryMarshal.Cast(output.Span); - Span tile = stackalloc uint[BlockWidth * BlockHeight]; + Span tile = [BlockWidth * BlockHeight]; int imageBaseOOffs = 0; diff --git a/src/Ryujinx.Graphics.Texture/Encoders/BC7Encoder.cs b/src/Ryujinx.Graphics.Texture/Encoders/BC7Encoder.cs index c4554e358f..b453674140 100644 --- a/src/Ryujinx.Graphics.Texture/Encoders/BC7Encoder.cs +++ b/src/Ryujinx.Graphics.Texture/Encoders/BC7Encoder.cs @@ -106,8 +106,8 @@ private static Block EncodeFast(ReadOnlySpan tile, int w, int h) { if (variance > MinColorVarianceForModeChange) { - Span uniqueRGB = stackalloc uint[16]; - Span uniqueAlpha = stackalloc uint[16]; + Span uniqueRGB = [16]; + Span uniqueAlpha = [16]; int uniqueRGBCount = 0; int uniqueAlphaCount = 0; @@ -284,7 +284,7 @@ private static Block Encode( fastMode); } - Span pBitValues = stackalloc int[pBits]; + Span pBitValues = [pBits]; for (int i = 0; i < pBits; i++) { @@ -307,8 +307,8 @@ private static Block Encode( int colorIndexCount = 1 << colorIndexBitCount; int alphaIndexCount = 1 << alphaIndexBitCount; - Span colorIndices = stackalloc byte[16]; - Span alphaIndices = stackalloc byte[16]; + Span colorIndices = [16]; + Span alphaIndices = [16]; errorSum = BC67Utils.SelectIndices( tile, @@ -894,7 +894,7 @@ private static (RgbaColor8, RgbaColor8) SelectEndPoints( RgbaColor8 bestE0 = default; RgbaColor8 bestE1 = default; - Span indices = stackalloc int[n]; + Span indices = [n]; Span colors = stackalloc RgbaColor32[n]; for (int maxIndex = numInterpolatedColorsMinus1; maxIndex >= 1; maxIndex--) diff --git a/src/Ryujinx.Graphics.Vulkan/HelperShader.cs b/src/Ryujinx.Graphics.Vulkan/HelperShader.cs index 8c69448a34..627acd3488 100644 --- a/src/Ryujinx.Graphics.Vulkan/HelperShader.cs +++ b/src/Ryujinx.Graphics.Vulkan/HelperShader.cs @@ -990,7 +990,7 @@ public void CopyIncompatibleFormats( { const int ParamsBufferSize = 4; - Span shaderParams = stackalloc int[ParamsBufferSize / sizeof(int)]; + Span shaderParams = [ParamsBufferSize / sizeof(int)]; int srcBpp = src.Info.BytesPerPixel; int dstBpp = dst.Info.BytesPerPixel; @@ -1079,7 +1079,7 @@ public void CopyMSToNonMS(VulkanRenderer gd, CommandBufferScoped cbs, TextureVie { const int ParamsBufferSize = 16; - Span shaderParams = stackalloc int[ParamsBufferSize / sizeof(int)]; + Span shaderParams = [ParamsBufferSize / sizeof(int)]; int samples = src.Info.Samples; bool isDepthOrStencil = src.Info.Format.IsDepthOrStencil(); @@ -1205,7 +1205,7 @@ public void CopyNonMSToMS(VulkanRenderer gd, CommandBufferScoped cbs, TextureVie { const int ParamsBufferSize = 16; - Span shaderParams = stackalloc int[ParamsBufferSize / sizeof(int)]; + Span shaderParams = [ParamsBufferSize / sizeof(int)]; int samples = dst.Info.Samples; bool isDepthOrStencil = src.Info.Format.IsDepthOrStencil(); @@ -1537,7 +1537,7 @@ public void ConvertIndexBufferIndirect( const int ParamsIndirectDispatchOffset = 16 * sizeof(int); const int ParamsIndirectDispatchSize = 3 * sizeof(int); - Span shaderParams = stackalloc int[ParamsBufferSize / sizeof(int)]; + Span shaderParams = [ParamsBufferSize / sizeof(int)]; shaderParams[8] = pattern.PrimitiveVertices; shaderParams[9] = pattern.PrimitiveVerticesOut; diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs index 810da19346..75dfe74fc1 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs @@ -1160,7 +1160,7 @@ public void SetVertexAttribs(ReadOnlySpan vertexAttribs) { var formatCapabilities = Gd.FormatCapabilities; - Span newVbScalarSizes = stackalloc int[Constants.MaxVertexBuffers]; + Span newVbScalarSizes = [Constants.MaxVertexBuffers]; int count = Math.Min(Constants.MaxVertexAttributes, vertexAttribs.Length); uint dirtyVbSizes = 0; diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs b/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs index 8a895f9273..2a4b7ff9ac 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs @@ -22,7 +22,7 @@ public static unsafe DisposableRenderPass ToRenderPass(this ProgramPipelineState AttachmentReference* attachmentReferences = stackalloc AttachmentReference[MaxAttachments]; - Span attachmentIndices = stackalloc int[MaxAttachments]; + Span attachmentIndices = [MaxAttachments]; Span attachmentFormats = stackalloc Format[MaxAttachments]; int attachmentCount = 0; @@ -221,7 +221,7 @@ public static PipelineState ToVulkanPipelineState(this ProgramPipelineState stat int vaCount = Math.Min(Constants.MaxVertexAttributes, state.VertexAttribCount); int vbCount = Math.Min(Constants.MaxVertexBuffers, state.VertexBufferCount); - Span vbScalarSizes = stackalloc int[vbCount]; + Span vbScalarSizes = [vbCount]; for (int i = 0; i < vaCount; i++) { diff --git a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/Proxy/LdnProxyUdpServer.cs b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/Proxy/LdnProxyUdpServer.cs index 16d0f23d55..f32164a32d 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/Proxy/LdnProxyUdpServer.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/Proxy/LdnProxyUdpServer.cs @@ -84,7 +84,7 @@ private void HandleScan(EndPoint endpoint, LanPacketType type, byte[] data) private void HandleScanResponse(NetworkInfo info) { - Span mac = stackalloc byte[8]; + Span mac = [8]; info.Common.MacAddress.AsSpan().CopyTo(mac); diff --git a/src/Ryujinx.HLE/HOS/Services/ServerBase.cs b/src/Ryujinx.HLE/HOS/Services/ServerBase.cs index b02f7c62f8..85c150c830 100644 --- a/src/Ryujinx.HLE/HOS/Services/ServerBase.cs +++ b/src/Ryujinx.HLE/HOS/Services/ServerBase.cs @@ -492,7 +492,7 @@ private void FillHipcResponse(IpcMessage response, long result) private void FillHipcResponse(IpcMessage response, long result, int value) { - Span span = stackalloc byte[sizeof(int)]; + Span span = [sizeof(int)]; BinaryPrimitives.WriteInt32LittleEndian(span, value); FillHipcResponse(response, result, span); } diff --git a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Parcel.cs b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Parcel.cs index 25c89baece..f8a34adab1 100644 --- a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Parcel.cs +++ b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Parcel.cs @@ -135,7 +135,7 @@ public void WriteObject(T obj, string serviceName) where T : IBinder // TODO: figure out what this value is - Span fourBytes = stackalloc byte[4]; + Span fourBytes = [4]; WriteInplaceObject(fourBytes); } diff --git a/src/Ryujinx.Horizon/Sdk/Arp/ArpApi.cs b/src/Ryujinx.Horizon/Sdk/Arp/ArpApi.cs index b11318fe5a..df9f5a5807 100644 --- a/src/Ryujinx.Horizon/Sdk/Arp/ArpApi.cs +++ b/src/Ryujinx.Horizon/Sdk/Arp/ArpApi.cs @@ -34,7 +34,7 @@ private void InitializeArpRService() public Result GetApplicationInstanceId(out ulong applicationInstanceId, ulong applicationPid) { - Span data = stackalloc byte[8]; + Span data = [8]; SpanWriter writer = new(data); writer.Write(applicationPid); @@ -60,7 +60,7 @@ public Result GetApplicationLaunchProperty(out ApplicationLaunchProperty applica { applicationLaunchProperty = default; - Span data = stackalloc byte[8]; + Span data = [8]; SpanWriter writer = new(data); writer.Write(applicationInstanceId); @@ -84,7 +84,7 @@ public Result GetApplicationControlProperty(out ApplicationControlProperty appli { applicationControlProperty = default; - Span data = stackalloc byte[8]; + Span data = [8]; SpanWriter writer = new(data); writer.Write(applicationInstanceId); diff --git a/src/Ryujinx.Horizon/Sdk/Ngc/Detail/ProfanityFilter.cs b/src/Ryujinx.Horizon/Sdk/Ngc/Detail/ProfanityFilter.cs index 836f19b9af..f29fb58393 100644 --- a/src/Ryujinx.Horizon/Sdk/Ngc/Detail/ProfanityFilter.cs +++ b/src/Ryujinx.Horizon/Sdk/Ngc/Detail/ProfanityFilter.cs @@ -42,7 +42,7 @@ public override Result GetContentVersion(out uint version) return Result.Success; } - Span data = stackalloc byte[4]; + Span data = [4]; result = _contentsReader.GetVersionData(data); if (result.IsFailure) { diff --git a/src/Ryujinx.Horizon/Sdk/OsTypes/Impl/MultiWaitImpl.cs b/src/Ryujinx.Horizon/Sdk/OsTypes/Impl/MultiWaitImpl.cs index 2fbcfdc88a..3f826569d4 100644 --- a/src/Ryujinx.Horizon/Sdk/OsTypes/Impl/MultiWaitImpl.cs +++ b/src/Ryujinx.Horizon/Sdk/OsTypes/Impl/MultiWaitImpl.cs @@ -76,7 +76,7 @@ public MultiWaitHolderBase WaitAnyImpl(bool infinite, long timeout) private MultiWaitHolderBase WaitAnyHandleImpl(bool infinite, long timeout) { - Span objectHandles = new int[64]; + Span objectHandles = [64]; Span objects = new MultiWaitHolderBase[64]; diff --git a/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcManager.cs b/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcManager.cs index 4f0bbb0146..2c565e4c03 100644 --- a/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcManager.cs +++ b/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcManager.cs @@ -30,7 +30,7 @@ public Result ConvertCurrentObjectToDomain(out int objectId) try { - Span objectIds = stackalloc int[1]; + Span objectIds = [1]; Result result = domain.ReserveIds(objectIds); diff --git a/src/Ryujinx.Horizon/Sdk/Sm/SmApi.cs b/src/Ryujinx.Horizon/Sdk/Sm/SmApi.cs index a63a03a5c8..dc93e96a5c 100644 --- a/src/Ryujinx.Horizon/Sdk/Sm/SmApi.cs +++ b/src/Ryujinx.Horizon/Sdk/Sm/SmApi.cs @@ -33,7 +33,7 @@ public Result Initialize() private Result RegisterClient() { - Span data = stackalloc byte[8]; + Span data = [8]; SpanWriter writer = new(data); @@ -44,7 +44,7 @@ private Result RegisterClient() public Result GetServiceHandle(out int handle, ServiceName name) { - Span data = stackalloc byte[8]; + Span data = [8]; SpanWriter writer = new(data); @@ -66,7 +66,7 @@ public Result GetServiceHandle(out int handle, ServiceName name) public Result RegisterService(out int handle, ServiceName name, int maxSessions, bool isLight) { - Span data = stackalloc byte[16]; + Span data = [16]; SpanWriter writer = new(data); @@ -90,7 +90,7 @@ public Result RegisterService(out int handle, ServiceName name, int maxSessions, public Result UnregisterService(ServiceName name) { - Span data = stackalloc byte[8]; + Span data = [8]; SpanWriter writer = new(data); @@ -101,7 +101,7 @@ public Result UnregisterService(ServiceName name) public Result DetachClient() { - Span data = stackalloc byte[8]; + Span data = [8]; SpanWriter writer = new(data);