From 7c989f88bdab65dfa7783e824a180220ba829bd0 Mon Sep 17 00:00:00 2001 From: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Date: Wed, 28 Jun 2023 20:20:10 +0200 Subject: [Ryujinx.Graphics.GAL] Address dotnet-format issues (#5366) * 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 IDE0052 warnings * Address dotnet format CA1816 warnings * Address or silence dotnet format CA1069 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 * Revert formatting changes for while and for-loops * Another rebase, another dotnet format run * Run dotnet format whitespace after rebase * Run dotnet format style after rebase * Run dotnet format analyzers after rebase * Run dotnet format after rebase and remove unused usings - analyzers - style - whitespace * Disable 'prefer switch expression' rule * Add comments to disabled warnings * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Start working on disabled warnings * Address IDE0251 warnings * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * First dotnet format pass * Address review feedback * Add trailing commas * Remove SuppressMessage for IDE0066 * Make explicit Equals implementation implicit --- src/Ryujinx.Graphics.GAL/ResourceLayout.cs | 38 ++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) (limited to 'src/Ryujinx.Graphics.GAL/ResourceLayout.cs') diff --git a/src/Ryujinx.Graphics.GAL/ResourceLayout.cs b/src/Ryujinx.Graphics.GAL/ResourceLayout.cs index 3cde281f..200292ee 100644 --- a/src/Ryujinx.Graphics.GAL/ResourceLayout.cs +++ b/src/Ryujinx.Graphics.GAL/ResourceLayout.cs @@ -12,7 +12,7 @@ namespace Ryujinx.Graphics.GAL TextureAndSampler, Image, BufferTexture, - BufferImage + BufferImage, } public enum ResourceAccess : byte @@ -20,7 +20,7 @@ namespace Ryujinx.Graphics.GAL None = 0, Read = 1, Write = 2, - ReadWrite = Read | Write + ReadWrite = Read | Write, } [Flags] @@ -32,7 +32,7 @@ namespace Ryujinx.Graphics.GAL TessellationControl = 1 << 2, TessellationEvaluation = 1 << 3, Geometry = 1 << 4, - Fragment = 1 << 5 + Fragment = 1 << 5, } public readonly struct ResourceDescriptor : IEquatable @@ -64,6 +64,16 @@ namespace Ryujinx.Graphics.GAL { return Binding == other.Binding && Count == other.Count && Type == other.Type && Stages == other.Stages; } + + public static bool operator ==(ResourceDescriptor left, ResourceDescriptor right) + { + return left.Equals(right); + } + + public static bool operator !=(ResourceDescriptor left, ResourceDescriptor right) + { + return !(left == right); + } } public readonly struct ResourceUsage : IEquatable @@ -95,6 +105,16 @@ namespace Ryujinx.Graphics.GAL { return Binding == other.Binding && Type == other.Type && Stages == other.Stages && Access == other.Access; } + + public static bool operator ==(ResourceUsage left, ResourceUsage right) + { + return left.Equals(right); + } + + public static bool operator !=(ResourceUsage left, ResourceUsage right) + { + return !(left == right); + } } public readonly struct ResourceDescriptorCollection @@ -108,7 +128,7 @@ namespace Ryujinx.Graphics.GAL public override int GetHashCode() { - HashCode hasher = new HashCode(); + HashCode hasher = new(); if (Descriptors != null) { @@ -151,6 +171,16 @@ namespace Ryujinx.Graphics.GAL return true; } + + public static bool operator ==(ResourceDescriptorCollection left, ResourceDescriptorCollection right) + { + return left.Equals(right); + } + + public static bool operator !=(ResourceDescriptorCollection left, ResourceDescriptorCollection right) + { + return !(left == right); + } } public readonly struct ResourceUsageCollection -- cgit v1.2.3