using System; namespace UnityEngine.Rendering.Universal { /// /// Class for the rendering debugger settings. /// public class UniversalRenderPipelineDebugDisplaySettings : DebugDisplaySettings { DebugDisplaySettingsCommon commonSettings { get; set; } /// /// Material-related rendering debugger settings. /// public DebugDisplaySettingsMaterial materialSettings { get; private set; } /// /// Rendering-related rendering debugger settings. /// public DebugDisplaySettingsRendering renderingSettings { get; private set; } /// /// Lighting-related rendering debugger settings. /// public DebugDisplaySettingsLighting lightingSettings { get; private set; } /// /// Volume-related rendering debugger settings. /// public DebugDisplaySettingsVolume volumeSettings { get; private set; } /// /// Display stats. /// internal DebugDisplaySettingsStats displayStats { get; private set; } /// /// GPU Resident Drawer Rendering Debugger settings and statistics. /// internal DebugDisplayGPUResidentDrawer gpuResidentDrawerSettings { get; private set; } #region IDebugDisplaySettingsQuery /// /// Returns true if the current state of debug settings allows post-processing. /// public override bool IsPostProcessingAllowed { get { DebugPostProcessingMode debugPostProcessingMode = renderingSettings.postProcessingDebugMode; switch (debugPostProcessingMode) { case DebugPostProcessingMode.Disabled: { return false; } case DebugPostProcessingMode.Auto: { // Only enable post-processing if we aren't using certain debug-views. bool postProcessingAllowed = true; foreach (IDebugDisplaySettingsData setting in m_Settings) postProcessingAllowed &= setting.IsPostProcessingAllowed; return postProcessingAllowed; } case DebugPostProcessingMode.Enabled: { return true; } default: { throw new ArgumentOutOfRangeException(nameof(debugPostProcessingMode), $"Invalid post-processing state {debugPostProcessingMode}"); } } } } #endregion /// /// Creates a new UniversalRenderPipelineDebugDisplaySettings instance. /// public UniversalRenderPipelineDebugDisplaySettings() { Reset(); } /// public override void Reset() { base.Reset(); displayStats = Add(new DebugDisplaySettingsStats(new UniversalRenderPipelineDebugDisplayStats())); materialSettings = Add(new DebugDisplaySettingsMaterial()); lightingSettings = Add(new DebugDisplaySettingsLighting()); renderingSettings = Add(new DebugDisplaySettingsRendering()); volumeSettings = Add(new DebugDisplaySettingsVolume(new UniversalRenderPipelineVolumeDebugSettings())); commonSettings = Add(new DebugDisplaySettingsCommon()); gpuResidentDrawerSettings = Add(new DebugDisplayGPUResidentDrawer()); // This is not a debug property owned by any `IDebugDisplaySettingsData`, it is a static property on `Texture`. // When the user hits reset, we want to make sure texture mip caching is enabled again (regardless of whether the // user toggled this in the Rendering Debugger UI or changed it using the scripting API). Texture.streamingTextureDiscardUnusedMips = false; } internal void UpdateDisplayStats() { if (displayStats != null) displayStats.debugDisplayStats.Update(); } internal void UpdateMaterials() { if (renderingSettings.mipInfoMode != DebugMipInfoMode.None) { int textureSlotImpl = (renderingSettings.canAggregateData && renderingSettings.showInfoForAllSlots) ? -1 : renderingSettings.mipDebugMaterialTextureSlot; Texture.SetStreamingTextureMaterialDebugProperties(textureSlotImpl); } } } }