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 DebugDisplayStats displayStats { 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 DebugDisplayStats());
materialSettings = Add(new DebugDisplaySettingsMaterial());
lightingSettings = Add(new DebugDisplaySettingsLighting());
renderingSettings = Add(new DebugDisplaySettingsRendering());
volumeSettings = Add(new DebugDisplaySettingsVolume(new UniversalRenderPipelineVolumeDebugSettings()));
commonSettings = Add(new DebugDisplaySettingsCommon());
}
internal void UpdateFrameTiming()
{
if (displayStats != null)
displayStats.UpdateFrameTiming();
}
}
}