aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/AttributeType.cs
blob: 466f06cc8034e0af3a6172532c66f7bb1b6d6403 (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
using System;

namespace Ryujinx.Graphics.Shader
{
    public enum AttributeType : byte
    {
        Float,
        Sint,
        Uint
    }

    static class AttributeTypeExtensions
    {
        public static string GetScalarType(this AttributeType type)
        {
            return type switch
            {
                AttributeType.Float => "float",
                AttributeType.Sint => "int",
                AttributeType.Uint => "uint",
                _ => throw new ArgumentException($"Invalid attribute type \"{type}\".")
            };
        }

        public static string GetVec4Type(this AttributeType type)
        {
            return type switch
            {
                AttributeType.Float => "vec4",
                AttributeType.Sint => "ivec4",
                AttributeType.Uint => "uvec4",
                _ => throw new ArgumentException($"Invalid attribute type \"{type}\".")
            };
        }
    }
}