TextureComponent.cs 1.2 KB

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