aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.GAL/Multithreading/Model/TableRef.cs
blob: d3a5a14e812c865a2968f64f5809d20d0ff44c79 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
namespace Ryujinx.Graphics.GAL.Multithreading.Model
{
    readonly struct TableRef<T>
    {
        private readonly int _index;

        public TableRef(ThreadedRenderer renderer, T reference)
        {
            _index = renderer.AddTableRef(reference);
        }

        public T Get(ThreadedRenderer renderer)
        {
            return (T)renderer.RemoveTableRef(_index);
        }

        public T2 GetAs<T2>(ThreadedRenderer renderer) where T2 : T
        {
            return (T2)renderer.RemoveTableRef(_index);
        }
    }
}