aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics/Gal/Shader/ShaderIrOperGpr.cs
blob: b4a5cab4d4531e29ffc246aa34cc83b395cd7cf5 (plain) (blame)
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
namespace Ryujinx.Graphics.Gal.Shader
{
    class ShaderIrOperGpr : ShaderIrNode
    {
        public const int ZRIndex = 0xff;

        public bool IsConst => Index == ZRIndex;

        public bool IsValidRegister => (uint)Index <= ZRIndex;

        public int Index    { get; set; }
        public int HalfPart { get; set; }

        public ShaderRegisterSize RegisterSize { get; private set; }

        public ShaderIrOperGpr(int Index)
        {
            this.Index = Index;

            RegisterSize = ShaderRegisterSize.Single;
        }

        public ShaderIrOperGpr(int Index, int HalfPart)
        {
            this.Index    = Index;
            this.HalfPart = HalfPart;

            RegisterSize = ShaderRegisterSize.Half;
        }

        public static ShaderIrOperGpr MakeTemporary(int Index = 0)
        {
            return new ShaderIrOperGpr(0x100 + Index);
        }
    }
}