aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Core/Gpu/NvGpu.cs
blob: 0fca7b9923a2f824b5a57c9c6987cd2e720cc10b (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
using Ryujinx.Graphics.Gal;
using System.Threading;

namespace Ryujinx.Core.Gpu
{
    class NvGpu
    {
        public IGalRenderer Renderer { get; private set; }

        public NvGpuFifo Fifo { get; private set; }

        public NvGpuEngine2d Engine2d { get; private set; }
        public NvGpuEngine3d Engine3d { get; private set; }

        private Thread FifoProcessing;

        private bool KeepRunning;

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

            Fifo = new NvGpuFifo(this);

            Engine2d = new NvGpuEngine2d(this);
            Engine3d = new NvGpuEngine3d(this);

            KeepRunning = true;

            FifoProcessing = new Thread(ProcessFifo);

            FifoProcessing.Start();
        }

        private void ProcessFifo()
        {
            while (KeepRunning)
            {
                Fifo.DispatchCalls();

                Thread.Yield();
            }
        }
    }
}