mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2024-12-23 04:35:46 +00:00
f241f88558
* Add a separate device memory manager * Still need this * Device writes are always tracked * Device writes are always tracked (2) * Rename more instances of gmm to mm
28 lines
786 B
C#
28 lines
786 B
C#
using Ryujinx.Graphics.Device;
|
|
using System;
|
|
|
|
namespace Ryujinx.Graphics.Nvdec
|
|
{
|
|
static class MemoryExtensions
|
|
{
|
|
public static T DeviceRead<T>(this DeviceMemoryManager gmm, uint offset) where T : unmanaged
|
|
{
|
|
return gmm.Read<T>(ExtendOffset(offset));
|
|
}
|
|
|
|
public static ReadOnlySpan<byte> DeviceGetSpan(this DeviceMemoryManager gmm, uint offset, int size)
|
|
{
|
|
return gmm.GetSpan(ExtendOffset(offset), size);
|
|
}
|
|
|
|
public static void DeviceWrite(this DeviceMemoryManager gmm, uint offset, ReadOnlySpan<byte> data)
|
|
{
|
|
gmm.Write(ExtendOffset(offset), data);
|
|
}
|
|
|
|
public static ulong ExtendOffset(uint offset)
|
|
{
|
|
return (ulong)offset << 8;
|
|
}
|
|
}
|
|
}
|