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

namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
{
    [Flags]
    enum TextureType
    {
        Texture1D,
        Texture2D,
        Texture3D,
        TextureCube,

        Mask = 0xff,

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

    static class TextureTypeExtensions
    {
        public static int GetCoordsCount(this TextureType type)
        {
            switch (type & TextureType.Mask)
            {
                case TextureType.Texture1D:   return 1;
                case TextureType.Texture2D:   return 2;
                case TextureType.Texture3D:   return 3;
                case TextureType.TextureCube: return 3;
            }

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