AttributeType.cs 1.0 KB

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