Ingen beskrivning
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Platform.cs 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using System;
  2. namespace UnityEditor.ShaderGraph
  3. {
  4. [GenerationAPI]
  5. internal enum Platform
  6. {
  7. D3D11,
  8. GLCore,
  9. GLES3,
  10. Metal,
  11. Vulkan,
  12. D3D9,
  13. XboxOne,
  14. GameCoreXboxOne,
  15. GameCoreXboxSeries,
  16. Playstation,
  17. Switch,
  18. PS5,
  19. }
  20. [GenerationAPI]
  21. internal static class PlatformExtensions
  22. {
  23. public static string ToShaderString(this Platform platform)
  24. {
  25. switch (platform)
  26. {
  27. case Platform.D3D11:
  28. return "d3d11";
  29. case Platform.GLCore:
  30. return "glcore";
  31. case Platform.GLES3:
  32. return "gles3";
  33. case Platform.Metal:
  34. return "metal";
  35. case Platform.Vulkan:
  36. return "vulkan";
  37. case Platform.D3D9:
  38. return "d3d11_9x";
  39. case Platform.XboxOne:
  40. return "xboxone";
  41. case Platform.GameCoreXboxOne:
  42. return "xboxone";
  43. case Platform.GameCoreXboxSeries:
  44. return "xboxseries";
  45. case Platform.Playstation:
  46. return "playstation";
  47. case Platform.Switch:
  48. return "switch";
  49. case Platform.PS5:
  50. return "ps5";
  51. default:
  52. throw new ArgumentOutOfRangeException();
  53. }
  54. }
  55. }
  56. internal static class PragmaRenderers
  57. {
  58. // Return high end platform list for the only renderer directive (The list use by HDRP)
  59. internal static Platform[] GetHighEndPlatformArray()
  60. {
  61. return new Platform[] { Platform.D3D11, Platform.Playstation, Platform.XboxOne, Platform.GameCoreXboxSeries, Platform.Vulkan, Platform.Metal, Platform.Switch };
  62. }
  63. // Return platform list not compatible with DXC (The list use by HDRP)
  64. internal static Platform[] GetNeverUseDXCPlatformArray()
  65. {
  66. return new Platform[] { Platform.Metal };
  67. }
  68. }
  69. }