diff options
| author | TSRBerry <20988865+TSRBerry@users.noreply.github.com> | 2023-07-02 02:47:54 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-02 02:47:54 +0200 |
| commit | 3b46bb73f781a011705ecbc8a1d3207dfb145829 (patch) | |
| tree | 1d5d2714c7001775b512bc14ce91a1ebbfc808df /src/Ryujinx.Graphics.Gpu/Engine/Types | |
| parent | 2457cfc9118a6ebb6008945c919edfd8b46af5e7 (diff) | |
[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
Diffstat (limited to 'src/Ryujinx.Graphics.Gpu/Engine/Types')
8 files changed, 86 insertions, 78 deletions
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Types/Boolean32.cs b/src/Ryujinx.Graphics.Gpu/Engine/Types/Boolean32.cs index c982347a..911ad53b 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Types/Boolean32.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Types/Boolean32.cs @@ -3,10 +3,10 @@ /// <summary> /// Boolean value, stored as a 32-bits integer in memory. /// </summary> - struct Boolean32 + readonly struct Boolean32 { -#pragma warning disable CS0649 - private uint _value; +#pragma warning disable CS0649 // Field is never assigned to + private readonly uint _value; #pragma warning restore CS0649 public static implicit operator bool(Boolean32 value) diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Types/ColorFormat.cs b/src/Ryujinx.Graphics.Gpu/Engine/Types/ColorFormat.cs index 889b5c8b..c798384f 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Types/ColorFormat.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Types/ColorFormat.cs @@ -9,58 +9,58 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types enum ColorFormat { R32G32B32A32Float = 0xc0, - R32G32B32A32Sint = 0xc1, - R32G32B32A32Uint = 0xc2, + R32G32B32A32Sint = 0xc1, + R32G32B32A32Uint = 0xc2, R32G32B32X32Float = 0xc3, - R32G32B32X32Sint = 0xc4, - R32G32B32X32Uint = 0xc5, + R32G32B32X32Sint = 0xc4, + R32G32B32X32Uint = 0xc5, R16G16B16X16Unorm = 0xc6, R16G16B16X16Snorm = 0xc7, - R16G16B16X16Sint = 0xc8, - R16G16B16X16Uint = 0xc9, + R16G16B16X16Sint = 0xc8, + R16G16B16X16Uint = 0xc9, R16G16B16A16Float = 0xca, - R32G32Float = 0xcb, - R32G32Sint = 0xcc, - R32G32Uint = 0xcd, + R32G32Float = 0xcb, + R32G32Sint = 0xcc, + R32G32Uint = 0xcd, R16G16B16X16Float = 0xce, - B8G8R8A8Unorm = 0xcf, - B8G8R8A8Srgb = 0xd0, - R10G10B10A2Unorm = 0xd1, - R10G10B10A2Uint = 0xd2, - R8G8B8A8Unorm = 0xd5, - R8G8B8A8Srgb = 0xd6, - R8G8B8X8Snorm = 0xd7, - R8G8B8X8Sint = 0xd8, - R8G8B8X8Uint = 0xd9, - R16G16Unorm = 0xda, - R16G16Snorm = 0xdb, - R16G16Sint = 0xdc, - R16G16Uint = 0xdd, - R16G16Float = 0xde, - R11G11B10Float = 0xe0, - R32Sint = 0xe3, - R32Uint = 0xe4, - R32Float = 0xe5, - B8G8R8X8Unorm = 0xe6, - B8G8R8X8Srgb = 0xe7, - B5G6R5Unorm = 0xe8, - B5G5R5A1Unorm = 0xe9, - R8G8Unorm = 0xea, - R8G8Snorm = 0xeb, - R8G8Sint = 0xec, - R8G8Uint = 0xed, - R16Unorm = 0xee, - R16Snorm = 0xef, - R16Sint = 0xf0, - R16Uint = 0xf1, - R16Float = 0xf2, - R8Unorm = 0xf3, - R8Snorm = 0xf4, - R8Sint = 0xf5, - R8Uint = 0xf6, - B5G5R5X1Unorm = 0xf8, - R8G8B8X8Unorm = 0xf9, - R8G8B8X8Srgb = 0xfa + B8G8R8A8Unorm = 0xcf, + B8G8R8A8Srgb = 0xd0, + R10G10B10A2Unorm = 0xd1, + R10G10B10A2Uint = 0xd2, + R8G8B8A8Unorm = 0xd5, + R8G8B8A8Srgb = 0xd6, + R8G8B8X8Snorm = 0xd7, + R8G8B8X8Sint = 0xd8, + R8G8B8X8Uint = 0xd9, + R16G16Unorm = 0xda, + R16G16Snorm = 0xdb, + R16G16Sint = 0xdc, + R16G16Uint = 0xdd, + R16G16Float = 0xde, + R11G11B10Float = 0xe0, + R32Sint = 0xe3, + R32Uint = 0xe4, + R32Float = 0xe5, + B8G8R8X8Unorm = 0xe6, + B8G8R8X8Srgb = 0xe7, + B5G6R5Unorm = 0xe8, + B5G5R5A1Unorm = 0xe9, + R8G8Unorm = 0xea, + R8G8Snorm = 0xeb, + R8G8Sint = 0xec, + R8G8Uint = 0xed, + R16Unorm = 0xee, + R16Snorm = 0xef, + R16Sint = 0xf0, + R16Uint = 0xf1, + R16Float = 0xf2, + R8Unorm = 0xf3, + R8Snorm = 0xf4, + R8Sint = 0xf5, + R8Uint = 0xf6, + B5G5R5X1Unorm = 0xf8, + R8G8B8X8Unorm = 0xf9, + R8G8B8X8Srgb = 0xfa, } static class ColorFormatConverter @@ -74,6 +74,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types { return format switch { +#pragma warning disable IDE0055 // Disable formatting ColorFormat.R32G32B32A32Float => new FormatInfo(Format.R32G32B32A32Float, 1, 1, 16, 4), ColorFormat.R32G32B32A32Sint => new FormatInfo(Format.R32G32B32A32Sint, 1, 1, 16, 4), ColorFormat.R32G32B32A32Uint => new FormatInfo(Format.R32G32B32A32Uint, 1, 1, 16, 4), @@ -127,7 +128,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types ColorFormat.B5G5R5X1Unorm => new FormatInfo(Format.B5G5R5A1Unorm, 1, 1, 2, 4), ColorFormat.R8G8B8X8Unorm => new FormatInfo(Format.R8G8B8A8Unorm, 1, 1, 4, 4), ColorFormat.R8G8B8X8Srgb => new FormatInfo(Format.R8G8B8A8Srgb, 1, 1, 4, 4), - _ => FormatInfo.Default + _ => FormatInfo.Default, +#pragma warning restore IDE0055 }; } @@ -157,9 +159,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types case ColorFormat.R8G8B8X8Unorm: case ColorFormat.R8G8B8X8Srgb: return true; + default: + return false; } - - return false; } } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Types/GpuVa.cs b/src/Ryujinx.Graphics.Gpu/Engine/Types/GpuVa.cs index 839faac9..b3b0c41a 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Types/GpuVa.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Types/GpuVa.cs @@ -5,7 +5,7 @@ /// </summary> struct GpuVa { -#pragma warning disable CS0649 +#pragma warning disable CS0649 // Field is never assigned to public uint High; public uint Low; #pragma warning restore CS0649 @@ -14,7 +14,7 @@ /// Packs the split address into a 64-bits address value. /// </summary> /// <returns>The 64-bits address value</returns> - public ulong Pack() + public readonly ulong Pack() { return Low | ((ulong)High << 32); } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Types/MemoryLayout.cs b/src/Ryujinx.Graphics.Gpu/Engine/Types/MemoryLayout.cs index 6da96bd4..5a425373 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Types/MemoryLayout.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Types/MemoryLayout.cs @@ -5,31 +5,31 @@ /// </summary> struct MemoryLayout { -#pragma warning disable CS0649 +#pragma warning disable CS0649 // Field is never assigned to public uint Packed; #pragma warning restore CS0649 - public int UnpackGobBlocksInX() + public readonly int UnpackGobBlocksInX() { return 1 << (int)(Packed & 0xf); } - public int UnpackGobBlocksInY() + public readonly int UnpackGobBlocksInY() { return 1 << (int)((Packed >> 4) & 0xf); } - public int UnpackGobBlocksInZ() + public readonly int UnpackGobBlocksInZ() { return 1 << (int)((Packed >> 8) & 0xf); } - public bool UnpackIsLinear() + public readonly bool UnpackIsLinear() { return (Packed & 0x1000) != 0; } - public bool UnpackIsTarget3D() + public readonly bool UnpackIsTarget3D() { return (Packed & 0x10000) != 0; } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Types/PrimitiveType.cs b/src/Ryujinx.Graphics.Gpu/Engine/Types/PrimitiveType.cs index dae63124..5abbc923 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Types/PrimitiveType.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Types/PrimitiveType.cs @@ -21,7 +21,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types LineStripAdjacency, TrianglesAdjacency, TriangleStripAdjacency, - Patches + Patches, } /// <summary> @@ -39,7 +39,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types LineStripAdjacency = 11, TrianglesAdjacency = 12, TriangleStripAdjacency = 13, - Patches = 14 + Patches = 14, } static class PrimitiveTypeConverter @@ -53,6 +53,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types { return type switch { +#pragma warning disable IDE0055 // Disable formatting PrimitiveType.Points => PrimitiveTopology.Points, PrimitiveType.Lines => PrimitiveTopology.Lines, PrimitiveType.LineLoop => PrimitiveTopology.LineLoop, @@ -68,7 +69,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types PrimitiveType.TrianglesAdjacency => PrimitiveTopology.TrianglesAdjacency, PrimitiveType.TriangleStripAdjacency => PrimitiveTopology.TriangleStripAdjacency, PrimitiveType.Patches => PrimitiveTopology.Patches, - _ => PrimitiveTopology.Triangles + _ => PrimitiveTopology.Triangles, +#pragma warning restore IDE0055 }; } @@ -81,6 +83,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types { return type switch { +#pragma warning disable IDE0055 // Disable formatting PrimitiveTypeOverride.Points => PrimitiveTopology.Points, PrimitiveTypeOverride.Lines => PrimitiveTopology.Lines, PrimitiveTypeOverride.LineStrip => PrimitiveTopology.LineStrip, @@ -92,8 +95,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types PrimitiveTypeOverride.TrianglesAdjacency => PrimitiveTopology.TrianglesAdjacency, PrimitiveTypeOverride.TriangleStripAdjacency => PrimitiveTopology.TriangleStripAdjacency, PrimitiveTypeOverride.Patches => PrimitiveTopology.Patches, - _ => PrimitiveTopology.Triangles + _ => PrimitiveTopology.Triangles, +#pragma warning restore IDE0055 }; } } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Types/SamplerIndex.cs b/src/Ryujinx.Graphics.Gpu/Engine/Types/SamplerIndex.cs index 839a4d0a..22fe4a92 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Types/SamplerIndex.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Types/SamplerIndex.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types /// </summary> enum SamplerIndex { - Independently = 0, - ViaHeaderIndex = 1 + Independently = 0, + ViaHeaderIndex = 1, } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Types/SbDescriptor.cs b/src/Ryujinx.Graphics.Gpu/Engine/Types/SbDescriptor.cs index c457dbf9..e92263df 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Types/SbDescriptor.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Types/SbDescriptor.cs @@ -5,14 +5,14 @@ /// </summary> struct SbDescriptor { -#pragma warning disable CS0649 +#pragma warning disable CS0649 // Field is never assigned to public uint AddressLow; public uint AddressHigh; public int Size; public int Padding; #pragma warning restore CS0649 - public ulong PackAddress() + public readonly ulong PackAddress() { return AddressLow | ((ulong)AddressHigh << 32); } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Types/ZetaFormat.cs b/src/Ryujinx.Graphics.Gpu/Engine/Types/ZetaFormat.cs index 1de1621f..0fa073d7 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Types/ZetaFormat.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Types/ZetaFormat.cs @@ -8,13 +8,13 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types /// </summary> enum ZetaFormat { - D32Float = 0xa, - D16Unorm = 0x13, + D32Float = 0xa, + D16Unorm = 0x13, D24UnormS8Uint = 0x14, - D24Unorm = 0x15, + D24Unorm = 0x15, S8UintD24Unorm = 0x16, - S8Uint = 0x17, - D32FloatS8Uint = 0x19 + S8Uint = 0x17, + D32FloatS8Uint = 0x19, } static class ZetaFormatConverter @@ -28,6 +28,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types { return format switch { +#pragma warning disable IDE0055 // Disable formatting ZetaFormat.D32Float => new FormatInfo(Format.D32Float, 1, 1, 4, 1), ZetaFormat.D16Unorm => new FormatInfo(Format.D16Unorm, 1, 1, 2, 1), ZetaFormat.D24UnormS8Uint => new FormatInfo(Format.D24UnormS8Uint, 1, 1, 4, 2), @@ -35,7 +36,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types ZetaFormat.S8UintD24Unorm => new FormatInfo(Format.S8UintD24Unorm, 1, 1, 4, 2), ZetaFormat.S8Uint => new FormatInfo(Format.S8Uint, 1, 1, 1, 1), ZetaFormat.D32FloatS8Uint => new FormatInfo(Format.D32FloatS8Uint, 1, 1, 8, 2), - _ => FormatInfo.Default + _ => FormatInfo.Default, +#pragma warning restore IDE0055 }; } } |
