TextureType.cs 827 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
  3. {
  4. [Flags]
  5. enum TextureType
  6. {
  7. Texture1D,
  8. Texture2D,
  9. Texture3D,
  10. TextureCube,
  11. Mask = 0xff,
  12. Array = 1 << 8,
  13. Multisample = 1 << 9,
  14. Shadow = 1 << 10
  15. }
  16. static class TextureTypeExtensions
  17. {
  18. public static int GetCoordsCount(this TextureType type)
  19. {
  20. switch (type & TextureType.Mask)
  21. {
  22. case TextureType.Texture1D: return 1;
  23. case TextureType.Texture2D: return 2;
  24. case TextureType.Texture3D: return 3;
  25. case TextureType.TextureCube: return 3;
  26. }
  27. throw new ArgumentException($"Invalid texture type \"{type}\".");
  28. }
  29. }
  30. }