From cebfa54467231f0d1ca43021608b8b1ab03f39fb Mon Sep 17 00:00:00 2001 From: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Date: Wed, 28 Jun 2023 18:46:18 +0200 Subject: [Ryujinx.Graphics.Texture] Address dotnet-format issues (#5375) * dotnet format style --severity info Some changes were manually reverted. * Restore a few unused methods and variables * Silence dotnet format IDE0060 warnings * Silence dotnet format IDE0059 warnings * Address or silence dotnet format CA2208 warnings * 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 * Add comments to disabled warnings * Simplify properties and array initialization, Use const when possible, Remove trailing commas * 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 dotnet format pass * Apply suggestions from code review Co-authored-by: Ac_K * Address review feedback * Update src/Ryujinx.Graphics.Texture/Astc/AstcDecoder.cs Co-authored-by: Ac_K --------- Co-authored-by: Ac_K --- .../Astc/IntegerEncoded.cs | 54 +++++++++++----------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'src/Ryujinx.Graphics.Texture/Astc/IntegerEncoded.cs') diff --git a/src/Ryujinx.Graphics.Texture/Astc/IntegerEncoded.cs b/src/Ryujinx.Graphics.Texture/Astc/IntegerEncoded.cs index 065de46b..56e78cc3 100644 --- a/src/Ryujinx.Graphics.Texture/Astc/IntegerEncoded.cs +++ b/src/Ryujinx.Graphics.Texture/Astc/IntegerEncoded.cs @@ -6,7 +6,7 @@ namespace Ryujinx.Graphics.Texture.Astc internal struct IntegerEncoded { internal const int StructSize = 8; - private static readonly IntegerEncoded[] Encodings; + private static readonly IntegerEncoded[] _encodings; public enum EIntegerEncoding : byte { @@ -15,7 +15,7 @@ namespace Ryujinx.Graphics.Texture.Astc Trit } - EIntegerEncoding _encoding; + readonly EIntegerEncoding _encoding; public byte NumberBits { get; private set; } public byte TritValue { get; private set; } public byte QuintValue { get; private set; } @@ -23,11 +23,11 @@ namespace Ryujinx.Graphics.Texture.Astc static IntegerEncoded() { - Encodings = new IntegerEncoded[0x100]; + _encodings = new IntegerEncoded[0x100]; - for (int i = 0; i < Encodings.Length; i++) + for (int i = 0; i < _encodings.Length; i++) { - Encodings[i] = CreateEncodingCalc(i); + _encodings[i] = CreateEncodingCalc(i); } } @@ -40,17 +40,17 @@ namespace Ryujinx.Graphics.Texture.Astc QuintValue = 0; } - public bool MatchesEncoding(IntegerEncoded other) + public readonly bool MatchesEncoding(IntegerEncoded other) { return _encoding == other._encoding && NumberBits == other.NumberBits; } - public EIntegerEncoding GetEncoding() + public readonly EIntegerEncoding GetEncoding() { return _encoding; } - public int GetBitLength(int numberVals) + public readonly int GetBitLength(int numberVals) { int totalBits = NumberBits * numberVals; if (_encoding == EIntegerEncoding.Trit) @@ -66,7 +66,7 @@ namespace Ryujinx.Graphics.Texture.Astc public static IntegerEncoded CreateEncoding(int maxVal) { - return Encodings[maxVal]; + return _encodings[maxVal]; } private static IntegerEncoded CreateEncodingCalc(int maxVal) @@ -122,7 +122,7 @@ namespace Ryujinx.Graphics.Texture.Astc ReadOnlySpan encodings = GetTritEncoding(encoded); - IntegerEncoded intEncoded = new IntegerEncoded(EIntegerEncoding.Trit, numberBitsPerValue); + IntegerEncoded intEncoded = new(EIntegerEncoding.Trit, numberBitsPerValue); for (int i = 0; i < 5; i++) { @@ -159,7 +159,7 @@ namespace Ryujinx.Graphics.Texture.Astc for (int i = 0; i < 3; i++) { - IntegerEncoded intEncoded = new IntegerEncoded(EIntegerEncoding.Quint, numberBitsPerValue) + IntegerEncoded intEncoded = new(EIntegerEncoding.Quint, numberBitsPerValue) { BitValue = m[i], QuintValue = encodings[i] @@ -185,29 +185,29 @@ namespace Ryujinx.Graphics.Texture.Astc switch (intEncoded.GetEncoding()) { case EIntegerEncoding.Quint: - { - DecodeQuintBlock(ref bitStream, ref decodeIntegerSequence, intEncoded.NumberBits); - numberValuesDecoded += 3; + { + DecodeQuintBlock(ref bitStream, ref decodeIntegerSequence, intEncoded.NumberBits); + numberValuesDecoded += 3; - break; - } + break; + } case EIntegerEncoding.Trit: - { - DecodeTritBlock(ref bitStream, ref decodeIntegerSequence, intEncoded.NumberBits); - numberValuesDecoded += 5; + { + DecodeTritBlock(ref bitStream, ref decodeIntegerSequence, intEncoded.NumberBits); + numberValuesDecoded += 5; - break; - } + break; + } case EIntegerEncoding.JustBits: - { - intEncoded.BitValue = bitStream.ReadBits(intEncoded.NumberBits); - decodeIntegerSequence.Add(ref intEncoded); - numberValuesDecoded++; + { + intEncoded.BitValue = bitStream.ReadBits(intEncoded.NumberBits); + decodeIntegerSequence.Add(ref intEncoded); + numberValuesDecoded++; - break; - } + break; + } } } } -- cgit v1.2.3