PrecisionUtil.cs 981 B

1234567891011121314151617181920212223242526272829303132333435
  1. using UnityEditor.ShaderGraph.Internal;
  2. namespace UnityEditor.ShaderGraph
  3. {
  4. internal static class PrecisionUtil
  5. {
  6. internal const string Token = "$precision";
  7. internal static string ToShaderString(this ConcretePrecision precision)
  8. {
  9. switch(precision)
  10. {
  11. case ConcretePrecision.Float:
  12. return "float";
  13. case ConcretePrecision.Half:
  14. return "half";
  15. default:
  16. return "float";
  17. }
  18. }
  19. internal static ConcretePrecision ToConcrete(this Precision precision)
  20. {
  21. switch(precision)
  22. {
  23. case Precision.Float:
  24. return ConcretePrecision.Float;
  25. case Precision.Half:
  26. return ConcretePrecision.Half;
  27. default:
  28. return ConcretePrecision.Float;
  29. }
  30. }
  31. }
  32. }