aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics/Shader/StructuredIr/OperandInfo.cs
blob: a3a8d138399510050eeeafe7fe49b2b0d78f90d9 (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
using Ryujinx.Graphics.Shader.IntermediateRepresentation;
using System;

namespace Ryujinx.Graphics.Shader.StructuredIr
{
    static class OperandInfo
    {
        public static VariableType GetVarType(AstOperand operand)
        {
            if (operand.Type == OperandType.LocalVariable)
            {
                return operand.VarType;
            }
            else
            {
                return GetVarType(operand.Type);
            }
        }

        public static VariableType GetVarType(OperandType type)
        {
            switch (type)
            {
                case OperandType.Attribute:      return VariableType.F32;
                case OperandType.Constant:       return VariableType.S32;
                case OperandType.ConstantBuffer: return VariableType.F32;
                case OperandType.GlobalMemory:   return VariableType.F32;
                case OperandType.Undefined:      return VariableType.S32;
            }

            throw new ArgumentException($"Invalid operand type \"{type}\".");
        }
    }
}