EnumConversion.cs 862 B

1234567891011121314151617181920212223
  1. using Ryujinx.Graphics.Shader.Translation;
  2. using System;
  3. using static Spv.Specification;
  4. namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
  5. {
  6. static class EnumConversion
  7. {
  8. public static ExecutionModel Convert(this ShaderStage stage)
  9. {
  10. return stage switch
  11. {
  12. ShaderStage.Compute => ExecutionModel.GLCompute,
  13. ShaderStage.Vertex => ExecutionModel.Vertex,
  14. ShaderStage.TessellationControl => ExecutionModel.TessellationControl,
  15. ShaderStage.TessellationEvaluation => ExecutionModel.TessellationEvaluation,
  16. ShaderStage.Geometry => ExecutionModel.Geometry,
  17. ShaderStage.Fragment => ExecutionModel.Fragment,
  18. _ => throw new ArgumentException($"Invalid shader stage \"{stage}\".")
  19. };
  20. }
  21. }
  22. }