mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-08-01 02:30:08 -06:00
[Ryujinx.Graphics.Gpu] Address dotnet-format issues (#5367)
* dotnet format style --severity info Some changes were manually reverted. * dotnet format analyzers --serverity info Some changes have been minimally adapted. * Restore a few unused methods and variables * Silence dotnet format IDE0060 warnings * Silence dotnet format IDE0052 warnings * Address dotnet format CA1816 warnings * Address or silence dotnet format CA1069 warnings * Address or silence dotnet format CA2211 warnings * Address remaining dotnet format analyzer warnings * Address review comments * Address most dotnet format whitespace warnings * Apply dotnet format whitespace formatting A few of them have been manually reverted and the corresponding warning was silenced * Format if-blocks correctly * Run dotnet format whitespace after rebase * Run dotnet format style after rebase * Another rebase, another dotnet format run * Run dotnet format style after rebase * Run dotnet format after rebase and remove unused usings - analyzers - style - whitespace * Disable 'prefer switch expression' rule * Add comments to disabled warnings * Remove a few unused parameters * Replace MmeShadowScratch with Array256<uint> * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Start working on disabled warnings * Fix and silence a few dotnet-format warnings again * Run dotnet format after rebase * Address IDE0251 warnings * Silence IDE0060 in .editorconfig * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * First pass of dotnet format * Add unsafe dotnet format changes * Fix typos * Add trailing commas * Disable formatting for FormatTable * Address review feedback
This commit is contained in:
@ -30,13 +30,13 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
|
||||
SrcLinear = 1 << 7,
|
||||
DstLinear = 1 << 8,
|
||||
MultiLineEnable = 1 << 9,
|
||||
RemapEnable = 1 << 10
|
||||
RemapEnable = 1 << 10,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Texture parameters for copy.
|
||||
/// </summary>
|
||||
private struct TextureParams
|
||||
private readonly struct TextureParams
|
||||
{
|
||||
/// <summary>
|
||||
/// Copy region X coordinate.
|
||||
@ -109,7 +109,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
|
||||
_3dEngine = threedEngine;
|
||||
_state = new DeviceState<DmaClassState>(new Dictionary<string, RwCallback>
|
||||
{
|
||||
{ nameof(DmaClassState.LaunchDma), new RwCallback(LaunchDma, null) }
|
||||
{ nameof(DmaClassState.LaunchDma), new RwCallback(LaunchDma, null) },
|
||||
});
|
||||
}
|
||||
|
||||
@ -345,8 +345,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
|
||||
// all be rewritten to use pooled arrays, but that gets complicated with packed data and strides
|
||||
Span<byte> dstSpan = memoryManager.GetSpan(dstGpuVa + (ulong)dstBaseOffset, dstSize).ToArray();
|
||||
|
||||
TextureParams srcParams = new TextureParams(srcRegionX, srcRegionY, srcBaseOffset, srcBpp, srcLinear, srcCalculator);
|
||||
TextureParams dstParams = new TextureParams(dstRegionX, dstRegionY, dstBaseOffset, dstBpp, dstLinear, dstCalculator);
|
||||
TextureParams srcParams = new(srcRegionX, srcRegionY, srcBaseOffset, srcBpp, srcLinear, srcCalculator);
|
||||
TextureParams dstParams = new(dstRegionX, dstRegionY, dstBaseOffset, dstBpp, dstLinear, dstCalculator);
|
||||
|
||||
// If remapping is enabled, we always copy the components directly, in order.
|
||||
// If it's enabled, but the mapping is just XYZW, we also copy them in order.
|
||||
@ -363,13 +363,26 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
|
||||
|
||||
switch (srcBpp)
|
||||
{
|
||||
case 1: Copy<byte>(dstSpan, srcSpan, dstParams, srcParams); break;
|
||||
case 2: Copy<ushort>(dstSpan, srcSpan, dstParams, srcParams); break;
|
||||
case 4: Copy<uint>(dstSpan, srcSpan, dstParams, srcParams); break;
|
||||
case 8: Copy<ulong>(dstSpan, srcSpan, dstParams, srcParams); break;
|
||||
case 12: Copy<Bpp12Pixel>(dstSpan, srcSpan, dstParams, srcParams); break;
|
||||
case 16: Copy<Vector128<byte>>(dstSpan, srcSpan, dstParams, srcParams); break;
|
||||
default: throw new NotSupportedException($"Unable to copy ${srcBpp} bpp pixel format.");
|
||||
case 1:
|
||||
Copy<byte>(dstSpan, srcSpan, dstParams, srcParams);
|
||||
break;
|
||||
case 2:
|
||||
Copy<ushort>(dstSpan, srcSpan, dstParams, srcParams);
|
||||
break;
|
||||
case 4:
|
||||
Copy<uint>(dstSpan, srcSpan, dstParams, srcParams);
|
||||
break;
|
||||
case 8:
|
||||
Copy<ulong>(dstSpan, srcSpan, dstParams, srcParams);
|
||||
break;
|
||||
case 12:
|
||||
Copy<Bpp12Pixel>(dstSpan, srcSpan, dstParams, srcParams);
|
||||
break;
|
||||
case 16:
|
||||
Copy<Vector128<byte>>(dstSpan, srcSpan, dstParams, srcParams);
|
||||
break;
|
||||
default:
|
||||
throw new NotSupportedException($"Unable to copy ${srcBpp} bpp pixel format.");
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -378,11 +391,20 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
|
||||
|
||||
switch (componentSize)
|
||||
{
|
||||
case 1: CopyShuffle<byte>(dstSpan, srcSpan, dstParams, srcParams); break;
|
||||
case 2: CopyShuffle<ushort>(dstSpan, srcSpan, dstParams, srcParams); break;
|
||||
case 3: CopyShuffle<UInt24>(dstSpan, srcSpan, dstParams, srcParams); break;
|
||||
case 4: CopyShuffle<uint>(dstSpan, srcSpan, dstParams, srcParams); break;
|
||||
default: throw new NotSupportedException($"Unable to copy ${componentSize} component size.");
|
||||
case 1:
|
||||
CopyShuffle<byte>(dstSpan, srcSpan, dstParams, srcParams);
|
||||
break;
|
||||
case 2:
|
||||
CopyShuffle<ushort>(dstSpan, srcSpan, dstParams, srcParams);
|
||||
break;
|
||||
case 3:
|
||||
CopyShuffle<UInt24>(dstSpan, srcSpan, dstParams, srcParams);
|
||||
break;
|
||||
case 4:
|
||||
CopyShuffle<uint>(dstSpan, srcSpan, dstParams, srcParams);
|
||||
break;
|
||||
default:
|
||||
throw new NotSupportedException($"Unable to copy ${componentSize} component size.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -526,28 +548,28 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
|
||||
0 => _state.State.SetRemapComponentsDstX,
|
||||
1 => _state.State.SetRemapComponentsDstY,
|
||||
2 => _state.State.SetRemapComponentsDstZ,
|
||||
_ => _state.State.SetRemapComponentsDstW
|
||||
_ => _state.State.SetRemapComponentsDstW,
|
||||
};
|
||||
|
||||
switch (componentsDst)
|
||||
{
|
||||
case SetRemapComponentsDst.SrcX:
|
||||
Copy<T>(dstSpan.Slice(Unsafe.SizeOf<T>() * i), srcSpan, dst, src);
|
||||
Copy<T>(dstSpan[(Unsafe.SizeOf<T>() * i)..], srcSpan, dst, src);
|
||||
break;
|
||||
case SetRemapComponentsDst.SrcY:
|
||||
Copy<T>(dstSpan.Slice(Unsafe.SizeOf<T>() * i), srcSpan.Slice(Unsafe.SizeOf<T>()), dst, src);
|
||||
Copy<T>(dstSpan[(Unsafe.SizeOf<T>() * i)..], srcSpan[Unsafe.SizeOf<T>()..], dst, src);
|
||||
break;
|
||||
case SetRemapComponentsDst.SrcZ:
|
||||
Copy<T>(dstSpan.Slice(Unsafe.SizeOf<T>() * i), srcSpan.Slice(Unsafe.SizeOf<T>() * 2), dst, src);
|
||||
Copy<T>(dstSpan[(Unsafe.SizeOf<T>() * i)..], srcSpan[(Unsafe.SizeOf<T>() * 2)..], dst, src);
|
||||
break;
|
||||
case SetRemapComponentsDst.SrcW:
|
||||
Copy<T>(dstSpan.Slice(Unsafe.SizeOf<T>() * i), srcSpan.Slice(Unsafe.SizeOf<T>() * 3), dst, src);
|
||||
Copy<T>(dstSpan[(Unsafe.SizeOf<T>() * i)..], srcSpan[(Unsafe.SizeOf<T>() * 3)..], dst, src);
|
||||
break;
|
||||
case SetRemapComponentsDst.ConstA:
|
||||
Fill<T>(dstSpan.Slice(Unsafe.SizeOf<T>() * i), dst, Unsafe.As<uint, T>(ref _state.State.SetRemapConstA));
|
||||
Fill<T>(dstSpan[(Unsafe.SizeOf<T>() * i)..], dst, Unsafe.As<uint, T>(ref _state.State.SetRemapConstA));
|
||||
break;
|
||||
case SetRemapComponentsDst.ConstB:
|
||||
Fill<T>(dstSpan.Slice(Unsafe.SizeOf<T>() * i), dst, Unsafe.As<uint, T>(ref _state.State.SetRemapConstB));
|
||||
Fill<T>(dstSpan[(Unsafe.SizeOf<T>() * i)..], dst, Unsafe.As<uint, T>(ref _state.State.SetRemapConstB));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user