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.

ShaderStrippingSetting.cs 3.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. using System;
  2. namespace UnityEngine.Rendering
  3. {
  4. /// <summary>
  5. /// Specifies the logging level for shader variants
  6. /// </summary>
  7. public enum ShaderVariantLogLevel
  8. {
  9. /// <summary>Disable all log for Shader Variant</summary>
  10. [Tooltip("No shader variants are logged")]
  11. Disabled,
  12. /// <summary>Only logs SRP Shaders when logging Shader Variant</summary>
  13. [Tooltip("Only shaders that are compatible with SRPs (e.g., URP, HDRP) are logged")]
  14. OnlySRPShaders,
  15. /// <summary>Logs all Shader Variant</summary>
  16. [Tooltip("All shader variants are logged")]
  17. AllShaders,
  18. }
  19. /// <summary>
  20. /// Class that stores shader stripping settings shared between all pipelines
  21. /// </summary>
  22. [Serializable]
  23. [SupportedOnRenderPipeline]
  24. [Categorization.CategoryInfo(Name = "Additional Shader Stripping Settings", Order = 40)]
  25. [Categorization.ElementInfo(Order = 0)]
  26. public class ShaderStrippingSetting : IRenderPipelineGraphicsSettings
  27. {
  28. #region Version
  29. internal enum Version : int
  30. {
  31. Initial = 0,
  32. }
  33. [SerializeField] [HideInInspector]
  34. private Version m_Version = Version.Initial;
  35. /// <summary>Current version.</summary>
  36. public int version => (int)m_Version;
  37. #endregion
  38. bool IRenderPipelineGraphicsSettings.isAvailableInPlayerBuild => true;
  39. #region SerializeFields
  40. [SerializeField]
  41. [Tooltip("Controls whether to output shader variant information to a file.")]
  42. private bool m_ExportShaderVariants = true;
  43. [SerializeField]
  44. [Tooltip("Controls the level of logging of shader variant information outputted during the build process. Information appears in the Unity Console when the build finishes.")]
  45. private ShaderVariantLogLevel m_ShaderVariantLogLevel = ShaderVariantLogLevel.Disabled;
  46. [SerializeField]
  47. [Tooltip("When enabled, all debug display shader variants are removed when you build for the Unity Player. This decreases build time, but prevents the use of most Rendering Debugger features in Player builds.")]
  48. private bool m_StripRuntimeDebugShaders = true;
  49. #endregion
  50. #region Data Accessors
  51. /// <summary>
  52. /// Controls whether to output shader variant information to a file.
  53. /// </summary>
  54. public bool exportShaderVariants
  55. {
  56. get => m_ExportShaderVariants;
  57. set => this.SetValueAndNotify(ref m_ExportShaderVariants, value);
  58. }
  59. /// <summary>
  60. /// Controls the level of logging of shader variant information outputted during the build process.
  61. /// Information appears in the Unity Console when the build finishes.
  62. /// </summary>
  63. public ShaderVariantLogLevel shaderVariantLogLevel
  64. {
  65. get => m_ShaderVariantLogLevel;
  66. set => this.SetValueAndNotify(ref m_ShaderVariantLogLevel, value);
  67. }
  68. /// <summary>
  69. /// When enabled, all debug display shader variants are removed when you build for the Unity Player.
  70. /// This decreases build time, but prevents the use of most Rendering Debugger features in Player builds.
  71. /// </summary>
  72. public bool stripRuntimeDebugShaders
  73. {
  74. get => m_StripRuntimeDebugShaders;
  75. set => this.SetValueAndNotify(ref m_StripRuntimeDebugShaders, value);
  76. }
  77. #endregion
  78. }
  79. }