From 7701833818ed5e9bef80d6f0841a1adf441ab2e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Wed, 15 Sep 2021 11:45:32 +0200 Subject: [PATCH 1/5] Move Debugging framework to core --- .../Runtime/Debugging/DebugDisplaySettings.cs | 50 +++++++++++++++++++ .../Debugging}/DebugDisplaySettings.cs.meta | 2 +- .../Debugging}/DebugDisplaySettingsUI.cs | 6 +-- .../Debugging}/DebugDisplaySettingsUI.cs.meta | 0 .../Debugging/IDebugDisplaySettings.cs | 22 ++++++++ .../Debugging/IDebugDisplaySettings.cs.meta | 11 ++++ .../Debugging}/IDebugDisplaySettingsData.cs | 2 +- .../IDebugDisplaySettingsData.cs.meta | 0 .../Debugging}/IDebugDisplaySettingsPanel.cs | 2 +- .../IDebugDisplaySettingsPanel.cs.meta | 0 .../Debugging}/IDebugDisplaySettingsQuery.cs | 2 +- .../IDebugDisplaySettingsQuery.cs.meta | 0 .../Debug/DebugDisplaySettingsCommon.cs | 17 ++++--- .../Runtime/Debug/DebugHandler.cs | 6 +-- ...rsalRenderPipelineDebugDisplaySettings.cs} | 40 +++------------ ...RenderPipelineDebugDisplaySettings.cs.meta | 11 ++++ .../Runtime/ScriptableRenderer.cs | 2 +- .../Runtime/UniversalRenderPipeline.cs | 4 +- 18 files changed, 123 insertions(+), 54 deletions(-) create mode 100644 com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettings.cs rename {com.unity.render-pipelines.universal/Runtime/Debug => com.unity.render-pipelines.core/Runtime/Debugging}/DebugDisplaySettings.cs.meta (83%) rename {com.unity.render-pipelines.universal/Runtime/Debug => com.unity.render-pipelines.core/Runtime/Debugging}/DebugDisplaySettingsUI.cs (94%) rename {com.unity.render-pipelines.universal/Runtime/Debug => com.unity.render-pipelines.core/Runtime/Debugging}/DebugDisplaySettingsUI.cs.meta (100%) create mode 100644 com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettings.cs create mode 100644 com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettings.cs.meta rename {com.unity.render-pipelines.universal/Runtime/Debug => com.unity.render-pipelines.core/Runtime/Debugging}/IDebugDisplaySettingsData.cs (88%) rename {com.unity.render-pipelines.universal/Runtime/Debug => com.unity.render-pipelines.core/Runtime/Debugging}/IDebugDisplaySettingsData.cs.meta (100%) rename {com.unity.render-pipelines.universal/Runtime/Debug => com.unity.render-pipelines.core/Runtime/Debugging}/IDebugDisplaySettingsPanel.cs (91%) rename {com.unity.render-pipelines.universal/Runtime/Debug => com.unity.render-pipelines.core/Runtime/Debugging}/IDebugDisplaySettingsPanel.cs.meta (100%) rename {com.unity.render-pipelines.universal/Runtime/Debug => com.unity.render-pipelines.core/Runtime/Debugging}/IDebugDisplaySettingsQuery.cs (96%) rename {com.unity.render-pipelines.universal/Runtime/Debug => com.unity.render-pipelines.core/Runtime/Debugging}/IDebugDisplaySettingsQuery.cs.meta (100%) rename com.unity.render-pipelines.universal/Runtime/Debug/{DebugDisplaySettings.cs => UniversalRenderPipelineDebugDisplaySettings.cs} (69%) create mode 100644 com.unity.render-pipelines.universal/Runtime/Debug/UniversalRenderPipelineDebugDisplaySettings.cs.meta diff --git a/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettings.cs b/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettings.cs new file mode 100644 index 00000000000..9ab5e26bd52 --- /dev/null +++ b/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettings.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; + +namespace UnityEngine.Rendering +{ + public abstract class DebugDisplaySettings : IDebugDisplaySettings + where T : IDebugDisplaySettings, new() + { + protected readonly HashSet m_Settings = new HashSet(); + + private static readonly Lazy s_Instance = new Lazy(() => + { + var instance = new T(); + instance.Reset(); + return instance; + }); + + /// + /// The singleton instance that contains the current settings of Rendering Debugger. + /// + public static T Instance => s_Instance.Value; + + #region IDebugDisplaySettingsQuery + public abstract bool AreAnySettingsActive { get; } + public abstract bool IsPostProcessingAllowed { get; } + public abstract bool IsLightingActive { get; } + #endregion + + protected TData Add(TData newData) where TData : IDebugDisplaySettingsData + { + m_Settings.Add(newData); + return newData; + } + + public void ForEach(Action onExecute) + { + foreach (IDebugDisplaySettingsData setting in m_Settings) + { + onExecute(setting); + } + } + + public virtual void Reset() + { + m_Settings.Clear(); + } + + public abstract bool TryGetScreenClearColor(ref Color color); + } +} diff --git a/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettings.cs.meta b/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettings.cs.meta similarity index 83% rename from com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettings.cs.meta rename to com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettings.cs.meta index 0bf9f98515a..be5f113b8af 100644 --- a/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettings.cs.meta +++ b/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettings.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9f6344f2dc8b9435db33604d430c83d3 +guid: c4e8d2f4fab62224f8d693e15696410e MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsUI.cs b/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsUI.cs similarity index 94% rename from com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsUI.cs rename to com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsUI.cs index 30680c9e79e..6eba122fd48 100644 --- a/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsUI.cs +++ b/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsUI.cs @@ -1,12 +1,12 @@ using System; using System.Collections.Generic; -namespace UnityEngine.Rendering.Universal +namespace UnityEngine.Rendering { public class DebugDisplaySettingsUI : IDebugData { private IEnumerable m_DisposablePanels; - private DebugDisplaySettings m_Settings; + private IDebugDisplaySettings m_Settings; private void Reset() { @@ -21,7 +21,7 @@ private void Reset() } } - public void RegisterDebug(DebugDisplaySettings settings) + public void RegisterDebug(IDebugDisplaySettings settings) { DebugManager debugManager = DebugManager.instance; List panels = new List(); diff --git a/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsUI.cs.meta b/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsUI.cs.meta similarity index 100% rename from com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsUI.cs.meta rename to com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsUI.cs.meta diff --git a/com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettings.cs b/com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettings.cs new file mode 100644 index 00000000000..a0b5de42c49 --- /dev/null +++ b/com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettings.cs @@ -0,0 +1,22 @@ +using System; +using UnityEngine; + +namespace UnityEngine.Rendering +{ + /// + /// Interface for storing the debug settings + /// + public interface IDebugDisplaySettings : IDebugDisplaySettingsQuery + { + /// + /// Reset the stored debug settings + /// + void Reset(); + + /// + /// Executes an action for each element + /// + /// + void ForEach(Action onExecute); + } +} diff --git a/com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettings.cs.meta b/com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettings.cs.meta new file mode 100644 index 00000000000..be6fc6135e6 --- /dev/null +++ b/com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3be1aff9418ca6840a765320b0c2a2db +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.universal/Runtime/Debug/IDebugDisplaySettingsData.cs b/com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettingsData.cs similarity index 88% rename from com.unity.render-pipelines.universal/Runtime/Debug/IDebugDisplaySettingsData.cs rename to com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettingsData.cs index 241bdb1917c..158aabc04c6 100644 --- a/com.unity.render-pipelines.universal/Runtime/Debug/IDebugDisplaySettingsData.cs +++ b/com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettingsData.cs @@ -1,4 +1,4 @@ -namespace UnityEngine.Rendering.Universal +namespace UnityEngine.Rendering { public interface IDebugDisplaySettingsData : IDebugDisplaySettingsQuery { diff --git a/com.unity.render-pipelines.universal/Runtime/Debug/IDebugDisplaySettingsData.cs.meta b/com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettingsData.cs.meta similarity index 100% rename from com.unity.render-pipelines.universal/Runtime/Debug/IDebugDisplaySettingsData.cs.meta rename to com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettingsData.cs.meta diff --git a/com.unity.render-pipelines.universal/Runtime/Debug/IDebugDisplaySettingsPanel.cs b/com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettingsPanel.cs similarity index 91% rename from com.unity.render-pipelines.universal/Runtime/Debug/IDebugDisplaySettingsPanel.cs rename to com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettingsPanel.cs index 770b66fa26c..08e825de271 100644 --- a/com.unity.render-pipelines.universal/Runtime/Debug/IDebugDisplaySettingsPanel.cs +++ b/com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettingsPanel.cs @@ -1,6 +1,6 @@ using System; -namespace UnityEngine.Rendering.Universal +namespace UnityEngine.Rendering { public interface IDebugDisplaySettingsPanel { diff --git a/com.unity.render-pipelines.universal/Runtime/Debug/IDebugDisplaySettingsPanel.cs.meta b/com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettingsPanel.cs.meta similarity index 100% rename from com.unity.render-pipelines.universal/Runtime/Debug/IDebugDisplaySettingsPanel.cs.meta rename to com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettingsPanel.cs.meta diff --git a/com.unity.render-pipelines.universal/Runtime/Debug/IDebugDisplaySettingsQuery.cs b/com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettingsQuery.cs similarity index 96% rename from com.unity.render-pipelines.universal/Runtime/Debug/IDebugDisplaySettingsQuery.cs rename to com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettingsQuery.cs index 495ea114101..186c0c5be62 100644 --- a/com.unity.render-pipelines.universal/Runtime/Debug/IDebugDisplaySettingsQuery.cs +++ b/com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettingsQuery.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace UnityEngine.Rendering.Universal +namespace UnityEngine.Rendering { /// /// Interface for determining what kind of debug settings are currently active. diff --git a/com.unity.render-pipelines.universal/Runtime/Debug/IDebugDisplaySettingsQuery.cs.meta b/com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettingsQuery.cs.meta similarity index 100% rename from com.unity.render-pipelines.universal/Runtime/Debug/IDebugDisplaySettingsQuery.cs.meta rename to com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettingsQuery.cs.meta diff --git a/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsCommon.cs b/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsCommon.cs index ec93542bfec..d53924c592e 100644 --- a/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsCommon.cs +++ b/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsCommon.cs @@ -13,7 +13,8 @@ private class SettingsPanel : DebugDisplaySettingsPanel public SettingsPanel() { - var materialSettingsData = DebugDisplaySettings.Instance.MaterialSettings; + var debugDisplaySettings = UniversalRenderPipelineDebugDisplaySettings.Instance; + var materialSettingsData = debugDisplaySettings.MaterialSettings; AddWidget(new DebugUI.Foldout { displayName = "Material Filters", @@ -33,7 +34,7 @@ public SettingsPanel() } }); - var lightingSettingsData = DebugDisplaySettings.Instance.LightingSettings; + var lightingSettingsData = debugDisplaySettings.LightingSettings; AddWidget(new DebugUI.Foldout { displayName = "Lighting Debug Modes", @@ -54,7 +55,7 @@ public SettingsPanel() } }); - var renderingSettingsData = DebugDisplaySettings.Instance.RenderingSettings; + var renderingSettingsData = debugDisplaySettings.RenderingSettings; AddWidget(new DebugUI.Foldout { displayName = "Rendering Debug", @@ -81,11 +82,11 @@ public SettingsPanel() } #region IDebugDisplaySettingsData - - public bool AreAnySettingsActive => DebugDisplaySettings.Instance.AreAnySettingsActive; - public bool IsPostProcessingAllowed => DebugDisplaySettings.Instance.IsPostProcessingAllowed; - public bool IsLightingActive => DebugDisplaySettings.Instance.IsLightingActive; - public bool TryGetScreenClearColor(ref Color color) => DebugDisplaySettings.Instance.TryGetScreenClearColor(ref color); + UniversalRenderPipelineDebugDisplaySettings debugDisplaySettings => UniversalRenderPipelineDebugDisplaySettings.Instance; + public bool AreAnySettingsActive => debugDisplaySettings.AreAnySettingsActive; + public bool IsPostProcessingAllowed => debugDisplaySettings.IsPostProcessingAllowed; + public bool IsLightingActive => debugDisplaySettings.IsLightingActive; + public bool TryGetScreenClearColor(ref Color color) => debugDisplaySettings.TryGetScreenClearColor(ref color); public IDebugDisplaySettingsPanelDisposable CreatePanel() { diff --git a/com.unity.render-pipelines.universal/Runtime/Debug/DebugHandler.cs b/com.unity.render-pipelines.universal/Runtime/Debug/DebugHandler.cs index 572c5ca4100..6f12571e5f7 100644 --- a/com.unity.render-pipelines.universal/Runtime/Debug/DebugHandler.cs +++ b/com.unity.render-pipelines.universal/Runtime/Debug/DebugHandler.cs @@ -55,7 +55,7 @@ class DebugHandler : IDebugDisplaySettingsQuery Vector4 m_DebugRenderTargetPixelRect; RenderTargetIdentifier m_DebugRenderTargetIdentifier; - readonly DebugDisplaySettings m_DebugDisplaySettings; + readonly UniversalRenderPipelineDebugDisplaySettings m_DebugDisplaySettings; DebugDisplaySettingsLighting LightingSettings => m_DebugDisplaySettings.LightingSettings; DebugDisplaySettingsMaterial MaterialSettings => m_DebugDisplaySettings.MaterialSettings; @@ -84,7 +84,7 @@ public bool TryGetScreenClearColor(ref Color color) #endregion internal Material ReplacementMaterial => m_ReplacementMaterial; - internal DebugDisplaySettings DebugDisplaySettings => m_DebugDisplaySettings; + internal UniversalRenderPipelineDebugDisplaySettings DebugDisplaySettings => m_DebugDisplaySettings; internal bool IsScreenClearNeeded { @@ -108,7 +108,7 @@ internal DebugHandler(ScriptableRendererData scriptableRendererData) { Shader debugReplacementShader = scriptableRendererData.debugShaders.debugReplacementPS; - m_DebugDisplaySettings = DebugDisplaySettings.Instance; + m_DebugDisplaySettings = UniversalRenderPipelineDebugDisplaySettings.Instance; m_ReplacementMaterial = (debugReplacementShader == null) ? null : CoreUtils.CreateEngineMaterial(debugReplacementShader); } diff --git a/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettings.cs b/com.unity.render-pipelines.universal/Runtime/Debug/UniversalRenderPipelineDebugDisplaySettings.cs similarity index 69% rename from com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettings.cs rename to com.unity.render-pipelines.universal/Runtime/Debug/UniversalRenderPipelineDebugDisplaySettings.cs index 601a7d7f318..d4e7c0eeed2 100644 --- a/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettings.cs +++ b/com.unity.render-pipelines.universal/Runtime/Debug/UniversalRenderPipelineDebugDisplaySettings.cs @@ -1,20 +1,9 @@ using System; -using System.Collections.Generic; -using UnityEngine; namespace UnityEngine.Rendering.Universal { - public class DebugDisplaySettings : IDebugDisplaySettingsQuery + public class UniversalRenderPipelineDebugDisplaySettings : DebugDisplaySettings { - private readonly HashSet m_Settings = new HashSet(); - - private static readonly Lazy s_Instance = new Lazy(() => new DebugDisplaySettings()); - - /// - /// The singleton instance that contains the current settings of URP Rendering Debugger. - /// - public static DebugDisplaySettings Instance => s_Instance.Value; - DebugDisplaySettingsCommon CommonSettings { get; set; } /// @@ -37,11 +26,11 @@ public class DebugDisplaySettings : IDebugDisplaySettingsQuery /// /// Returns true if any of the debug settings are currently active. /// - public bool AreAnySettingsActive => MaterialSettings.AreAnySettingsActive || + public override bool AreAnySettingsActive => MaterialSettings.AreAnySettingsActive || LightingSettings.AreAnySettingsActive || RenderingSettings.AreAnySettingsActive; - public bool TryGetScreenClearColor(ref Color color) + public override bool TryGetScreenClearColor(ref Color color) { return MaterialSettings.TryGetScreenClearColor(ref color) || RenderingSettings.TryGetScreenClearColor(ref color) || @@ -51,14 +40,14 @@ public bool TryGetScreenClearColor(ref Color color) /// /// Returns true if lighting is active for current state of debug settings. /// - public bool IsLightingActive => MaterialSettings.IsLightingActive && + public override bool IsLightingActive => MaterialSettings.IsLightingActive && RenderingSettings.IsLightingActive && LightingSettings.IsLightingActive; /// /// Returns true if the current state of debug settings allows post-processing. /// - public bool IsPostProcessingAllowed + public override bool IsPostProcessingAllowed { get { @@ -93,18 +82,11 @@ public bool IsPostProcessingAllowed } #endregion - private TData Add(TData newData) where TData : IDebugDisplaySettingsData + public UniversalRenderPipelineDebugDisplaySettings() { - m_Settings.Add(newData); - return newData; } - DebugDisplaySettings() - { - Reset(); - } - - internal void Reset() + public override void Reset() { m_Settings.Clear(); @@ -113,13 +95,5 @@ internal void Reset() LightingSettings = Add(new DebugDisplaySettingsLighting()); RenderingSettings = Add(new DebugDisplaySettingsRendering()); } - - internal void ForEach(Action onExecute) - { - foreach (IDebugDisplaySettingsData setting in m_Settings) - { - onExecute(setting); - } - } } } diff --git a/com.unity.render-pipelines.universal/Runtime/Debug/UniversalRenderPipelineDebugDisplaySettings.cs.meta b/com.unity.render-pipelines.universal/Runtime/Debug/UniversalRenderPipelineDebugDisplaySettings.cs.meta new file mode 100644 index 00000000000..53e892e5c72 --- /dev/null +++ b/com.unity.render-pipelines.universal/Runtime/Debug/UniversalRenderPipelineDebugDisplaySettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2792d18b8e6d4d141af28c77268cced7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.universal/Runtime/ScriptableRenderer.cs b/com.unity.render-pipelines.universal/Runtime/ScriptableRenderer.cs index a6ed15da98b..60424edf839 100644 --- a/com.unity.render-pipelines.universal/Runtime/ScriptableRenderer.cs +++ b/com.unity.render-pipelines.universal/Runtime/ScriptableRenderer.cs @@ -608,7 +608,7 @@ public virtual void FinishRendering(CommandBuffer cmd) public void Execute(ScriptableRenderContext context, ref RenderingData renderingData) { // Disable Gizmos when using scene overrides. Gizmos break some effects like Overdraw debug. - bool drawGizmos = DebugDisplaySettings.Instance.RenderingSettings.debugSceneOverrideMode == DebugSceneOverrideMode.None; + bool drawGizmos = UniversalRenderPipelineDebugDisplaySettings.Instance.RenderingSettings.debugSceneOverrideMode == DebugSceneOverrideMode.None; m_IsPipelineExecuting = true; ref CameraData cameraData = ref renderingData.cameraData; diff --git a/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs b/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs index c175b19a546..213e35656f6 100644 --- a/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs +++ b/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs @@ -176,7 +176,7 @@ public UniversalRenderPipeline(UniversalRenderPipelineAsset asset) DecalProjector.defaultMaterial = asset.decalMaterial; DebugManager.instance.RefreshEditor(); - m_DebugDisplaySettingsUI.RegisterDebug(DebugDisplaySettings.Instance); + m_DebugDisplaySettingsUI.RegisterDebug(UniversalRenderPipelineDebugDisplaySettings.Instance); } protected override void Dispose(bool disposing) @@ -1220,7 +1220,7 @@ static void SetupPerFrameShaderConstants() static void CheckAndApplyDebugSettings(ref RenderingData renderingData) { - DebugDisplaySettings debugDisplaySettings = DebugDisplaySettings.Instance; + var debugDisplaySettings = UniversalRenderPipelineDebugDisplaySettings.Instance; ref CameraData cameraData = ref renderingData.cameraData; if (debugDisplaySettings.AreAnySettingsActive && !cameraData.isPreviewCamera) From e70b1ea783add464065ebf4dc268e2a3308b1ab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Fri, 17 Sep 2021 09:24:31 +0200 Subject: [PATCH 2/5] Volume Display Settings --- .../Runtime/Debugging/DebugDisplaySettings.cs | 52 ++- .../Debugging}/DebugDisplaySettingsPanel.cs | 9 +- .../DebugDisplaySettingsPanel.cs.meta | 0 .../Debug/DebugDisplaySettingsVolumes.cs | 341 ++++++++++++++++++ .../Debug/DebugDisplaySettingsVolumes.cs.meta | 11 + .../Runtime/Debug/HDDebugDisplaySettings.cs | 44 +++ .../Debug/HDDebugDisplaySettings.cs.meta | 11 + .../RenderPipeline/HDRenderPipeline.Debug.cs | 1 + .../RenderPipeline/HDRenderPipeline.cs | 2 + .../ValidationExceptions.json.meta | 7 +- 10 files changed, 471 insertions(+), 7 deletions(-) rename {com.unity.render-pipelines.universal/Runtime/Debug => com.unity.render-pipelines.core/Runtime/Debugging}/DebugDisplaySettingsPanel.cs (83%) rename {com.unity.render-pipelines.universal/Runtime/Debug => com.unity.render-pipelines.core/Runtime/Debugging}/DebugDisplaySettingsPanel.cs.meta (100%) create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplaySettingsVolumes.cs create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplaySettingsVolumes.cs.meta create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Debug/HDDebugDisplaySettings.cs create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Debug/HDDebugDisplaySettings.cs.meta diff --git a/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettings.cs b/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettings.cs index 9ab5e26bd52..e84c19b3a60 100644 --- a/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettings.cs +++ b/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettings.cs @@ -21,9 +21,39 @@ public abstract class DebugDisplaySettings : IDebugDisplaySettings public static T Instance => s_Instance.Value; #region IDebugDisplaySettingsQuery - public abstract bool AreAnySettingsActive { get; } - public abstract bool IsPostProcessingAllowed { get; } - public abstract bool IsLightingActive { get; } + + /// + /// Returns true if any of the debug settings are currently active. + /// + public virtual bool AreAnySettingsActive + { + get + { + foreach (IDebugDisplaySettingsData setting in m_Settings) + { + if (setting.AreAnySettingsActive) + return true; + } + + return false; + } + } + + public virtual bool IsPostProcessingAllowed { get; } + + /// + /// Returns true if lighting is active for current state of debug settings. + /// + public virtual bool IsLightingActive + { + get + { + bool lightingActive = true; + foreach (IDebugDisplaySettingsData setting in m_Settings) + lightingActive &= setting.IsLightingActive; + return lightingActive; + } + } #endregion protected TData Add(TData newData) where TData : IDebugDisplaySettingsData @@ -45,6 +75,20 @@ public virtual void Reset() m_Settings.Clear(); } - public abstract bool TryGetScreenClearColor(ref Color color); + /// + /// Attempts to get the color that should be used to clear the screen according to current debug settings. + /// + /// A reference to the screen clear color to use. + /// True if the color reference was updated, and false otherwise. + public virtual bool TryGetScreenClearColor(ref Color color) + { + foreach (IDebugDisplaySettingsData setting in m_Settings) + { + if (setting.TryGetScreenClearColor(ref color)) + return true; + } + + return false; + } } } diff --git a/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsPanel.cs b/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsPanel.cs similarity index 83% rename from com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsPanel.cs rename to com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsPanel.cs index e013f182128..714632efb76 100644 --- a/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsPanel.cs +++ b/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsPanel.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace UnityEngine.Rendering.Universal +namespace UnityEngine.Rendering { public abstract class DebugDisplaySettingsPanel : IDebugDisplaySettingsPanelDisposable { @@ -14,9 +14,14 @@ protected void AddWidget(DebugUI.Widget widget) m_Widgets.Add(widget); } - public void Dispose() + protected void Clear() { m_Widgets.Clear(); } + + public void Dispose() + { + Clear(); + } } } diff --git a/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsPanel.cs.meta b/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsPanel.cs.meta similarity index 100% rename from com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsPanel.cs.meta rename to com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsPanel.cs.meta diff --git a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplaySettingsVolumes.cs b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplaySettingsVolumes.cs new file mode 100644 index 00000000000..c68178c4c15 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplaySettingsVolumes.cs @@ -0,0 +1,341 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; + +namespace UnityEngine.Rendering.HighDefinition +{ + class DebugDisplaySettingsVolume : IDebugDisplaySettingsData + { + /// Current volume debug settings. + public VolumeDebugSettings volumeDebugSettings = new VolumeDebugSettings(); + + internal int volumeComponentEnumIndex; + internal int volumeCameraEnumIndex; + + static class Styles + { + public static readonly GUIContent none = new GUIContent("None"); + public static readonly GUIContent editorCamera = new GUIContent("Editor Camera"); + } + + static class Strings + { + public static readonly string none = "None"; + public static readonly string camera = "Camera"; + public static readonly string parameter = "Parameter"; + public static readonly string component = "Component"; + public static readonly string debugViewNotSupported = "Debug view not supported"; + public static readonly string volumeInfo = "Volume Info"; + public static readonly string interpolatedValue = "Interpolated Value"; + public static readonly string defaultValue = "Default Value"; + public static readonly string global = "Global"; + public static readonly string local = "Local"; + } + + internal static class WidgetFactory + { + public static DebugUI.EnumField CreateComponentSelector(DebugDisplaySettingsVolume data, Action, int> refresh) + { + int componentIndex = 0; + var componentNames = new List() { Styles.none }; + var componentValues = new List() { componentIndex++ }; + + foreach (var type in VolumeDebugSettings.componentTypes) + { + componentNames.Add(new GUIContent() { text = VolumeDebugSettings.ComponentDisplayName(type) }); + componentValues.Add(componentIndex++); + } + + return new DebugUI.EnumField + { + displayName = Strings.component, + getter = () => data.volumeDebugSettings.selectedComponent, + setter = value => data.volumeDebugSettings.selectedComponent = value, + enumNames = componentNames.ToArray(), + enumValues = componentValues.ToArray(), + getIndex = () => data.volumeComponentEnumIndex, + setIndex = value => { data.volumeComponentEnumIndex = value; }, + onValueChanged = refresh + }; + } + + public static DebugUI.EnumField CreateCameraSelector(DebugDisplaySettingsVolume data, Action, int> refresh) + { + int componentIndex = 0; + var componentNames = new List() { Styles.none }; + var componentValues = new List() { componentIndex++ }; + +#if UNITY_EDITOR + componentNames.Add(Styles.editorCamera); + componentValues.Add(componentIndex++); +#endif + + foreach (var camera in VolumeDebugSettings.cameras) + { + componentNames.Add(new GUIContent() { text = camera.name }); + componentValues.Add(componentIndex++); + } + + return new DebugUI.EnumField + { + displayName = Strings.camera, + getter = () => data.volumeDebugSettings.selectedCameraIndex, + setter = value => data.volumeDebugSettings.selectedCameraIndex = value, + enumNames = componentNames.ToArray(), + enumValues = componentValues.ToArray(), + getIndex = () => data.volumeCameraEnumIndex, + setIndex = value => { data.volumeCameraEnumIndex = value; }, + isHiddenCallback = () => data.volumeComponentEnumIndex == 0, + onValueChanged = refresh + }; + } + + static DebugUI.Widget CreateVolumeParameterWidget(string name, VolumeParameter param) + { + if (param == null) + return new DebugUI.Value() { displayName = name, getter = () => "-" }; + + // Special overrides + if (param.GetType() == typeof(ColorParameter)) + { + var p = (ColorParameter)param; + return new DebugUI.ColorField() + { + displayName = name, + hdr = p.hdr, + showAlpha = p.showAlpha, + getter = () => p.value, + setter = _ => { } + }; + } + + if (param.GetType() == typeof(BoolParameter)) + { + var p = (BoolParameter)param; + return new DebugUI.BoolField() + { + displayName = name, + getter = () => p.value, + setter = _ => { } + }; + } + + // For parameters that do not override `ToString` + var property = param.GetType().GetProperty("value"); + var toString = property.PropertyType.GetMethod("ToString", Type.EmptyTypes); + if ((toString == null) || (toString.DeclaringType == typeof(object)) || (toString.DeclaringType == typeof(UnityEngine.Object))) + { + // Check if the parameter has a name + var nameProp = property.PropertyType.GetProperty("name"); + if (nameProp == null) + return new DebugUI.Value() { displayName = name, getter = () => Strings.debugViewNotSupported }; + + // Return the parameter name + return new DebugUI.Value() + { + displayName = name, + getter = () => + { + var value = property.GetValue(param); + if (value == null || value.Equals(null)) + return Strings.none; + var valueString = nameProp.GetValue(value); + return valueString ?? Strings.none; + } + }; + } + + // Call the ToString method + return new DebugUI.Value() + { + displayName = name, + getter = () => + { + var value = property.GetValue(param); + return value == null ? Strings.none : value.ToString(); + } + }; + } + + public static DebugUI.Table CreateVolumeTable(DebugDisplaySettingsVolume data) + { + var table = new DebugUI.Table() + { + displayName = Strings.parameter, + isReadOnly = true + }; + + Type selectedType = data.volumeDebugSettings.selectedComponentType; + var stackComponent = data.volumeDebugSettings.selectedCameraVolumeStack.GetComponent(selectedType); + + var volumes = data.volumeDebugSettings.GetVolumes(); + + var inst = (VolumeComponent)ScriptableObject.CreateInstance(selectedType); + + // First row for volume info + float timer = 0.0f, refreshRate = 0.2f; + var row = new DebugUI.Table.Row() + { + displayName = Strings.volumeInfo, + children = { new DebugUI.Value() { + displayName = Strings.interpolatedValue, + getter = () => { + // This getter is called first at each render + // It is used to update the volumes + if (Time.time - timer < refreshRate) + return string.Empty; + timer = Time.deltaTime; + if (data.volumeDebugSettings.selectedCameraIndex != 0) + { + var newVolumes = data.volumeDebugSettings.GetVolumes(); + if (!data.volumeDebugSettings.RefreshVolumes(newVolumes)) + { + for (int i = 0; i < newVolumes.Length; i++) + { + var visible = data.volumeDebugSettings.VolumeHasInfluence(newVolumes[i]); + table.SetColumnVisibility(i + 1, visible); + } + return string.Empty; + } + } + DebugManager.instance.ReDrawOnScreenDebug(); + return string.Empty; + } + } } + }; + row.opened = true; + + foreach (var volume in volumes) + { + var profile = volume.HasInstantiatedProfile() ? volume.profile : volume.sharedProfile; + row.children.Add(new DebugUI.Value() + { + displayName = $"{volume.name} ({profile.name})", + getter = () => + { + var scope = volume.isGlobal ? Strings.global : Strings.local; + var weight = data.volumeDebugSettings.GetVolumeWeight(volume); + return scope + " (" + (weight * 100f) + "%)"; + } + }); + } + + row.children.Add(new DebugUI.Value() { displayName = Strings.defaultValue, getter = () => string.Empty }); + table.children.Add(row); + + // Build rows - recursively handles nested parameters + var rows = new List(); + void AddParameterRows(Type type, string baseName = null) + { + void AddRow(FieldInfo f, string prefix) + { + var fieldName = prefix + f.Name; + var attr = (DisplayInfoAttribute[])f.GetCustomAttributes(typeof(DisplayInfoAttribute), true); + if (attr.Length != 0) + fieldName = prefix + attr[0].name; +#if UNITY_EDITOR + // Would be nice to have the equivalent for the runtime debug. + else + fieldName = UnityEditor.ObjectNames.NicifyVariableName(fieldName); +#endif + + int currentParam = rows.Count; + row = new DebugUI.Table.Row() + { + displayName = fieldName, + children = { CreateVolumeParameterWidget(Strings.interpolatedValue, stackComponent.parameters[currentParam]) } + }; + + foreach (var volume in volumes) + { + VolumeParameter param = null; + var profile = volume.HasInstantiatedProfile() ? volume.profile : volume.sharedProfile; + if (profile.TryGet(selectedType, out VolumeComponent component) && component.parameters[currentParam].overrideState) + param = component.parameters[currentParam]; + row.children.Add(CreateVolumeParameterWidget(volume.name + " (" + profile.name + ")", param)); + } + + row.children.Add(CreateVolumeParameterWidget(Strings.defaultValue, inst.parameters[currentParam])); + rows.Add(row); + } + + var fields = type + .GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance) + .OrderBy(t => t.MetadataToken); + foreach (var field in fields) + { + if (field.GetCustomAttributes(typeof(ObsoleteAttribute), false).Length != 0) + continue; + var fieldType = field.FieldType; + if (fieldType.IsSubclassOf(typeof(VolumeParameter))) + AddRow(field, baseName ?? string.Empty); + else if (!fieldType.IsArray && fieldType.IsClass) + AddParameterRows(fieldType, baseName ?? (field.Name + " ")); + } + } + + AddParameterRows(selectedType); + foreach (var r in rows.OrderBy(t => t.displayName)) + table.children.Add(r); + + data.volumeDebugSettings.RefreshVolumes(volumes); + for (int i = 0; i < volumes.Length; i++) + table.SetColumnVisibility(i + 1, data.volumeDebugSettings.VolumeHasInfluence(volumes[i])); + + return table; + } + } + + private class SettingsPanel : DebugDisplaySettingsPanel + { + readonly DebugDisplaySettingsVolume m_Data; + + public override string PanelName => "Volume (WIP)"; + + public SettingsPanel(DebugDisplaySettingsVolume data) + { + m_Data = data; + AddWidget(WidgetFactory.CreateComponentSelector(m_Data, Refresh)); + AddWidget(WidgetFactory.CreateCameraSelector(m_Data, Refresh)); + } + + DebugUI.Table m_VolumeTable = null; + void Refresh(DebugUI.Field _, int __) + { + var panel = DebugManager.instance.GetPanel(PanelName); + if (panel == null) + return; + + if (m_VolumeTable != null) + panel.children.Remove(m_VolumeTable); + + if (m_Data.volumeDebugSettings.selectedComponent > 0 && m_Data.volumeDebugSettings.selectedCameraIndex > 0) + { + m_VolumeTable = WidgetFactory.CreateVolumeTable(m_Data); + AddWidget(m_VolumeTable); + panel.children.Add(m_VolumeTable); + } + + DebugManager.instance.ReDrawOnScreenDebug(); + } + } + + #region IDebugDisplaySettingsData + public bool AreAnySettingsActive => volumeCameraEnumIndex > 0 || volumeComponentEnumIndex > 0; + public bool IsPostProcessingAllowed => true; + public bool IsLightingActive => true; + + public bool TryGetScreenClearColor(ref Color color) + { + return false; + } + + public IDebugDisplaySettingsPanelDisposable CreatePanel() + { + return new SettingsPanel(this); + } + + #endregion + } +} diff --git a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplaySettingsVolumes.cs.meta b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplaySettingsVolumes.cs.meta new file mode 100644 index 00000000000..446b01317a8 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplaySettingsVolumes.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 987617381d0b4ad4fafa9f3ab3ae5fb4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/Debug/HDDebugDisplaySettings.cs b/com.unity.render-pipelines.high-definition/Runtime/Debug/HDDebugDisplaySettings.cs new file mode 100644 index 00000000000..c5e50203336 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Debug/HDDebugDisplaySettings.cs @@ -0,0 +1,44 @@ +namespace UnityEngine.Rendering.HighDefinition +{ + public class HDDebugDisplaySettings : DebugDisplaySettings + { + /// + /// Material-related Rendering Debugger settings. + /// + internal DebugDisplaySettingsVolume VolumeSettings { get; private set; } + + #region IDebugDisplaySettingsQuery + + /// + /// Returns true if any of the debug settings are currently active. + /// + public override bool AreAnySettingsActive => VolumeSettings.AreAnySettingsActive; + + public override bool TryGetScreenClearColor(ref Color color) + { + return VolumeSettings.TryGetScreenClearColor(ref color); + } + + /// + /// Returns true if lighting is active for current state of debug settings. + /// + public override bool IsLightingActive => VolumeSettings.IsLightingActive; + + /// + /// Returns true if the current state of debug settings allows post-processing. + /// + public override bool IsPostProcessingAllowed => false; + #endregion + + public HDDebugDisplaySettings() + { + } + + public override void Reset() + { + m_Settings.Clear(); + + VolumeSettings = Add(new DebugDisplaySettingsVolume()); + } + } +} diff --git a/com.unity.render-pipelines.high-definition/Runtime/Debug/HDDebugDisplaySettings.cs.meta b/com.unity.render-pipelines.high-definition/Runtime/Debug/HDDebugDisplaySettings.cs.meta new file mode 100644 index 00000000000..e29d7b49d44 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Debug/HDDebugDisplaySettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8af262c399eb56a4e8b9048066b4ca99 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Debug.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Debug.cs index 9688eb67a82..edcbd306703 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Debug.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Debug.cs @@ -28,6 +28,7 @@ public partial class HDRenderPipeline Material m_VTDebugBlit; #endif + private readonly DebugDisplaySettingsUI m_DebugDisplaySettingsUI = new DebugDisplaySettingsUI(); DebugDisplaySettings m_DebugDisplaySettings = new DebugDisplaySettings(); /// diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs index 8671dc2de6e..01a8943ff80 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs @@ -392,6 +392,7 @@ public HDRenderPipeline(HDRenderPipelineAsset asset) InitializeSubsurfaceScattering(); m_DebugDisplaySettings.RegisterDebug(); + m_DebugDisplaySettingsUI.RegisterDebug(HDDebugDisplaySettings.Instance); #if UNITY_EDITOR // We don't need the debug of Scene View at runtime (each camera have its own debug settings) // All scene view will share the same FrameSettings for now as sometimes Dispose is called after @@ -678,6 +679,7 @@ protected override void Dispose(bool disposing) } ReleaseRayTracingManager(); + m_DebugDisplaySettingsUI.UnregisterDebug(); m_DebugDisplaySettings.UnregisterDebug(); CleanupLightLoop(); diff --git a/com.unity.render-pipelines.universal/ValidationExceptions.json.meta b/com.unity.render-pipelines.universal/ValidationExceptions.json.meta index 673f4df8c0e..777bac21963 100644 --- a/com.unity.render-pipelines.universal/ValidationExceptions.json.meta +++ b/com.unity.render-pipelines.universal/ValidationExceptions.json.meta @@ -1,2 +1,7 @@ fileFormatVersion: 2 -guid: 3afe581e949e3cc489c978bd8e000c4b \ No newline at end of file +guid: 3afe581e949e3cc489c978bd8e000c4b +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: From c1ad7ef5de06448a3182e1a997ea00303833ced9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Mon, 20 Sep 2021 11:02:03 +0200 Subject: [PATCH 3/5] Docs --- .../Runtime/Debugging/DebugDisplaySettings.cs | 14 ++++++++++++++ .../Runtime/Debugging/IDebugDisplaySettingsData.cs | 3 +++ .../Debugging/IDebugDisplaySettingsPanel.cs | 6 ++++++ 3 files changed, 23 insertions(+) diff --git a/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettings.cs b/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettings.cs index e84c19b3a60..481a2cafaad 100644 --- a/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettings.cs +++ b/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettings.cs @@ -3,6 +3,10 @@ namespace UnityEngine.Rendering { + /// + /// Templated class for + /// + /// public abstract class DebugDisplaySettings : IDebugDisplaySettings where T : IDebugDisplaySettings, new() { @@ -39,6 +43,9 @@ public virtual bool AreAnySettingsActive } } + /// + /// Checks whether the current state of these settings allows post-processing. + /// public virtual bool IsPostProcessingAllowed { get; } /// @@ -62,6 +69,10 @@ protected TData Add(TData newData) where TData : IDebugDisplaySettingsDat return newData; } + /// + /// Executes an action for each element + /// + /// public void ForEach(Action onExecute) { foreach (IDebugDisplaySettingsData setting in m_Settings) @@ -70,6 +81,9 @@ public void ForEach(Action onExecute) } } + /// + /// Reset the stored debug settings + /// public virtual void Reset() { m_Settings.Clear(); diff --git a/com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettingsData.cs b/com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettingsData.cs index 158aabc04c6..daac1022757 100644 --- a/com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettingsData.cs +++ b/com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettingsData.cs @@ -1,5 +1,8 @@ namespace UnityEngine.Rendering { + /// + /// Debug UI panel interface + /// public interface IDebugDisplaySettingsData : IDebugDisplaySettingsQuery { /// diff --git a/com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettingsPanel.cs b/com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettingsPanel.cs index 08e825de271..a80f0b88b45 100644 --- a/com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettingsPanel.cs +++ b/com.unity.render-pipelines.core/Runtime/Debugging/IDebugDisplaySettingsPanel.cs @@ -2,6 +2,9 @@ namespace UnityEngine.Rendering { + /// + /// Debug UI panel + /// public interface IDebugDisplaySettingsPanel { /// @@ -15,6 +18,9 @@ public interface IDebugDisplaySettingsPanel DebugUI.Widget[] Widgets { get; } } + /// + /// Debug UI panel disposable + /// public interface IDebugDisplaySettingsPanelDisposable : IDebugDisplaySettingsPanel, IDisposable { } From e48bb4c7383c5a45af0cf2f05293dd343abdc564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Mon, 20 Sep 2021 11:03:39 +0200 Subject: [PATCH 4/5] Changelog --- com.unity.render-pipelines.core/CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/com.unity.render-pipelines.core/CHANGELOG.md b/com.unity.render-pipelines.core/CHANGELOG.md index a4ddc266923..61902914d7e 100644 --- a/com.unity.render-pipelines.core/CHANGELOG.md +++ b/com.unity.render-pipelines.core/CHANGELOG.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. Version Updated The version number for this package has increased due to a version update of a related graphics package. +### Added +- Debug Panels Framework See `IDebugDisplaySettingsQuery`. + ## [12.0.0] - 2021-01-11 ### Added From e998d1bf5028d9ad6827b5faace56f5f018a90d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Tue, 28 Sep 2021 13:09:16 +0200 Subject: [PATCH 5/5] format --- .../Runtime/Debug/DebugDisplaySettingsCommon.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsCommon.cs b/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsCommon.cs index c03263ca219..74934bf51e8 100644 --- a/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsCommon.cs +++ b/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsCommon.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using UnityEngine; namespace UnityEngine.Rendering.Universal { @@ -32,11 +31,10 @@ private class SettingsPanel : DebugDisplaySettingsPanel public SettingsPanel() { - AddWidget(DebugDisplaySettingsCommon.WidgetFactory.CreateMissingDebugShadersWarning()); - + AddWidget(WidgetFactory.CreateMissingDebugShadersWarning()); + var debugDisplaySettings = UniversalRenderPipelineDebugDisplaySettings.Instance; var materialSettingsData = debugDisplaySettings.MaterialSettings; - AddWidget(new DebugUI.Foldout { displayName = "Material Filters",