AttributeType.cs 948 B

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. namespace Ryujinx.Graphics.Shader
  3. {
  4. public enum AttributeType : byte
  5. {
  6. Float,
  7. Sint,
  8. Uint
  9. }
  10. static class AttributeTypeExtensions
  11. {
  12. public static string GetScalarType(this AttributeType type)
  13. {
  14. return type switch
  15. {
  16. AttributeType.Float => "float",
  17. AttributeType.Sint => "int",
  18. AttributeType.Uint => "uint",
  19. _ => throw new ArgumentException($"Invalid attribute type \"{type}\".")
  20. };
  21. }
  22. public static string GetVec4Type(this AttributeType type)
  23. {
  24. return type switch
  25. {
  26. AttributeType.Float => "vec4",
  27. AttributeType.Sint => "ivec4",
  28. AttributeType.Uint => "uvec4",
  29. _ => throw new ArgumentException($"Invalid attribute type \"{type}\".")
  30. };
  31. }
  32. }
  33. }