/ src / Ryujinx.Graphics.Gpu / Image / TextureComponent.cs
TextureComponent.cs
 1  using Ryujinx.Graphics.GAL;
 2  
 3  namespace Ryujinx.Graphics.Gpu.Image
 4  {
 5      /// <summary>
 6      /// Texture swizzle color component.
 7      /// </summary>
 8      enum TextureComponent
 9      {
10          Zero = 0,
11          Red = 2,
12          Green = 3,
13          Blue = 4,
14          Alpha = 5,
15          OneSI = 6,
16          OneF = 7,
17      }
18  
19      static class TextureComponentConverter
20      {
21          /// <summary>
22          /// Converts the texture swizzle color component enum to the respective Graphics Abstraction Layer enum.
23          /// </summary>
24          /// <param name="component">Texture swizzle color component</param>
25          /// <returns>Converted enum</returns>
26          public static SwizzleComponent Convert(this TextureComponent component)
27          {
28              return component switch
29              {
30                  TextureComponent.Zero => SwizzleComponent.Zero,
31                  TextureComponent.Red => SwizzleComponent.Red,
32                  TextureComponent.Green => SwizzleComponent.Green,
33                  TextureComponent.Blue => SwizzleComponent.Blue,
34                  TextureComponent.Alpha => SwizzleComponent.Alpha,
35                  TextureComponent.OneSI or TextureComponent.OneF => SwizzleComponent.One,
36                  _ => SwizzleComponent.Zero,
37              };
38          }
39      }
40  }