SamplerType.cs 944 B

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