aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/TextureDescriptor.cs
blob: b39d6c3d1a5fc70ea5eeb5783fbf03e99b4281df (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
54
55
56
57
namespace Ryujinx.Graphics.Shader
{
    public struct TextureDescriptor
    {
        public int Binding { get; }

        public SamplerType Type { get; }

        public TextureFormat Format { get; }

        public int HandleIndex { get; }

        public bool IsBindless { get; }

        public int CbufSlot   { get; }
        public int CbufOffset { get; }

        public TextureUsageFlags Flags { get; set; }

        public TextureDescriptor(int binding, SamplerType type, TextureFormat format, int handleIndex)
        {
            Binding     = binding;
            Type        = type;
            Format      = format;
            HandleIndex = handleIndex;

            IsBindless = false;

            CbufSlot   = 0;
            CbufOffset = 0;

            Flags = TextureUsageFlags.None;
        }

        public TextureDescriptor(int binding, SamplerType type, int cbufSlot, int cbufOffset)
        {
            Binding     = binding;
            Type        = type;
            Format      = TextureFormat.Unknown;
            HandleIndex = 0;

            IsBindless = true;

            CbufSlot   = cbufSlot;
            CbufOffset = cbufOffset;

            Flags = TextureUsageFlags.None;
        }

        public TextureDescriptor SetFlag(TextureUsageFlags flag)
        {
            Flags |= flag;

            return this;
        }
    }
}