namespace UnityEngine.Rendering.PostProcessing { /// /// Debug monitor types. /// public enum MonitorType { /// /// Light meter. /// LightMeter, /// /// Gamma histogram. /// Histogram, /// /// Waveform. /// Waveform, /// /// YUV vectorscope. /// Vectorscope } /// /// The base class for all debug monitors. /// public abstract class Monitor { /// /// The target texture to render this monitor to. /// public RenderTexture output { get; protected set; } internal bool requested = false; /// /// Checks if a monitor is supported and should be rendered. /// /// The current post-processing context. /// true if supported and enabled, false otherwise. public bool IsRequestedAndSupported(PostProcessRenderContext context) { return requested && SystemInfo.supportsComputeShaders && !RuntimeUtilities.isAndroidOpenGL && ShaderResourcesAvailable(context); } internal abstract bool ShaderResourcesAvailable(PostProcessRenderContext context); internal virtual bool NeedsHalfRes() { return false; } /// /// Validates the output texture. /// /// The output width. /// The output height. protected void CheckOutput(int width, int height) { if (output == null || !output.IsCreated() || output.width != width || output.height != height) { RuntimeUtilities.Destroy(output); output = new RenderTexture(width, height, 0, RenderTextureFormat.ARGB32) { anisoLevel = 0, filterMode = FilterMode.Bilinear, wrapMode = TextureWrapMode.Clamp, useMipMap = false }; } } internal virtual void OnEnable() { } internal virtual void OnDisable() { RuntimeUtilities.Destroy(output); } internal abstract void Render(PostProcessRenderContext context); } }