aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics/Gpu/NsGpu.cs
blob: 133d0af25b770a0798e0f08e0da54cc50c6b5c9a (plain)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using ChocolArm64.Memory;
using Ryujinx.Graphics.Gal;

namespace Ryujinx.Graphics.Gpu
{
    public class NsGpu
    {
        public IGalRenderer Renderer { get; private set; }

        internal NsGpuMemoryMgr MemoryMgr { get; private set; }

        internal NsGpuPGraph PGraph { get; private set; }

        public NsGpu(IGalRenderer Renderer)
        {
            this.Renderer = Renderer;

            MemoryMgr = new NsGpuMemoryMgr();

            PGraph = new NsGpuPGraph(this);
        }

        public long GetCpuAddr(long Position)
        {
            return MemoryMgr.GetCpuAddr(Position);
        }

        public long MapMemory(long CpuAddr, long Size)
        {
            return MemoryMgr.Map(CpuAddr, Size);
        }

        public long MapMemory(long CpuAddr, long GpuAddr, long Size)
        {
            return MemoryMgr.Map(CpuAddr, GpuAddr, Size);
        }

        public void ProcessPushBuffer(NsGpuPBEntry[] PushBuffer, AMemory Memory)
        {
            PGraph.ProcessPushBuffer(PushBuffer, Memory);
        }

        public long ReserveMemory(long Size, long Align)
        {
            return MemoryMgr.Reserve(Size, Align);
        }

        public long ReserveMemory(long GpuAddr, long Size, long Align)
        {
            return MemoryMgr.Reserve(GpuAddr, Size, Align);
        }
    }
}