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/TextureCreateInfo.cs | 79 ++++++++++++++++----------- 1 file changed, 47 insertions(+), 32 deletions(-) (limited to 'src/Ryujinx.Graphics.GAL/TextureCreateInfo.cs') diff --git a/src/Ryujinx.Graphics.GAL/TextureCreateInfo.cs b/src/Ryujinx.Graphics.GAL/TextureCreateInfo.cs index 52b3b11f..44090291 100644 --- a/src/Ryujinx.Graphics.GAL/TextureCreateInfo.cs +++ b/src/Ryujinx.Graphics.GAL/TextureCreateInfo.cs @@ -6,13 +6,13 @@ namespace Ryujinx.Graphics.GAL { public readonly struct TextureCreateInfo : IEquatable { - public int Width { get; } - public int Height { get; } - public int Depth { get; } - public int Levels { get; } - public int Samples { get; } - public int BlockWidth { get; } - public int BlockHeight { get; } + public int Width { get; } + public int Height { get; } + public int Depth { get; } + public int Levels { get; } + public int Samples { get; } + public int BlockWidth { get; } + public int BlockHeight { get; } public int BytesPerPixel { get; } public bool IsCompressed => (BlockWidth | BlockHeight) != 1; @@ -29,37 +29,37 @@ namespace Ryujinx.Graphics.GAL public SwizzleComponent SwizzleA { get; } public TextureCreateInfo( - int width, - int height, - int depth, - int levels, - int samples, - int blockWidth, - int blockHeight, - int bytesPerPixel, - Format format, + int width, + int height, + int depth, + int levels, + int samples, + int blockWidth, + int blockHeight, + int bytesPerPixel, + Format format, DepthStencilMode depthStencilMode, - Target target, + Target target, SwizzleComponent swizzleR, SwizzleComponent swizzleG, SwizzleComponent swizzleB, SwizzleComponent swizzleA) { - Width = width; - Height = height; - Depth = depth; - Levels = levels; - Samples = samples; - BlockWidth = blockWidth; - BlockHeight = blockHeight; - BytesPerPixel = bytesPerPixel; - Format = format; + Width = width; + Height = height; + Depth = depth; + Levels = levels; + Samples = samples; + BlockWidth = blockWidth; + BlockHeight = blockHeight; + BytesPerPixel = bytesPerPixel; + Format = format; DepthStencilMode = depthStencilMode; - Target = target; - SwizzleR = swizzleR; - SwizzleG = swizzleG; - SwizzleB = swizzleB; - SwizzleA = swizzleA; + Target = target; + SwizzleR = swizzleR; + SwizzleG = swizzleG; + SwizzleB = swizzleB; + SwizzleA = swizzleA; } public int GetMipSize(int level) @@ -142,7 +142,7 @@ namespace Ryujinx.Graphics.GAL return HashCode.Combine(Width, Height); } - bool IEquatable.Equals(TextureCreateInfo other) + public bool Equals(TextureCreateInfo other) { return Width == other.Width && Height == other.Height && @@ -160,5 +160,20 @@ namespace Ryujinx.Graphics.GAL SwizzleB == other.SwizzleB && SwizzleA == other.SwizzleA; } + + public override bool Equals(object obj) + { + return obj is TextureCreateInfo info && this.Equals(info); + } + + public static bool operator ==(TextureCreateInfo left, TextureCreateInfo right) + { + return left.Equals(right); + } + + public static bool operator !=(TextureCreateInfo left, TextureCreateInfo right) + { + return !(left == right); + } } } -- cgit v1.2.3