TextureComponent.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. switch (component)
  27. {
  28. case TextureComponent.Zero: return SwizzleComponent.Zero;
  29. case TextureComponent.Red: return SwizzleComponent.Red;
  30. case TextureComponent.Green: return SwizzleComponent.Green;
  31. case TextureComponent.Blue: return SwizzleComponent.Blue;
  32. case TextureComponent.Alpha: return SwizzleComponent.Alpha;
  33. case TextureComponent.OneSI:
  34. case TextureComponent.OneF:
  35. return SwizzleComponent.One;
  36. }
  37. return SwizzleComponent.Zero;
  38. }
  39. }
  40. }