aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics/Gal/Shader/ShaderDecodeFlow.cs
blob: bc2539bd7e64a80f593ae6eebfc3ed5253427d13 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System;

namespace Ryujinx.Graphics.Gal.Shader
{
    static partial class ShaderDecode
    {
        public static void Bra(ShaderIrBlock Block, long OpCode, int Position)
        {
            if ((OpCode & 0x20) != 0)
            {
                //This reads the target offset from the constant buffer.
                //Almost impossible to support with GLSL.
                throw new NotImplementedException();
            }

            ShaderIrOperImm Imm = new ShaderIrOperImm(Position + OpCode.Branch());

            Block.AddNode(OpCode.PredNode(new ShaderIrOp(ShaderIrInst.Bra, Imm)));
        }

        public static void Exit(ShaderIrBlock Block, long OpCode, int Position)
        {
            int CCode = (int)OpCode & 0x1f;

            //TODO: Figure out what the other condition codes mean...
            if (CCode == 0xf)
            {
                Block.AddNode(OpCode.PredNode(new ShaderIrOp(ShaderIrInst.Exit)));
            }
        }

        public static void Kil(ShaderIrBlock Block, long OpCode, int Position)
        {
            Block.AddNode(OpCode.PredNode(new ShaderIrOp(ShaderIrInst.Kil)));
        }

        public static void Ssy(ShaderIrBlock Block, long OpCode, int Position)
        {
            if ((OpCode & 0x20) != 0)
            {
                //This reads the target offset from the constant buffer.
                //Almost impossible to support with GLSL.
                throw new NotImplementedException();
            }

            ShaderIrOperImm Imm = new ShaderIrOperImm(Position + OpCode.Branch());

            Block.AddNode(new ShaderIrOp(ShaderIrInst.Ssy, Imm));
        }

        public static void Sync(ShaderIrBlock Block, long OpCode, int Position)
        {
            //TODO: Implement Sync condition codes
            Block.AddNode(OpCode.PredNode(new ShaderIrOp(ShaderIrInst.Sync)));
        }
    }
}