MemoryExtensions.cs
1 using Ryujinx.Graphics.Device; 2 using System; 3 4 namespace Ryujinx.Graphics.Nvdec 5 { 6 static class MemoryExtensions 7 { 8 public static T DeviceRead<T>(this DeviceMemoryManager gmm, uint offset) where T : unmanaged 9 { 10 return gmm.Read<T>(ExtendOffset(offset)); 11 } 12 13 public static ReadOnlySpan<byte> DeviceGetSpan(this DeviceMemoryManager gmm, uint offset, int size) 14 { 15 return gmm.GetSpan(ExtendOffset(offset), size); 16 } 17 18 public static void DeviceWrite(this DeviceMemoryManager gmm, uint offset, ReadOnlySpan<byte> data) 19 { 20 gmm.Write(ExtendOffset(offset), data); 21 } 22 23 public static ulong ExtendOffset(uint offset) 24 { 25 return (ulong)offset << 8; 26 } 27 } 28 }