aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/IntermediateRepresentation/TextureOperation.cs
blob: 9c5cd25c165e6da52b7e8946e0b2774a11bf0a03 (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
namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
{
    class TextureOperation : Operation
    {
        public SamplerType  Type  { get; private set; }
        public TextureFlags Flags { get; private set; }

        public int Handle { get; private set; }

        public TextureFormat Format { get; set; }

        public TextureOperation(
            Instruction      inst,
            SamplerType      type,
            TextureFlags     flags,
            int              handle,
            int              compIndex,
            Operand          dest,
            params Operand[] sources) : base(inst, compIndex, dest, sources)
        {
            Type   = type;
            Flags  = flags;
            Handle = handle;
        }

        public void TurnIntoIndexed(int handle)
        {
            Type |= SamplerType.Indexed;
            Flags &= ~TextureFlags.Bindless;
            Handle = handle;
        }

        public void SetHandle(int handle)
        {
            if ((Flags & TextureFlags.Bindless) != 0)
            {
                Flags &= ~TextureFlags.Bindless;

                RemoveSource(0);
            }

            Handle = handle;
        }
    }
}