aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Texture/BCnDecoder.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ryujinx.Graphics.Texture/BCnDecoder.cs')
-rw-r--r--src/Ryujinx.Graphics.Texture/BCnDecoder.cs64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/Ryujinx.Graphics.Texture/BCnDecoder.cs b/src/Ryujinx.Graphics.Texture/BCnDecoder.cs
index b21fa4d1..2d68ca34 100644
--- a/src/Ryujinx.Graphics.Texture/BCnDecoder.cs
+++ b/src/Ryujinx.Graphics.Texture/BCnDecoder.cs
@@ -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);
}
}
-} \ No newline at end of file
+}