EnumConversion.cs 819 B

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