diff options
-rw-r--r-- | src/Ryujinx.Graphics.Device/DeviceMemoryManager.cs | 5 | ||||
-rw-r--r-- | src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClass.cs | 2 | ||||
-rw-r--r-- | src/Ryujinx.Graphics.Gpu/Image/Texture.cs | 3 | ||||
-rw-r--r-- | src/Ryujinx.Graphics.Gpu/Memory/MemoryManager.cs | 5 | ||||
-rw-r--r-- | src/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs | 6 | ||||
-rw-r--r-- | src/Ryujinx.Graphics.OpenGL/Image/FormatConverter.cs | 7 | ||||
-rw-r--r-- | src/Ryujinx.Graphics.Texture/Astc/AstcDecoder.cs | 5 | ||||
-rw-r--r-- | src/Ryujinx.Graphics.Texture/BCnDecoder.cs | 43 | ||||
-rw-r--r-- | src/Ryujinx.Graphics.Texture/BCnEncoder.cs | 5 | ||||
-rw-r--r-- | src/Ryujinx.Graphics.Texture/ETC2Decoder.cs | 19 | ||||
-rw-r--r-- | src/Ryujinx.Graphics.Texture/LayoutConverter.cs | 13 | ||||
-rw-r--r-- | src/Ryujinx.Graphics.Texture/PixelConverter.cs | 38 | ||||
-rw-r--r-- | src/Ryujinx.Graphics.Vulkan/DescriptorSetUpdater.cs | 2 |
13 files changed, 73 insertions, 80 deletions
diff --git a/src/Ryujinx.Graphics.Device/DeviceMemoryManager.cs b/src/Ryujinx.Graphics.Device/DeviceMemoryManager.cs index fc075a264..cb1a7c3ab 100644 --- a/src/Ryujinx.Graphics.Device/DeviceMemoryManager.cs +++ b/src/Ryujinx.Graphics.Device/DeviceMemoryManager.cs | |||
@@ -1,7 +1,6 @@ | |||
1 | using Ryujinx.Common.Memory; | 1 | using Ryujinx.Common.Memory; |
2 | using Ryujinx.Memory; | 2 | using Ryujinx.Memory; |
3 | using System; | 3 | using System; |
4 | using System.Buffers; | ||
5 | using System.Runtime.CompilerServices; | 4 | using System.Runtime.CompilerServices; |
6 | using System.Runtime.InteropServices; | 5 | using System.Runtime.InteropServices; |
7 | 6 | ||
@@ -145,9 +144,9 @@ namespace Ryujinx.Graphics.Device | |||
145 | } | 144 | } |
146 | else | 145 | else |
147 | { | 146 | { |
148 | IMemoryOwner<byte> memoryOwner = ByteMemoryPool.Rent(size); | 147 | MemoryOwner<byte> memoryOwner = MemoryOwner<byte>.Rent(size); |
149 | 148 | ||
150 | GetSpan(va, size).CopyTo(memoryOwner.Memory.Span); | 149 | ReadImpl(va, memoryOwner.Span); |
151 | 150 | ||
152 | return new WritableRegion(this, va, memoryOwner, tracked: true); | 151 | return new WritableRegion(this, va, memoryOwner, tracked: true); |
153 | } | 152 | } |
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClass.cs b/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClass.cs index 93e43ce3c..78099f74a 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClass.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClass.cs | |||
@@ -199,7 +199,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory | |||
199 | if (target != null) | 199 | if (target != null) |
200 | { | 200 | { |
201 | target.SynchronizeMemory(); | 201 | target.SynchronizeMemory(); |
202 | var dataCopy = ByteMemoryPool.RentCopy(data); | 202 | var dataCopy = MemoryOwner<byte>.RentCopy(data); |
203 | target.SetData(dataCopy, 0, 0, new GAL.Rectangle<int>(_dstX, _dstY, _lineLengthIn / target.Info.FormatInfo.BytesPerPixel, _lineCount)); | 203 | target.SetData(dataCopy, 0, 0, new GAL.Rectangle<int>(_dstX, _dstY, _lineLengthIn / target.Info.FormatInfo.BytesPerPixel, _lineCount)); |
204 | target.SignalModified(); | 204 | target.SignalModified(); |
205 | 205 | ||
diff --git a/src/Ryujinx.Graphics.Gpu/Image/Texture.cs b/src/Ryujinx.Graphics.Gpu/Image/Texture.cs index dde28dbd7..3b6c407cc 100644 --- a/src/Ryujinx.Graphics.Gpu/Image/Texture.cs +++ b/src/Ryujinx.Graphics.Gpu/Image/Texture.cs | |||
@@ -1,4 +1,5 @@ | |||
1 | using Ryujinx.Common.Logging; | 1 | using Ryujinx.Common.Logging; |
2 | using Ryujinx.Common.Memory; | ||
2 | using Ryujinx.Graphics.GAL; | 3 | using Ryujinx.Graphics.GAL; |
3 | using Ryujinx.Graphics.Gpu.Memory; | 4 | using Ryujinx.Graphics.Gpu.Memory; |
4 | using Ryujinx.Graphics.Texture; | 5 | using Ryujinx.Graphics.Texture; |
@@ -805,7 +806,7 @@ namespace Ryujinx.Graphics.Gpu.Image | |||
805 | sliceDepth, | 806 | sliceDepth, |
806 | levels, | 807 | levels, |
807 | layers, | 808 | layers, |
808 | out IMemoryOwner<byte> decoded)) | 809 | out MemoryOwner<byte> decoded)) |
809 | { | 810 | { |
810 | string texInfo = $"{Info.Target} {Info.FormatInfo.Format} {Info.Width}x{Info.Height}x{Info.DepthOrLayers} levels {Info.Levels}"; | 811 | string texInfo = $"{Info.Target} {Info.FormatInfo.Format} {Info.Width}x{Info.Height}x{Info.DepthOrLayers} levels {Info.Levels}"; |
811 | 812 | ||
diff --git a/src/Ryujinx.Graphics.Gpu/Memory/MemoryManager.cs b/src/Ryujinx.Graphics.Gpu/Memory/MemoryManager.cs index 0b6c78fac..59a940a4f 100644 --- a/src/Ryujinx.Graphics.Gpu/Memory/MemoryManager.cs +++ b/src/Ryujinx.Graphics.Gpu/Memory/MemoryManager.cs | |||
@@ -2,7 +2,6 @@ using Ryujinx.Common.Memory; | |||
2 | using Ryujinx.Memory; | 2 | using Ryujinx.Memory; |
3 | using Ryujinx.Memory.Range; | 3 | using Ryujinx.Memory.Range; |
4 | using System; | 4 | using System; |
5 | using System.Buffers; | ||
6 | using System.Collections.Generic; | 5 | using System.Collections.Generic; |
7 | using System.Runtime.CompilerServices; | 6 | using System.Runtime.CompilerServices; |
8 | using System.Runtime.InteropServices; | 7 | using System.Runtime.InteropServices; |
@@ -242,9 +241,9 @@ namespace Ryujinx.Graphics.Gpu.Memory | |||
242 | } | 241 | } |
243 | else | 242 | else |
244 | { | 243 | { |
245 | IMemoryOwner<byte> memoryOwner = ByteMemoryPool.Rent(size); | 244 | MemoryOwner<byte> memoryOwner = MemoryOwner<byte>.Rent(size); |
246 | 245 | ||
247 | GetSpan(va, size).CopyTo(memoryOwner.Memory.Span); | 246 | ReadImpl(va, memoryOwner.Span, tracked); |
248 | 247 | ||
249 | return new WritableRegion(this, va, memoryOwner, tracked); | 248 | return new WritableRegion(this, va, memoryOwner, tracked); |
250 | } | 249 | } |
diff --git a/src/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs b/src/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs index 4d09c3aab..b22cc01b8 100644 --- a/src/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs +++ b/src/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs | |||
@@ -192,9 +192,9 @@ namespace Ryujinx.Graphics.Gpu.Memory | |||
192 | } | 192 | } |
193 | else | 193 | else |
194 | { | 194 | { |
195 | IMemoryOwner<byte> memoryOwner = ByteMemoryPool.Rent(range.GetSize()); | 195 | MemoryOwner<byte> memoryOwner = MemoryOwner<byte>.Rent(checked((int)range.GetSize())); |
196 | 196 | ||
197 | Memory<byte> memory = memoryOwner.Memory; | 197 | Span<byte> memorySpan = memoryOwner.Span; |
198 | 198 | ||
199 | int offset = 0; | 199 | int offset = 0; |
200 | for (int i = 0; i < range.Count; i++) | 200 | for (int i = 0; i < range.Count; i++) |
@@ -203,7 +203,7 @@ namespace Ryujinx.Graphics.Gpu.Memory | |||
203 | int size = (int)currentRange.Size; | 203 | int size = (int)currentRange.Size; |
204 | if (currentRange.Address != MemoryManager.PteUnmapped) | 204 | if (currentRange.Address != MemoryManager.PteUnmapped) |
205 | { | 205 | { |
206 | GetSpan(currentRange.Address, size).CopyTo(memory.Span.Slice(offset, size)); | 206 | GetSpan(currentRange.Address, size).CopyTo(memorySpan.Slice(offset, size)); |
207 | } | 207 | } |
208 | offset += size; | 208 | offset += size; |
209 | } | 209 | } |
diff --git a/src/Ryujinx.Graphics.OpenGL/Image/FormatConverter.cs b/src/Ryujinx.Graphics.OpenGL/Image/FormatConverter.cs index 434f25900..490c0c585 100644 --- a/src/Ryujinx.Graphics.OpenGL/Image/FormatConverter.cs +++ b/src/Ryujinx.Graphics.OpenGL/Image/FormatConverter.cs | |||
@@ -1,6 +1,5 @@ | |||
1 | using Ryujinx.Common.Memory; | 1 | using Ryujinx.Common.Memory; |
2 | using System; | 2 | using System; |
3 | using System.Buffers; | ||
4 | using System.Numerics; | 3 | using System.Numerics; |
5 | using System.Runtime.InteropServices; | 4 | using System.Runtime.InteropServices; |
6 | using System.Runtime.Intrinsics; | 5 | using System.Runtime.Intrinsics; |
@@ -10,11 +9,11 @@ namespace Ryujinx.Graphics.OpenGL.Image | |||
10 | { | 9 | { |
11 | static class FormatConverter | 10 | static class FormatConverter |
12 | { | 11 | { |
13 | public unsafe static IMemoryOwner<byte> ConvertS8D24ToD24S8(ReadOnlySpan<byte> data) | 12 | public unsafe static MemoryOwner<byte> ConvertS8D24ToD24S8(ReadOnlySpan<byte> data) |
14 | { | 13 | { |
15 | IMemoryOwner<byte> outputMemory = ByteMemoryPool.Rent(data.Length); | 14 | MemoryOwner<byte> outputMemory = MemoryOwner<byte>.Rent(data.Length); |
16 | 15 | ||
17 | Span<byte> output = outputMemory.Memory.Span; | 16 | Span<byte> output = outputMemory.Span; |
18 | 17 | ||
19 | int start = 0; | 18 | int start = 0; |
20 | 19 | ||
diff --git a/src/Ryujinx.Graphics.Texture/Astc/AstcDecoder.cs b/src/Ryujinx.Graphics.Texture/Astc/AstcDecoder.cs index 3f65e1225..92e39d2e0 100644 --- a/src/Ryujinx.Graphics.Texture/Astc/AstcDecoder.cs +++ b/src/Ryujinx.Graphics.Texture/Astc/AstcDecoder.cs | |||
@@ -1,7 +1,6 @@ | |||
1 | using Ryujinx.Common.Memory; | 1 | using Ryujinx.Common.Memory; |
2 | using Ryujinx.Common.Utilities; | 2 | using Ryujinx.Common.Utilities; |
3 | using System; | 3 | using System; |
4 | using System.Buffers; | ||
5 | using System.Diagnostics; | 4 | using System.Diagnostics; |
6 | using System.Linq; | 5 | using System.Linq; |
7 | using System.Runtime.CompilerServices; | 6 | using System.Runtime.CompilerServices; |
@@ -293,9 +292,9 @@ namespace Ryujinx.Graphics.Texture.Astc | |||
293 | int depth, | 292 | int depth, |
294 | int levels, | 293 | int levels, |
295 | int layers, | 294 | int layers, |
296 | out IMemoryOwner<byte> decoded) | 295 | out MemoryOwner<byte> decoded) |
297 | { | 296 | { |
298 | decoded = ByteMemoryPool.Rent(QueryDecompressedSize(width, height, depth, levels, layers)); | 297 | decoded = MemoryOwner<byte>.Rent(QueryDecompressedSize(width, height, depth, levels, layers)); |
299 | 298 | ||
300 | AstcDecoder decoder = new(data, decoded.Memory, blockWidth, blockHeight, width, height, depth, levels, layers); | 299 | AstcDecoder decoder = new(data, decoded.Memory, blockWidth, blockHeight, width, height, depth, levels, layers); |
301 | 300 | ||
diff --git a/src/Ryujinx.Graphics.Texture/BCnDecoder.cs b/src/Ryujinx.Graphics.Texture/BCnDecoder.cs index eb85334a2..d7b1f0fa9 100644 --- a/src/Ryujinx.Graphics.Texture/BCnDecoder.cs +++ b/src/Ryujinx.Graphics.Texture/BCnDecoder.cs | |||
@@ -1,7 +1,6 @@ | |||
1 | using Ryujinx.Common; | 1 | using Ryujinx.Common; |
2 | using Ryujinx.Common.Memory; | 2 | using Ryujinx.Common.Memory; |
3 | using System; | 3 | using System; |
4 | using System.Buffers; | ||
5 | using System.Buffers.Binary; | 4 | using System.Buffers.Binary; |
6 | using System.Runtime.InteropServices; | 5 | using System.Runtime.InteropServices; |
7 | using System.Runtime.Intrinsics; | 6 | using System.Runtime.Intrinsics; |
@@ -14,7 +13,7 @@ namespace Ryujinx.Graphics.Texture | |||
14 | private const int BlockWidth = 4; | 13 | private const int BlockWidth = 4; |
15 | private const int BlockHeight = 4; | 14 | private const int BlockHeight = 4; |
16 | 15 | ||
17 | public static IMemoryOwner<byte> DecodeBC1(ReadOnlySpan<byte> data, int width, int height, int depth, int levels, int layers) | 16 | public static MemoryOwner<byte> DecodeBC1(ReadOnlySpan<byte> data, int width, int height, int depth, int levels, int layers) |
18 | { | 17 | { |
19 | int size = 0; | 18 | int size = 0; |
20 | 19 | ||
@@ -23,12 +22,12 @@ namespace Ryujinx.Graphics.Texture | |||
23 | size += Math.Max(1, width >> l) * Math.Max(1, height >> l) * Math.Max(1, depth >> l) * layers * 4; | 22 | size += Math.Max(1, width >> l) * Math.Max(1, height >> l) * Math.Max(1, depth >> l) * layers * 4; |
24 | } | 23 | } |
25 | 24 | ||
26 | IMemoryOwner<byte> output = ByteMemoryPool.Rent(size); | 25 | MemoryOwner<byte> output = MemoryOwner<byte>.Rent(size); |
27 | 26 | ||
28 | Span<byte> tile = stackalloc byte[BlockWidth * BlockHeight * 4]; | 27 | Span<byte> tile = stackalloc byte[BlockWidth * BlockHeight * 4]; |
29 | 28 | ||
30 | Span<uint> tileAsUint = MemoryMarshal.Cast<byte, uint>(tile); | 29 | Span<uint> tileAsUint = MemoryMarshal.Cast<byte, uint>(tile); |
31 | Span<uint> outputAsUint = MemoryMarshal.Cast<byte, uint>(output.Memory.Span); | 30 | Span<uint> outputAsUint = MemoryMarshal.Cast<byte, uint>(output.Span); |
32 | 31 | ||
33 | Span<Vector128<byte>> tileAsVector128 = MemoryMarshal.Cast<byte, Vector128<byte>>(tile); | 32 | Span<Vector128<byte>> tileAsVector128 = MemoryMarshal.Cast<byte, Vector128<byte>>(tile); |
34 | 33 | ||
@@ -102,7 +101,7 @@ namespace Ryujinx.Graphics.Texture | |||
102 | return output; | 101 | return output; |
103 | } | 102 | } |
104 | 103 | ||
105 | public static IMemoryOwner<byte> DecodeBC2(ReadOnlySpan<byte> data, int width, int height, int depth, int levels, int layers) | 104 | public static MemoryOwner<byte> DecodeBC2(ReadOnlySpan<byte> data, int width, int height, int depth, int levels, int layers) |
106 | { | 105 | { |
107 | int size = 0; | 106 | int size = 0; |
108 | 107 | ||
@@ -111,12 +110,12 @@ namespace Ryujinx.Graphics.Texture | |||
111 | size += Math.Max(1, width >> l) * Math.Max(1, height >> l) * Math.Max(1, depth >> l) * layers * 4; | 110 | size += Math.Max(1, width >> l) * Math.Max(1, height >> l) * Math.Max(1, depth >> l) * layers * 4; |
112 | } | 111 | } |
113 | 112 | ||
114 | IMemoryOwner<byte> output = ByteMemoryPool.Rent(size); | 113 | MemoryOwner<byte> output = MemoryOwner<byte>.Rent(size); |
115 | 114 | ||
116 | Span<byte> tile = stackalloc byte[BlockWidth * BlockHeight * 4]; | 115 | Span<byte> tile = stackalloc byte[BlockWidth * BlockHeight * 4]; |
117 | 116 | ||
118 | Span<uint> tileAsUint = MemoryMarshal.Cast<byte, uint>(tile); | 117 | Span<uint> tileAsUint = MemoryMarshal.Cast<byte, uint>(tile); |
119 | Span<uint> outputAsUint = MemoryMarshal.Cast<byte, uint>(output.Memory.Span); | 118 | Span<uint> outputAsUint = MemoryMarshal.Cast<byte, uint>(output.Span); |
120 | 119 | ||
121 | Span<Vector128<byte>> tileAsVector128 = MemoryMarshal.Cast<byte, Vector128<byte>>(tile); | 120 | Span<Vector128<byte>> tileAsVector128 = MemoryMarshal.Cast<byte, Vector128<byte>>(tile); |
122 | 121 | ||
@@ -197,7 +196,7 @@ namespace Ryujinx.Graphics.Texture | |||
197 | return output; | 196 | return output; |
198 | } | 197 | } |
199 | 198 | ||
200 | public static IMemoryOwner<byte> DecodeBC3(ReadOnlySpan<byte> data, int width, int height, int depth, int levels, int layers) | 199 | public static MemoryOwner<byte> DecodeBC3(ReadOnlySpan<byte> data, int width, int height, int depth, int levels, int layers) |
201 | { | 200 | { |
202 | int size = 0; | 201 | int size = 0; |
203 | 202 | ||
@@ -206,13 +205,13 @@ namespace Ryujinx.Graphics.Texture | |||
206 | size += Math.Max(1, width >> l) * Math.Max(1, height >> l) * Math.Max(1, depth >> l) * layers * 4; | 205 | size += Math.Max(1, width >> l) * Math.Max(1, height >> l) * Math.Max(1, depth >> l) * layers * 4; |
207 | } | 206 | } |
208 | 207 | ||
209 | IMemoryOwner<byte> output = ByteMemoryPool.Rent(size); | 208 | MemoryOwner<byte> output = MemoryOwner<byte>.Rent(size); |
210 | 209 | ||
211 | Span<byte> tile = stackalloc byte[BlockWidth * BlockHeight * 4]; | 210 | Span<byte> tile = stackalloc byte[BlockWidth * BlockHeight * 4]; |
212 | Span<byte> rPal = stackalloc byte[8]; | 211 | Span<byte> rPal = stackalloc byte[8]; |
213 | 212 | ||
214 | Span<uint> tileAsUint = MemoryMarshal.Cast<byte, uint>(tile); | 213 | Span<uint> tileAsUint = MemoryMarshal.Cast<byte, uint>(tile); |
215 | Span<uint> outputAsUint = MemoryMarshal.Cast<byte, uint>(output.Memory.Span); | 214 | Span<uint> outputAsUint = MemoryMarshal.Cast<byte, uint>(output.Span); |
216 | 215 | ||
217 | Span<Vector128<byte>> tileAsVector128 = MemoryMarshal.Cast<byte, Vector128<byte>>(tile); | 216 | Span<Vector128<byte>> tileAsVector128 = MemoryMarshal.Cast<byte, Vector128<byte>>(tile); |
218 | 217 | ||
@@ -294,7 +293,7 @@ namespace Ryujinx.Graphics.Texture | |||
294 | return output; | 293 | return output; |
295 | } | 294 | } |
296 | 295 | ||
297 | public static IMemoryOwner<byte> DecodeBC4(ReadOnlySpan<byte> data, int width, int height, int depth, int levels, int layers, bool signed) | 296 | public static MemoryOwner<byte> DecodeBC4(ReadOnlySpan<byte> data, int width, int height, int depth, int levels, int layers, bool signed) |
298 | { | 297 | { |
299 | int size = 0; | 298 | int size = 0; |
300 | 299 | ||
@@ -306,8 +305,8 @@ namespace Ryujinx.Graphics.Texture | |||
306 | // Backends currently expect a stride alignment of 4 bytes, so output width must be aligned. | 305 | // Backends currently expect a stride alignment of 4 bytes, so output width must be aligned. |
307 | int alignedWidth = BitUtils.AlignUp(width, 4); | 306 | int alignedWidth = BitUtils.AlignUp(width, 4); |
308 | 307 | ||
309 | IMemoryOwner<byte> output = ByteMemoryPool.Rent(size); | 308 | MemoryOwner<byte> output = MemoryOwner<byte>.Rent(size); |
310 | Span<byte> outputSpan = output.Memory.Span; | 309 | Span<byte> outputSpan = output.Span; |
311 | 310 | ||
312 | ReadOnlySpan<ulong> data64 = MemoryMarshal.Cast<byte, ulong>(data); | 311 | ReadOnlySpan<ulong> data64 = MemoryMarshal.Cast<byte, ulong>(data); |
313 | 312 | ||
@@ -402,7 +401,7 @@ namespace Ryujinx.Graphics.Texture | |||
402 | return output; | 401 | return output; |
403 | } | 402 | } |
404 | 403 | ||
405 | public static IMemoryOwner<byte> DecodeBC5(ReadOnlySpan<byte> data, int width, int height, int depth, int levels, int layers, bool signed) | 404 | public static MemoryOwner<byte> DecodeBC5(ReadOnlySpan<byte> data, int width, int height, int depth, int levels, int layers, bool signed) |
406 | { | 405 | { |
407 | int size = 0; | 406 | int size = 0; |
408 | 407 | ||
@@ -414,7 +413,7 @@ namespace Ryujinx.Graphics.Texture | |||
414 | // Backends currently expect a stride alignment of 4 bytes, so output width must be aligned. | 413 | // Backends currently expect a stride alignment of 4 bytes, so output width must be aligned. |
415 | int alignedWidth = BitUtils.AlignUp(width, 2); | 414 | int alignedWidth = BitUtils.AlignUp(width, 2); |
416 | 415 | ||
417 | IMemoryOwner<byte> output = ByteMemoryPool.Rent(size); | 416 | MemoryOwner<byte> output = MemoryOwner<byte>.Rent(size); |
418 | 417 | ||
419 | ReadOnlySpan<ulong> data64 = MemoryMarshal.Cast<byte, ulong>(data); | 418 | ReadOnlySpan<ulong> data64 = MemoryMarshal.Cast<byte, ulong>(data); |
420 | 419 | ||
@@ -423,7 +422,7 @@ namespace Ryujinx.Graphics.Texture | |||
423 | Span<byte> rPal = stackalloc byte[8]; | 422 | Span<byte> rPal = stackalloc byte[8]; |
424 | Span<byte> gPal = stackalloc byte[8]; | 423 | Span<byte> gPal = stackalloc byte[8]; |
425 | 424 | ||
426 | Span<ushort> outputAsUshort = MemoryMarshal.Cast<byte, ushort>(output.Memory.Span); | 425 | Span<ushort> outputAsUshort = MemoryMarshal.Cast<byte, ushort>(output.Span); |
427 | 426 | ||
428 | Span<uint> rTileAsUint = MemoryMarshal.Cast<byte, uint>(rTile); | 427 | Span<uint> rTileAsUint = MemoryMarshal.Cast<byte, uint>(rTile); |
429 | Span<uint> gTileAsUint = MemoryMarshal.Cast<byte, uint>(gTile); | 428 | Span<uint> gTileAsUint = MemoryMarshal.Cast<byte, uint>(gTile); |
@@ -527,7 +526,7 @@ namespace Ryujinx.Graphics.Texture | |||
527 | return output; | 526 | return output; |
528 | } | 527 | } |
529 | 528 | ||
530 | public static IMemoryOwner<byte> DecodeBC6(ReadOnlySpan<byte> data, int width, int height, int depth, int levels, int layers, bool signed) | 529 | public static MemoryOwner<byte> DecodeBC6(ReadOnlySpan<byte> data, int width, int height, int depth, int levels, int layers, bool signed) |
531 | { | 530 | { |
532 | int size = 0; | 531 | int size = 0; |
533 | 532 | ||
@@ -536,8 +535,8 @@ namespace Ryujinx.Graphics.Texture | |||
536 | size += Math.Max(1, width >> l) * Math.Max(1, height >> l) * Math.Max(1, depth >> l) * layers * 8; | 535 | size += Math.Max(1, width >> l) * Math.Max(1, height >> l) * Math.Max(1, depth >> l) * layers * 8; |
537 | } | 536 | } |
538 | 537 | ||
539 | IMemoryOwner<byte> output = ByteMemoryPool.Rent(size); | 538 | MemoryOwner<byte> output = MemoryOwner<byte>.Rent(size); |
540 | Span<byte> outputSpan = output.Memory.Span; | 539 | Span<byte> outputSpan = output.Span; |
541 | 540 | ||
542 | int inputOffset = 0; | 541 | int inputOffset = 0; |
543 | int outputOffset = 0; | 542 | int outputOffset = 0; |
@@ -566,7 +565,7 @@ namespace Ryujinx.Graphics.Texture | |||
566 | return output; | 565 | return output; |
567 | } | 566 | } |
568 | 567 | ||
569 | public static IMemoryOwner<byte> DecodeBC7(ReadOnlySpan<byte> data, int width, int height, int depth, int levels, int layers) | 568 | public static MemoryOwner<byte> DecodeBC7(ReadOnlySpan<byte> data, int width, int height, int depth, int levels, int layers) |
570 | { | 569 | { |
571 | int size = 0; | 570 | int size = 0; |
572 | 571 | ||
@@ -575,8 +574,8 @@ namespace Ryujinx.Graphics.Texture | |||
575 | size += Math.Max(1, width >> l) * Math.Max(1, height >> l) * Math.Max(1, depth >> l) * layers * 4; | 574 | size += Math.Max(1, width >> l) * Math.Max(1, height >> l) * Math.Max(1, depth >> l) * layers * 4; |
576 | } | 575 | } |
577 | 576 | ||
578 | IMemoryOwner<byte> output = ByteMemoryPool.Rent(size); | 577 | MemoryOwner<byte> output = MemoryOwner<byte>.Rent(size); |
579 | Span<byte> outputSpan = output.Memory.Span; | 578 | Span<byte> outputSpan = output.Span; |
580 | 579 | ||
581 | int inputOffset = 0; | 580 | int inputOffset = 0; |
582 | int outputOffset = 0; | 581 | int outputOffset = 0; |
diff --git a/src/Ryujinx.Graphics.Texture/BCnEncoder.cs b/src/Ryujinx.Graphics.Texture/BCnEncoder.cs index 253ba305c..4db8a182b 100644 --- a/src/Ryujinx.Graphics.Texture/BCnEncoder.cs +++ b/src/Ryujinx.Graphics.Texture/BCnEncoder.cs | |||
@@ -2,7 +2,6 @@ using Ryujinx.Common; | |||
2 | using Ryujinx.Common.Memory; | 2 | using Ryujinx.Common.Memory; |
3 | using Ryujinx.Graphics.Texture.Encoders; | 3 | using Ryujinx.Graphics.Texture.Encoders; |
4 | using System; | 4 | using System; |
5 | using System.Buffers; | ||
6 | 5 | ||
7 | namespace Ryujinx.Graphics.Texture | 6 | namespace Ryujinx.Graphics.Texture |
8 | { | 7 | { |
@@ -11,7 +10,7 @@ namespace Ryujinx.Graphics.Texture | |||
11 | private const int BlockWidth = 4; | 10 | private const int BlockWidth = 4; |
12 | private const int BlockHeight = 4; | 11 | private const int BlockHeight = 4; |
13 | 12 | ||
14 | public static IMemoryOwner<byte> EncodeBC7(Memory<byte> data, int width, int height, int depth, int levels, int layers) | 13 | public static MemoryOwner<byte> EncodeBC7(Memory<byte> data, int width, int height, int depth, int levels, int layers) |
15 | { | 14 | { |
16 | int size = 0; | 15 | int size = 0; |
17 | 16 | ||
@@ -23,7 +22,7 @@ namespace Ryujinx.Graphics.Texture | |||
23 | size += w * h * 16 * Math.Max(1, depth >> l) * layers; | 22 | size += w * h * 16 * Math.Max(1, depth >> l) * layers; |
24 | } | 23 | } |
25 | 24 | ||
26 | IMemoryOwner<byte> output = ByteMemoryPool.Rent(size); | 25 | MemoryOwner<byte> output = MemoryOwner<byte>.Rent(size); |
27 | Memory<byte> outputMemory = output.Memory; | 26 | Memory<byte> outputMemory = output.Memory; |
28 | 27 | ||
29 | int imageBaseIOffs = 0; | 28 | int imageBaseIOffs = 0; |
diff --git a/src/Ryujinx.Graphics.Texture/ETC2Decoder.cs b/src/Ryujinx.Graphics.Texture/ETC2Decoder.cs index 52801ff47..49e7154c8 100644 --- a/src/Ryujinx.Graphics.Texture/ETC2Decoder.cs +++ b/src/Ryujinx.Graphics.Texture/ETC2Decoder.cs | |||
@@ -1,7 +1,6 @@ | |||
1 | using Ryujinx.Common; | 1 | using Ryujinx.Common; |
2 | using Ryujinx.Common.Memory; | 2 | using Ryujinx.Common.Memory; |
3 | using System; | 3 | using System; |
4 | using System.Buffers; | ||
5 | using System.Buffers.Binary; | 4 | using System.Buffers.Binary; |
6 | using System.Runtime.InteropServices; | 5 | using System.Runtime.InteropServices; |
7 | 6 | ||
@@ -51,15 +50,15 @@ namespace Ryujinx.Graphics.Texture | |||
51 | new int[] { -3, -5, -7, -9, 2, 4, 6, 8 }, | 50 | new int[] { -3, -5, -7, -9, 2, 4, 6, 8 }, |
52 | }; | 51 | }; |
53 | 52 | ||
54 | public static IMemoryOwner<byte> DecodeRgb(ReadOnlySpan<byte> data, int width, int height, int depth, int levels, int layers) | 53 | public static MemoryOwner<byte> DecodeRgb(ReadOnlySpan<byte> data, int width, int height, int depth, int levels, int layers) |
55 | { | 54 | { |
56 | ReadOnlySpan<ulong> dataUlong = MemoryMarshal.Cast<byte, ulong>(data); | 55 | ReadOnlySpan<ulong> dataUlong = MemoryMarshal.Cast<byte, ulong>(data); |
57 | 56 | ||
58 | int inputOffset = 0; | 57 | int inputOffset = 0; |
59 | 58 | ||
60 | IMemoryOwner<byte> output = ByteMemoryPool.Rent(CalculateOutputSize(width, height, depth, levels, layers)); | 59 | MemoryOwner<byte> output = MemoryOwner<byte>.Rent(CalculateOutputSize(width, height, depth, levels, layers)); |
61 | 60 | ||
62 | Span<uint> outputUint = MemoryMarshal.Cast<byte, uint>(output.Memory.Span); | 61 | Span<uint> outputUint = MemoryMarshal.Cast<byte, uint>(output.Span); |
63 | Span<uint> tile = stackalloc uint[BlockWidth * BlockHeight]; | 62 | Span<uint> tile = stackalloc uint[BlockWidth * BlockHeight]; |
64 | 63 | ||
65 | int imageBaseOOffs = 0; | 64 | int imageBaseOOffs = 0; |
@@ -113,15 +112,15 @@ namespace Ryujinx.Graphics.Texture | |||
113 | return output; | 112 | return output; |
114 | } | 113 | } |
115 | 114 | ||
116 | public static IMemoryOwner<byte> DecodePta(ReadOnlySpan<byte> data, int width, int height, int depth, int levels, int layers) | 115 | public static MemoryOwner<byte> DecodePta(ReadOnlySpan<byte> data, int width, int height, int depth, int levels, int layers) |
117 | { | 116 | { |
118 | ReadOnlySpan<ulong> dataUlong = MemoryMarshal.Cast<byte, ulong>(data); | 117 | ReadOnlySpan<ulong> dataUlong = MemoryMarshal.Cast<byte, ulong>(data); |
119 | 118 | ||
120 | int inputOffset = 0; | 119 | int inputOffset = 0; |
121 | 120 | ||
122 | IMemoryOwner<byte> output = ByteMemoryPool.Rent(CalculateOutputSize(width, height, depth, levels, layers)); | 121 | MemoryOwner<byte> output = MemoryOwner<byte>.Rent(CalculateOutputSize(width, height, depth, levels, layers)); |
123 | 122 | ||
124 | Span<uint> outputUint = MemoryMarshal.Cast<byte, uint>(output.Memory.Span); | 123 | Span<uint> outputUint = MemoryMarshal.Cast<byte, uint>(output.Span); |
125 | Span<uint> tile = stackalloc uint[BlockWidth * BlockHeight]; | 124 | Span<uint> tile = stackalloc uint[BlockWidth * BlockHeight]; |
126 | 125 | ||
127 | int imageBaseOOffs = 0; | 126 | int imageBaseOOffs = 0; |
@@ -170,15 +169,15 @@ namespace Ryujinx.Graphics.Texture | |||
170 | return output; | 169 | return output; |
171 | } | 170 | } |
172 | 171 | ||
173 | public static IMemoryOwner<byte> DecodeRgba(ReadOnlySpan<byte> data, int width, int height, int depth, int levels, int layers) | 172 | public static MemoryOwner<byte> DecodeRgba(ReadOnlySpan<byte> data, int width, int height, int depth, int levels, int layers) |
174 | { | 173 | { |
175 | ReadOnlySpan<ulong> dataUlong = MemoryMarshal.Cast<byte, ulong>(data); | 174 | ReadOnlySpan<ulong> dataUlong = MemoryMarshal.Cast<byte, ulong>(data); |
176 | 175 | ||
177 | int inputOffset = 0; | 176 | int inputOffset = 0; |
178 | 177 | ||
179 | IMemoryOwner<byte> output = ByteMemoryPool.Rent(CalculateOutputSize(width, height, depth, levels, layers)); | 178 | MemoryOwner<byte> output = MemoryOwner<byte>.Rent(CalculateOutputSize(width, height, depth, levels, layers)); |
180 | 179 | ||
181 | Span<uint> outputUint = MemoryMarshal.Cast<byte, uint>(output.Memory.Span); | 180 | Span<uint> outputUint = MemoryMarshal.Cast<byte, uint>(output.Span); |
182 | Span<uint> tile = stackalloc uint[BlockWidth * BlockHeight]; | 181 | Span<uint> tile = stackalloc uint[BlockWidth * BlockHeight]; |
183 | 182 | ||
184 | int imageBaseOOffs = 0; | 183 | int imageBaseOOffs = 0; |
diff --git a/src/Ryujinx.Graphics.Texture/LayoutConverter.cs b/src/Ryujinx.Graphics.Texture/LayoutConverter.cs index d6732674b..5426af205 100644 --- a/src/Ryujinx.Graphics.Texture/LayoutConverter.cs +++ b/src/Ryujinx.Graphics.Texture/LayoutConverter.cs | |||
@@ -1,7 +1,6 @@ | |||
1 | using Ryujinx.Common; | 1 | using Ryujinx.Common; |
2 | using Ryujinx.Common.Memory; | 2 | using Ryujinx.Common.Memory; |
3 | using System; | 3 | using System; |
4 | using System.Buffers; | ||
5 | using System.Runtime.Intrinsics; | 4 | using System.Runtime.Intrinsics; |
6 | using static Ryujinx.Graphics.Texture.BlockLinearConstants; | 5 | using static Ryujinx.Graphics.Texture.BlockLinearConstants; |
7 | 6 | ||
@@ -95,7 +94,7 @@ namespace Ryujinx.Graphics.Texture | |||
95 | }; | 94 | }; |
96 | } | 95 | } |
97 | 96 | ||
98 | public static IMemoryOwner<byte> ConvertBlockLinearToLinear( | 97 | public static MemoryOwner<byte> ConvertBlockLinearToLinear( |
99 | int width, | 98 | int width, |
100 | int height, | 99 | int height, |
101 | int depth, | 100 | int depth, |
@@ -121,8 +120,8 @@ namespace Ryujinx.Graphics.Texture | |||
121 | blockHeight, | 120 | blockHeight, |
122 | bytesPerPixel); | 121 | bytesPerPixel); |
123 | 122 | ||
124 | IMemoryOwner<byte> outputOwner = ByteMemoryPool.Rent(outSize); | 123 | MemoryOwner<byte> outputOwner = MemoryOwner<byte>.Rent(outSize); |
125 | Span<byte> output = outputOwner.Memory.Span; | 124 | Span<byte> output = outputOwner.Span; |
126 | 125 | ||
127 | int outOffs = 0; | 126 | int outOffs = 0; |
128 | 127 | ||
@@ -249,7 +248,7 @@ namespace Ryujinx.Graphics.Texture | |||
249 | return outputOwner; | 248 | return outputOwner; |
250 | } | 249 | } |
251 | 250 | ||
252 | public static IMemoryOwner<byte> ConvertLinearStridedToLinear( | 251 | public static MemoryOwner<byte> ConvertLinearStridedToLinear( |
253 | int width, | 252 | int width, |
254 | int height, | 253 | int height, |
255 | int blockWidth, | 254 | int blockWidth, |
@@ -265,8 +264,8 @@ namespace Ryujinx.Graphics.Texture | |||
265 | int outStride = BitUtils.AlignUp(w * bytesPerPixel, HostStrideAlignment); | 264 | int outStride = BitUtils.AlignUp(w * bytesPerPixel, HostStrideAlignment); |
266 | lineSize = Math.Min(lineSize, outStride); | 265 | lineSize = Math.Min(lineSize, outStride); |
267 | 266 | ||
268 | IMemoryOwner<byte> output = ByteMemoryPool.Rent(h * outStride); | 267 | MemoryOwner<byte> output = MemoryOwner<byte>.Rent(h * outStride); |
269 | Span<byte> outSpan = output.Memory.Span; | 268 | Span<byte> outSpan = output.Span; |
270 | 269 | ||
271 | int outOffs = 0; | 270 | int outOffs = 0; |
272 | int inOffs = 0; | 271 | int inOffs = 0; |
diff --git a/src/Ryujinx.Graphics.Texture/PixelConverter.cs b/src/Ryujinx.Graphics.Texture/PixelConverter.cs index 4475cc98a..3676d9199 100644 --- a/src/Ryujinx.Graphics.Texture/PixelConverter.cs +++ b/src/Ryujinx.Graphics.Texture/PixelConverter.cs | |||
@@ -1,7 +1,6 @@ | |||
1 | using Ryujinx.Common; | 1 | using Ryujinx.Common; |
2 | using Ryujinx.Common.Memory; | 2 | using Ryujinx.Common.Memory; |
3 | using System; | 3 | using System; |
4 | using System.Buffers; | ||
5 | using System.Runtime.InteropServices; | 4 | using System.Runtime.InteropServices; |
6 | using System.Runtime.Intrinsics; | 5 | using System.Runtime.Intrinsics; |
7 | using System.Runtime.Intrinsics.X86; | 6 | using System.Runtime.Intrinsics.X86; |
@@ -21,13 +20,14 @@ namespace Ryujinx.Graphics.Texture | |||
21 | return (remainder, outRemainder, length / stride); | 20 | return (remainder, outRemainder, length / stride); |
22 | } | 21 | } |
23 | 22 | ||
24 | public unsafe static IMemoryOwner<byte> ConvertR4G4ToR4G4B4A4(ReadOnlySpan<byte> data, int width) | 23 | public unsafe static MemoryOwner<byte> ConvertR4G4ToR4G4B4A4(ReadOnlySpan<byte> data, int width) |
25 | { | 24 | { |
26 | IMemoryOwner<byte> output = ByteMemoryPool.Rent(data.Length * 2); | 25 | MemoryOwner<byte> output = MemoryOwner<byte>.Rent(data.Length * 2); |
26 | Span<byte> outputSpan = output.Span; | ||
27 | 27 | ||
28 | (int remainder, int outRemainder, int height) = GetLineRemainders(data.Length, width, 1, 2); | 28 | (int remainder, int outRemainder, int height) = GetLineRemainders(data.Length, width, 1, 2); |
29 | 29 | ||
30 | Span<ushort> outputSpan = MemoryMarshal.Cast<byte, ushort>(output.Memory.Span); | 30 | Span<ushort> outputSpanUInt16 = MemoryMarshal.Cast<byte, ushort>(outputSpan); |
31 | 31 | ||
32 | if (remainder == 0) | 32 | if (remainder == 0) |
33 | { | 33 | { |
@@ -38,7 +38,7 @@ namespace Ryujinx.Graphics.Texture | |||
38 | int sizeTrunc = data.Length & ~7; | 38 | int sizeTrunc = data.Length & ~7; |
39 | start = sizeTrunc; | 39 | start = sizeTrunc; |
40 | 40 | ||
41 | fixed (byte* inputPtr = data, outputPtr = output.Memory.Span) | 41 | fixed (byte* inputPtr = data, outputPtr = outputSpan) |
42 | { | 42 | { |
43 | for (ulong offset = 0; offset < (ulong)sizeTrunc; offset += 8) | 43 | for (ulong offset = 0; offset < (ulong)sizeTrunc; offset += 8) |
44 | { | 44 | { |
@@ -49,7 +49,7 @@ namespace Ryujinx.Graphics.Texture | |||
49 | 49 | ||
50 | for (int i = start; i < data.Length; i++) | 50 | for (int i = start; i < data.Length; i++) |
51 | { | 51 | { |
52 | outputSpan[i] = data[i]; | 52 | outputSpanUInt16[i] = data[i]; |
53 | } | 53 | } |
54 | } | 54 | } |
55 | else | 55 | else |
@@ -61,7 +61,7 @@ namespace Ryujinx.Graphics.Texture | |||
61 | { | 61 | { |
62 | for (int x = 0; x < width; x++) | 62 | for (int x = 0; x < width; x++) |
63 | { | 63 | { |
64 | outputSpan[outOffset++] = data[offset++]; | 64 | outputSpanUInt16[outOffset++] = data[offset++]; |
65 | } | 65 | } |
66 | 66 | ||
67 | offset += remainder; | 67 | offset += remainder; |
@@ -72,16 +72,16 @@ namespace Ryujinx.Graphics.Texture | |||
72 | return output; | 72 | return output; |
73 | } | 73 | } |
74 | 74 | ||
75 | public static IMemoryOwner<byte> ConvertR5G6B5ToR8G8B8A8(ReadOnlySpan<byte> data, int width) | 75 | public static MemoryOwner<byte> ConvertR5G6B5ToR8G8B8A8(ReadOnlySpan<byte> data, int width) |
76 | { | 76 | { |
77 | IMemoryOwner<byte> output = ByteMemoryPool.Rent(data.Length * 2); | 77 | MemoryOwner<byte> output = MemoryOwner<byte>.Rent(data.Length * 2); |
78 | int offset = 0; | 78 | int offset = 0; |
79 | int outOffset = 0; | 79 | int outOffset = 0; |
80 | 80 | ||
81 | (int remainder, int outRemainder, int height) = GetLineRemainders(data.Length, width, 2, 4); | 81 | (int remainder, int outRemainder, int height) = GetLineRemainders(data.Length, width, 2, 4); |
82 | 82 | ||
83 | ReadOnlySpan<ushort> inputSpan = MemoryMarshal.Cast<byte, ushort>(data); | 83 | ReadOnlySpan<ushort> inputSpan = MemoryMarshal.Cast<byte, ushort>(data); |
84 | Span<uint> outputSpan = MemoryMarshal.Cast<byte, uint>(output.Memory.Span); | 84 | Span<uint> outputSpan = MemoryMarshal.Cast<byte, uint>(output.Span); |
85 | 85 | ||
86 | for (int y = 0; y < height; y++) | 86 | for (int y = 0; y < height; y++) |
87 | { | 87 | { |
@@ -109,16 +109,16 @@ namespace Ryujinx.Graphics.Texture | |||
109 | return output; | 109 | return output; |
110 | } | 110 | } |
111 | 111 | ||
112 | public static IMemoryOwner<byte> ConvertR5G5B5ToR8G8B8A8(ReadOnlySpan<byte> data, int width, bool forceAlpha) | 112 | public static MemoryOwner<byte> ConvertR5G5B5ToR8G8B8A8(ReadOnlySpan<byte> data, int width, bool forceAlpha) |
113 | { | 113 | { |
114 | IMemoryOwner<byte> output = ByteMemoryPool.Rent(data.Length * 2); | 114 | MemoryOwner<byte> output = MemoryOwner<byte>.Rent(data.Length * 2); |
115 | int offset = 0; | 115 | int offset = 0; |
116 | int outOffset = 0; | 116 | int outOffset = 0; |
117 | 117 | ||
118 | (int remainder, int outRemainder, int height) = GetLineRemainders(data.Length, width, 2, 4); | 118 | (int remainder, int outRemainder, int height) = GetLineRemainders(data.Length, width, 2, 4); |
119 | 119 | ||
120 | ReadOnlySpan<ushort> inputSpan = MemoryMarshal.Cast<byte, ushort>(data); | 120 | ReadOnlySpan<ushort> inputSpan = MemoryMarshal.Cast<byte, ushort>(data); |
121 | Span<uint> outputSpan = MemoryMarshal.Cast<byte, uint>(output.Memory.Span); | 121 | Span<uint> outputSpan = MemoryMarshal.Cast<byte, uint>(output.Span); |
122 | 122 | ||
123 | for (int y = 0; y < height; y++) | 123 | for (int y = 0; y < height; y++) |
124 | { | 124 | { |
@@ -146,16 +146,16 @@ namespace Ryujinx.Graphics.Texture | |||
146 | return output; | 146 | return output; |
147 | } | 147 | } |
148 | 148 | ||
149 | public static IMemoryOwner<byte> ConvertA1B5G5R5ToR8G8B8A8(ReadOnlySpan<byte> data, int width) | 149 | public static MemoryOwner<byte> ConvertA1B5G5R5ToR8G8B8A8(ReadOnlySpan<byte> data, int width) |
150 | { | 150 | { |
151 | IMemoryOwner<byte> output = ByteMemoryPool.Rent(data.Length * 2); | 151 | MemoryOwner<byte> output = MemoryOwner<byte>.Rent(data.Length * 2); |
152 | int offset = 0; | 152 | int offset = 0; |
153 | int outOffset = 0; | 153 | int outOffset = 0; |
154 | 154 | ||
155 | (int remainder, int outRemainder, int height) = GetLineRemainders(data.Length, width, 2, 4); | 155 | (int remainder, int outRemainder, int height) = GetLineRemainders(data.Length, width, 2, 4); |
156 | 156 | ||
157 | ReadOnlySpan<ushort> inputSpan = MemoryMarshal.Cast<byte, ushort>(data); | 157 | ReadOnlySpan<ushort> inputSpan = MemoryMarshal.Cast<byte, ushort>(data); |
158 | Span<uint> outputSpan = MemoryMarshal.Cast<byte, uint>(output.Memory.Span); | 158 | Span<uint> outputSpan = MemoryMarshal.Cast<byte, uint>(output.Span); |
159 | 159 | ||
160 | for (int y = 0; y < height; y++) | 160 | for (int y = 0; y < height; y++) |
161 | { | 161 | { |
@@ -183,16 +183,16 @@ namespace Ryujinx.Graphics.Texture | |||
183 | return output; | 183 | return output; |
184 | } | 184 | } |
185 | 185 | ||
186 | public static IMemoryOwner<byte> ConvertR4G4B4A4ToR8G8B8A8(ReadOnlySpan<byte> data, int width) | 186 | public static MemoryOwner<byte> ConvertR4G4B4A4ToR8G8B8A8(ReadOnlySpan<byte> data, int width) |
187 | { | 187 | { |
188 | IMemoryOwner<byte> output = ByteMemoryPool.Rent(data.Length * 2); | 188 | MemoryOwner<byte> output = MemoryOwner<byte>.Rent(data.Length * 2); |
189 | int offset = 0; | 189 | int offset = 0; |
190 | int outOffset = 0; | 190 | int outOffset = 0; |
191 | 191 | ||
192 | (int remainder, int outRemainder, int height) = GetLineRemainders(data.Length, width, 2, 4); | 192 | (int remainder, int outRemainder, int height) = GetLineRemainders(data.Length, width, 2, 4); |
193 | 193 | ||
194 | ReadOnlySpan<ushort> inputSpan = MemoryMarshal.Cast<byte, ushort>(data); | 194 | ReadOnlySpan<ushort> inputSpan = MemoryMarshal.Cast<byte, ushort>(data); |
195 | Span<uint> outputSpan = MemoryMarshal.Cast<byte, uint>(output.Memory.Span); | 195 | Span<uint> outputSpan = MemoryMarshal.Cast<byte, uint>(output.Span); |
196 | 196 | ||
197 | for (int y = 0; y < height; y++) | 197 | for (int y = 0; y < height; y++) |
198 | { | 198 | { |
diff --git a/src/Ryujinx.Graphics.Vulkan/DescriptorSetUpdater.cs b/src/Ryujinx.Graphics.Vulkan/DescriptorSetUpdater.cs index 75ffca2ca..563fdafd3 100644 --- a/src/Ryujinx.Graphics.Vulkan/DescriptorSetUpdater.cs +++ b/src/Ryujinx.Graphics.Vulkan/DescriptorSetUpdater.cs | |||
@@ -211,7 +211,7 @@ namespace Ryujinx.Graphics.Vulkan | |||
211 | 211 | ||
212 | public void Initialize() | 212 | public void Initialize() |
213 | { | 213 | { |
214 | IMemoryOwner<byte> dummyTextureData = ByteMemoryPool.RentCleared(4); | 214 | MemoryOwner<byte> dummyTextureData = MemoryOwner<byte>.RentCleared(4); |
215 | _dummyTexture.SetData(dummyTextureData); | 215 | _dummyTexture.SetData(dummyTextureData); |
216 | } | 216 | } |
217 | 217 | ||