aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Nvdec/MemoryExtensions.cs
blob: 2855a8c7fccc2a6ded6322fd410d3f46a0b6dac1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using Ryujinx.Graphics.Gpu.Memory;
using System;

namespace Ryujinx.Graphics.Nvdec
{
    static class MemoryExtensions
    {
        public static T DeviceRead<T>(this MemoryManager gmm, uint offset) where T : unmanaged
        {
            return gmm.Read<T>((ulong)offset << 8);
        }

        public static ReadOnlySpan<byte> DeviceGetSpan(this MemoryManager gmm, uint offset, int size)
        {
            return gmm.GetSpan((ulong)offset << 8, size);
        }

        public static void DeviceWrite(this MemoryManager gmm, uint offset, ReadOnlySpan<byte> data)
        {
            gmm.Write((ulong)offset << 8, data);
        }

        public static ulong ExtendOffset(uint offset)
        {
            return (ulong)offset << 8;
        }
    }
}