aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Shader/StructuredIr/StructuredFunction.cs
blob: 61c4fed730a135945c73e0ea6436ea0bdf5540fe (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
using Ryujinx.Graphics.Shader.Translation;
using System.Collections.Generic;

namespace Ryujinx.Graphics.Shader.StructuredIr
{
    class StructuredFunction
    {
        public AstBlock MainBlock { get; }

        public string Name { get; }

        public AggregateType ReturnType { get; }

        public AggregateType[] InArguments { get; }
        public AggregateType[] OutArguments { get; }

        public HashSet<AstOperand> Locals { get; }

        public StructuredFunction(
            AstBlock mainBlock,
            string name,
            AggregateType returnType,
            AggregateType[] inArguments,
            AggregateType[] outArguments)
        {
            MainBlock = mainBlock;
            Name = name;
            ReturnType = returnType;
            InArguments = inArguments;
            OutArguments = outArguments;

            Locals = new HashSet<AstOperand>();
        }

        public AggregateType GetArgumentType(int index)
        {
            return index >= InArguments.Length
                ? OutArguments[index - InArguments.Length]
                : InArguments[index];
        }
    }
}