diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2019-12-11 16:43:28 -0300 |
|---|---|---|
| committer | Thog <thog@protonmail.com> | 2020-01-09 02:13:00 +0100 |
| commit | 1a550e810c71670e5a2f032ec136fb2f5f57ac9c (patch) | |
| tree | 6a5b4456a2a486a650e96893abafd9d4ff72a977 /Ryujinx.Graphics.Texture/LayoutConverter.cs | |
| parent | cfe5fec0cf312d7a5f49470e93b6e9f83e883e21 (diff) | |
Copy 16 bytes at a time for layout conversion, if possible
Diffstat (limited to 'Ryujinx.Graphics.Texture/LayoutConverter.cs')
| -rw-r--r-- | Ryujinx.Graphics.Texture/LayoutConverter.cs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Ryujinx.Graphics.Texture/LayoutConverter.cs b/Ryujinx.Graphics.Texture/LayoutConverter.cs index c270b494..2c3d641b 100644 --- a/Ryujinx.Graphics.Texture/LayoutConverter.cs +++ b/Ryujinx.Graphics.Texture/LayoutConverter.cs @@ -62,6 +62,10 @@ namespace Ryujinx.Graphics.Texture mipGobBlocksInZ >>= 1; } + int strideTrunc = BitUtils.AlignDown(w * bytesPerPixel, 16); + + int xStart = strideTrunc / bytesPerPixel; + int stride = BitUtils.AlignUp(w * bytesPerPixel, HostStrideAlignment); int wAligned = BitUtils.AlignUp(w, wAlignment); @@ -80,7 +84,16 @@ namespace Ryujinx.Graphics.Texture for (int z = 0; z < d; z++) for (int y = 0; y < h; y++) { - for (int x = 0; x < w; x++) + for (int x = 0; x < strideTrunc; x += 16) + { + int offset = inBaseOffset + layoutConverter.GetOffsetWithLineOffset(x, y, z); + + Span<byte> dest = output.Slice(outOffs + x, 16); + + data.Slice(offset, 16).CopyTo(dest); + } + + for (int x = xStart; x < w; x++) { int offset = inBaseOffset + layoutConverter.GetOffset(x, y, z); |
