aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/SamplerType.cs
blob: 9546efe494b5443c075416ff30235f50c06dc704 (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
37
38
39
using System;

namespace Ryujinx.Graphics.Shader
{
    [Flags]
    public enum SamplerType
    {
        None = 0,
        Texture1D,
        TextureBuffer,
        Texture2D,
        Texture3D,
        TextureCube,

        Mask = 0xff,

        Array       = 1 << 8,
        Indexed     = 1 << 9,
        Multisample = 1 << 10,
        Shadow      = 1 << 11
    }

    static class SamplerTypeExtensions
    {
        public static int GetDimensions(this SamplerType type)
        {
            switch (type & SamplerType.Mask)
            {
                case SamplerType.Texture1D:     return 1;
                case SamplerType.TextureBuffer: return 1;
                case SamplerType.Texture2D:     return 2;
                case SamplerType.Texture3D:     return 3;
                case SamplerType.TextureCube:   return 3;
            }

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