[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 <Acoustik666@gmail.com> * Address review feedback * Update src/Ryujinx.Graphics.Texture/Astc/AstcDecoder.cs Co-authored-by: Ac_K <Acoustik666@gmail.com> --------- Co-authored-by: Ac_K <Acoustik666@gmail.com>
This commit is contained in:
parent
fc20d9b925
commit
cebfa54467
25 changed files with 741 additions and 630 deletions
|
@ -54,10 +54,10 @@ namespace Ryujinx.Graphics.Texture
|
|||
|
||||
if (copyHeight == 4)
|
||||
{
|
||||
outputLine0 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint.Slice(lineBaseOOffs));
|
||||
outputLine1 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint.Slice(lineBaseOOffs + width));
|
||||
outputLine2 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint.Slice(lineBaseOOffs + width * 2));
|
||||
outputLine3 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint.Slice(lineBaseOOffs + width * 3));
|
||||
outputLine0 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint[lineBaseOOffs..]);
|
||||
outputLine1 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint[(lineBaseOOffs + width)..]);
|
||||
outputLine2 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint[(lineBaseOOffs + width * 2)..]);
|
||||
outputLine3 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint[(lineBaseOOffs + width * 3)..]);
|
||||
}
|
||||
|
||||
for (int x = 0; x < w; x++)
|
||||
|
@ -84,7 +84,7 @@ namespace Ryujinx.Graphics.Texture
|
|||
}
|
||||
}
|
||||
|
||||
data = data.Slice(8);
|
||||
data = data[8..];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,10 +142,10 @@ namespace Ryujinx.Graphics.Texture
|
|||
|
||||
if (copyHeight == 4)
|
||||
{
|
||||
outputLine0 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint.Slice(lineBaseOOffs));
|
||||
outputLine1 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint.Slice(lineBaseOOffs + width));
|
||||
outputLine2 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint.Slice(lineBaseOOffs + width * 2));
|
||||
outputLine3 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint.Slice(lineBaseOOffs + width * 3));
|
||||
outputLine0 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint[lineBaseOOffs..]);
|
||||
outputLine1 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint[(lineBaseOOffs + width)..]);
|
||||
outputLine2 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint[(lineBaseOOffs + width * 2)..]);
|
||||
outputLine3 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint[(lineBaseOOffs + width * 3)..]);
|
||||
}
|
||||
|
||||
for (int x = 0; x < w; x++)
|
||||
|
@ -153,7 +153,7 @@ namespace Ryujinx.Graphics.Texture
|
|||
int baseX = x * BlockWidth;
|
||||
int copyWidth = Math.Min(BlockWidth, width - baseX);
|
||||
|
||||
BC23DecodeTileRgb(tile, data.Slice(8));
|
||||
BC23DecodeTileRgb(tile, data[8..]);
|
||||
|
||||
ulong block = BinaryPrimitives.ReadUInt64LittleEndian(data);
|
||||
|
||||
|
@ -179,7 +179,7 @@ namespace Ryujinx.Graphics.Texture
|
|||
}
|
||||
}
|
||||
|
||||
data = data.Slice(16);
|
||||
data = data[16..];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -238,10 +238,10 @@ namespace Ryujinx.Graphics.Texture
|
|||
|
||||
if (copyHeight == 4)
|
||||
{
|
||||
outputLine0 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint.Slice(lineBaseOOffs));
|
||||
outputLine1 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint.Slice(lineBaseOOffs + width));
|
||||
outputLine2 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint.Slice(lineBaseOOffs + width * 2));
|
||||
outputLine3 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint.Slice(lineBaseOOffs + width * 3));
|
||||
outputLine0 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint[lineBaseOOffs..]);
|
||||
outputLine1 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint[(lineBaseOOffs + width)..]);
|
||||
outputLine2 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint[(lineBaseOOffs + width * 2)..]);
|
||||
outputLine3 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint[(lineBaseOOffs + width * 3)..]);
|
||||
}
|
||||
|
||||
for (int x = 0; x < w; x++)
|
||||
|
@ -249,7 +249,7 @@ namespace Ryujinx.Graphics.Texture
|
|||
int baseX = x * BlockWidth;
|
||||
int copyWidth = Math.Min(BlockWidth, width - baseX);
|
||||
|
||||
BC23DecodeTileRgb(tile, data.Slice(8));
|
||||
BC23DecodeTileRgb(tile, data[8..]);
|
||||
|
||||
ulong block = BinaryPrimitives.ReadUInt64LittleEndian(data);
|
||||
|
||||
|
@ -276,7 +276,7 @@ namespace Ryujinx.Graphics.Texture
|
|||
}
|
||||
}
|
||||
|
||||
data = data.Slice(16);
|
||||
data = data[16..];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -305,7 +305,7 @@ namespace Ryujinx.Graphics.Texture
|
|||
int alignedWidth = BitUtils.AlignUp(width, 4);
|
||||
|
||||
byte[] output = new byte[size];
|
||||
Span<byte> outputSpan = new Span<byte>(output);
|
||||
Span<byte> outputSpan = new(output);
|
||||
|
||||
ReadOnlySpan<ulong> data64 = MemoryMarshal.Cast<byte, ulong>(data);
|
||||
|
||||
|
@ -338,10 +338,10 @@ namespace Ryujinx.Graphics.Texture
|
|||
|
||||
if (copyHeight == 4)
|
||||
{
|
||||
outputLine0 = MemoryMarshal.Cast<byte, uint>(outputSpan.Slice(lineBaseOOffs));
|
||||
outputLine1 = MemoryMarshal.Cast<byte, uint>(outputSpan.Slice(lineBaseOOffs + alignedWidth));
|
||||
outputLine2 = MemoryMarshal.Cast<byte, uint>(outputSpan.Slice(lineBaseOOffs + alignedWidth * 2));
|
||||
outputLine3 = MemoryMarshal.Cast<byte, uint>(outputSpan.Slice(lineBaseOOffs + alignedWidth * 3));
|
||||
outputLine0 = MemoryMarshal.Cast<byte, uint>(outputSpan[lineBaseOOffs..]);
|
||||
outputLine1 = MemoryMarshal.Cast<byte, uint>(outputSpan[(lineBaseOOffs + alignedWidth)..]);
|
||||
outputLine2 = MemoryMarshal.Cast<byte, uint>(outputSpan[(lineBaseOOffs + alignedWidth * 2)..]);
|
||||
outputLine3 = MemoryMarshal.Cast<byte, uint>(outputSpan[(lineBaseOOffs + alignedWidth * 3)..]);
|
||||
}
|
||||
|
||||
for (int x = 0; x < w; x++)
|
||||
|
@ -382,7 +382,7 @@ namespace Ryujinx.Graphics.Texture
|
|||
}
|
||||
}
|
||||
|
||||
data64 = data64.Slice(1);
|
||||
data64 = data64[1..];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -450,10 +450,10 @@ namespace Ryujinx.Graphics.Texture
|
|||
|
||||
if (copyHeight == 4)
|
||||
{
|
||||
outputLine0 = MemoryMarshal.Cast<ushort, ulong>(outputAsUshort.Slice(lineBaseOOffs));
|
||||
outputLine1 = MemoryMarshal.Cast<ushort, ulong>(outputAsUshort.Slice(lineBaseOOffs + alignedWidth));
|
||||
outputLine2 = MemoryMarshal.Cast<ushort, ulong>(outputAsUshort.Slice(lineBaseOOffs + alignedWidth * 2));
|
||||
outputLine3 = MemoryMarshal.Cast<ushort, ulong>(outputAsUshort.Slice(lineBaseOOffs + alignedWidth * 3));
|
||||
outputLine0 = MemoryMarshal.Cast<ushort, ulong>(outputAsUshort[lineBaseOOffs..]);
|
||||
outputLine1 = MemoryMarshal.Cast<ushort, ulong>(outputAsUshort[(lineBaseOOffs + alignedWidth)..]);
|
||||
outputLine2 = MemoryMarshal.Cast<ushort, ulong>(outputAsUshort[(lineBaseOOffs + alignedWidth * 2)..]);
|
||||
outputLine3 = MemoryMarshal.Cast<ushort, ulong>(outputAsUshort[(lineBaseOOffs + alignedWidth * 3)..]);
|
||||
}
|
||||
|
||||
for (int x = 0; x < w; x++)
|
||||
|
@ -507,7 +507,7 @@ namespace Ryujinx.Graphics.Texture
|
|||
}
|
||||
}
|
||||
|
||||
data64 = data64.Slice(2);
|
||||
data64 = data64[2..];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -548,7 +548,7 @@ namespace Ryujinx.Graphics.Texture
|
|||
{
|
||||
for (int z = 0; z < depth; z++)
|
||||
{
|
||||
BC6Decoder.Decode(output.AsSpan().Slice(outputOffset), data.Slice(inputOffset), width, height, signed);
|
||||
BC6Decoder.Decode(output.AsSpan()[outputOffset..], data[inputOffset..], width, height, signed);
|
||||
|
||||
inputOffset += w * h * 16;
|
||||
outputOffset += width * height * 8;
|
||||
|
@ -586,7 +586,7 @@ namespace Ryujinx.Graphics.Texture
|
|||
{
|
||||
for (int z = 0; z < depth; z++)
|
||||
{
|
||||
BC7Decoder.Decode(output.AsSpan().Slice(outputOffset), data.Slice(inputOffset), width, height);
|
||||
BC7Decoder.Decode(output.AsSpan()[outputOffset..], data[inputOffset..], width, height);
|
||||
|
||||
inputOffset += w * h * 16;
|
||||
outputOffset += width * height * 4;
|
||||
|
@ -813,7 +813,7 @@ namespace Ryujinx.Graphics.Texture
|
|||
{
|
||||
Span<uint> outputAsUint = MemoryMarshal.Cast<byte, uint>(output);
|
||||
|
||||
uint indices = BinaryPrimitives.ReadUInt32LittleEndian(input.Slice(4));
|
||||
uint indices = BinaryPrimitives.ReadUInt32LittleEndian(input[4..]);
|
||||
|
||||
for (int i = 0; i < BlockWidth * BlockHeight; i++, indices >>= 2)
|
||||
{
|
||||
|
@ -891,4 +891,4 @@ namespace Ryujinx.Graphics.Texture
|
|||
return r | (g & 0xff00) | (b & 0xff0000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue