diff --git a/com.unity.render-pipelines.core/Editor/Debugging/DebugUIDrawer.Builtins.cs b/com.unity.render-pipelines.core/Editor/Debugging/DebugUIDrawer.Builtins.cs index e10e5360d91..6c035f5fdca 100644 --- a/com.unity.render-pipelines.core/Editor/Debugging/DebugUIDrawer.Builtins.cs +++ b/com.unity.render-pipelines.core/Editor/Debugging/DebugUIDrawer.Builtins.cs @@ -592,6 +592,36 @@ public override bool OnGUI(DebugUI.Widget widget, DebugState state) } } + /// + /// Builtin Drawer for MessageBox Items. + /// + [DebugUIDrawer(typeof(DebugUI.MessageBox))] + public sealed class DebugUIDrawerMessageBox : DebugUIDrawer + { + /// + /// OnGUI implementation for TextLabel DebugUIDrawer. + /// + /// DebugUI Widget. + /// Debug State associated with the Debug Item. + /// The state of the widget. + public override bool OnGUI(DebugUI.Widget widget, DebugState state) + { + var w = Cast(widget); + + var type = w.style switch + { + DebugUI.MessageBox.Style.Info => MessageType.Info, + DebugUI.MessageBox.Style.Warning => MessageType.Warning, + DebugUI.MessageBox.Style.Error => MessageType.Error, + _ => MessageType.None + }; + + EditorGUILayout.HelpBox(w.displayName, type); + + return true; + } + } + /// /// Builtin Drawer for Container Debug Items. /// diff --git a/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs b/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs index 030f5f6a346..cd7fcf7101d 100644 --- a/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs +++ b/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs @@ -526,5 +526,26 @@ public class Vector4Field : Field /// public int decimals = 3; } + + /// + /// Simple message box widget, providing a couple of different styles. + /// + public class MessageBox : Widget + { + /// + /// Label style defines text color and background. + /// + public enum Style + { + Info, + Warning, + Error + } + + /// + /// Style used to render displayName. + /// + public Style style = Style.Info; + } } } diff --git a/com.unity.render-pipelines.core/Runtime/Debugging/Prefabs/Resources/DebugUICanvas.prefab b/com.unity.render-pipelines.core/Runtime/Debugging/Prefabs/Resources/DebugUICanvas.prefab index 78009281f75..bfe79e7f0ef 100644 --- a/com.unity.render-pipelines.core/Runtime/Debugging/Prefabs/Resources/DebugUICanvas.prefab +++ b/com.unity.render-pipelines.core/Runtime/Debugging/Prefabs/Resources/DebugUICanvas.prefab @@ -58,6 +58,7 @@ Canvas: m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 m_AdditionalShaderChannelsFlag: 0 + m_UpdateRectTransformForStandalone: 0 m_SortingLayerID: 0 m_SortingOrder: 0 m_TargetDisplay: 0 @@ -175,3 +176,6 @@ MonoBehaviour: - type: UnityEngine.Rendering.DebugUI+Table+Row, Unity.RenderPipelines.Core.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null prefab: {fileID: 224053494956566916, guid: 2d019437ff89b8d44949727731cd9357, type: 3} + - type: UnityEngine.Rendering.DebugUI+MessageBox, Unity.RenderPipelines.Core.Runtime, + Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + prefab: {fileID: 224053494956566916, guid: 10a25524b0986f9488b430e2829bbbe8, type: 3} diff --git a/com.unity.render-pipelines.core/Runtime/Debugging/Prefabs/Scripts/DebugUIHandlerMessageBox.cs b/com.unity.render-pipelines.core/Runtime/Debugging/Prefabs/Scripts/DebugUIHandlerMessageBox.cs new file mode 100644 index 00000000000..125468c747b --- /dev/null +++ b/com.unity.render-pipelines.core/Runtime/Debugging/Prefabs/Scripts/DebugUIHandlerMessageBox.cs @@ -0,0 +1,44 @@ +using UnityEngine.UI; + +namespace UnityEngine.Rendering.UI +{ + /// + /// DebugUIHandler for MessageBox widget. + /// + public class DebugUIHandlerMessageBox : DebugUIHandlerWidget + { + /// Name of the widget. + public Text nameLabel; + + DebugUI.MessageBox m_Field; + + static Color32 k_WarningBackgroundColor = new Color32(231, 180, 3, 30); + static Color32 k_WarningTextColor = new Color32(231, 180, 3, 255); + static Color32 k_ErrorBackgroundColor = new Color32(231, 75, 3, 30); + static Color32 k_ErrorTextColor = new Color32(231, 75, 3, 255); + + internal override void SetWidget(DebugUI.Widget widget) + { + base.SetWidget(widget); + m_Field = CastWidget(); + nameLabel.text = m_Field.displayName; + + var image = GetComponent(); + switch (m_Field.style) + { + case DebugUI.MessageBox.Style.Warning: + image.color = k_WarningBackgroundColor; + break; + + case DebugUI.MessageBox.Style.Error: + image.color = k_ErrorBackgroundColor; + break; + } + } + + public override bool OnSelection(bool fromNext, DebugUIHandlerWidget previous) + { + return false; + } + } +} diff --git a/com.unity.render-pipelines.core/Runtime/Debugging/Prefabs/Scripts/DebugUIHandlerMessageBox.cs.meta b/com.unity.render-pipelines.core/Runtime/Debugging/Prefabs/Scripts/DebugUIHandlerMessageBox.cs.meta new file mode 100644 index 00000000000..9c64244ea97 --- /dev/null +++ b/com.unity.render-pipelines.core/Runtime/Debugging/Prefabs/Scripts/DebugUIHandlerMessageBox.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e25c98bed7eaeec4cb32c57a5280f85e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.core/Runtime/Debugging/Prefabs/Widgets/DebugUIMessageBox.prefab b/com.unity.render-pipelines.core/Runtime/Debugging/Prefabs/Widgets/DebugUIMessageBox.prefab new file mode 100644 index 00000000000..401922e8a05 --- /dev/null +++ b/com.unity.render-pipelines.core/Runtime/Debugging/Prefabs/Widgets/DebugUIMessageBox.prefab @@ -0,0 +1,220 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1880654171993120 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 224053494956566916} + - component: {fileID: 114903677526224182} + - component: {fileID: 114617406789257194} + - component: {fileID: 2667470447078002195} + - component: {fileID: 6558164272786438813} + - component: {fileID: 3503157118102991044} + m_Layer: 0 + m_Name: DebugUIMessageBox + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &224053494956566916 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1880654171993120} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 224133929923872250} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 295, y: 0} + m_SizeDelta: {x: 590, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &114903677526224182 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1880654171993120} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 6 + m_Right: 6 + m_Top: 4 + m_Bottom: 4 + m_ChildAlignment: 0 + m_Spacing: 0 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 1 + m_ChildControlHeight: 1 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 +--- !u!114 &114617406789257194 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1880654171993120} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 0 + m_VerticalFit: 2 +--- !u!114 &2667470447078002195 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1880654171993120} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e25c98bed7eaeec4cb32c57a5280f85e, type: 3} + m_Name: + m_EditorClassIdentifier: + colorDefault: {r: 0.8, g: 0.8, b: 0.8, a: 1} + colorSelected: {r: 0.25, g: 0.65, b: 0.8, a: 1} + nameLabel: {fileID: 114398791307483412} + backgroundImage: {fileID: 3503157118102991044} +--- !u!222 &6558164272786438813 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1880654171993120} + m_CullTransparentMesh: 1 +--- !u!114 &3503157118102991044 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1880654171993120} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0.27058825} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &1887383709356810 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 224133929923872250} + - component: {fileID: 222546040197109316} + - component: {fileID: 114398791307483412} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &224133929923872250 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1887383709356810} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 224053494956566916} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &222546040197109316 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1887383709356810} + m_CullTransparentMesh: 1 +--- !u!114 &114398791307483412 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1887383709356810} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.8, g: 0.8, b: 0.8, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 74a5091d8707f334b9a5c31ef71a64ba, type: 3} + m_FontSize: 15 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 1 + m_MaxSize: 40 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 0 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: 'Message text + +' diff --git a/com.unity.render-pipelines.core/Runtime/Debugging/Prefabs/Widgets/DebugUIMessageBox.prefab.meta b/com.unity.render-pipelines.core/Runtime/Debugging/Prefabs/Widgets/DebugUIMessageBox.prefab.meta new file mode 100644 index 00000000000..e6d7c9aaa03 --- /dev/null +++ b/com.unity.render-pipelines.core/Runtime/Debugging/Prefabs/Widgets/DebugUIMessageBox.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 10a25524b0986f9488b430e2829bbbe8 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 362114453a6..f3357e9cbd1 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -55,6 +55,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed diffusion profile being reset to default on SpeedTree8 materials with subsurface scattering enabled during import. - Fixed the volume not being assigned on some scene templates. - Fixed corruption in player with lightmap uv when Optimize Mesh Data is enabled [1357902] +- Fixed a warning to Rendering Debugger Runtime UI when debug shaders are stripped. ### Changed - Visual Environment ambient mode is now Dynamic by default. diff --git a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs index 2c070037f23..65ad4de7b73 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs @@ -162,7 +162,7 @@ public class DebugDisplaySettings : IDebugData DebugUI.Widget[] m_DebugLightingItems; DebugUI.Widget[] m_DebugVolumeItems; DebugUI.Widget[] m_DebugRenderingItems; - DebugUI.Widget[] m_DebugDecalsAffectingTransparentItems; + DebugUI.Widget[] m_DebugDecalsItems; static GUIContent[] s_LightingFullScreenDebugStrings = null; static int[] s_LightingFullScreenDebugValues = null; @@ -1021,6 +1021,25 @@ void RegisterDisplayStatsDebug() panel.children.Add(m_DebugDisplayStatsItems); } + DebugUI.Widget CreateMissingDebugShadersWarning() + { + return new DebugUI.MessageBox + { + displayName = "Warning: the debug shader variants are missing. Ensure that the \"Runtime Debug Shaders\" option is enabled in HDRP Global Settings.", + style = DebugUI.MessageBox.Style.Warning, + isHiddenCallback = () => + { +#if UNITY_EDITOR + return true; +#else + if (HDRenderPipelineGlobalSettings.instance != null) + return HDRenderPipelineGlobalSettings.instance.supportRuntimeDebugDisplay; + return true; +#endif + } + }; + } + static class MaterialStrings { public static readonly NameAndTooltip CommonMaterialProperties = new() { name = "Common Material Properties", tooltip = "Use the drop-down to select and debug a Material property to visualize on every GameObject on screen." }; @@ -1041,7 +1060,7 @@ static class MaterialStrings void RegisterMaterialDebug() { var list = new List(); - + list.Add(CreateMissingDebugShadersWarning()); list.Add(new DebugUI.EnumField { nameAndTooltip = MaterialStrings.CommonMaterialProperties, getter = () => (int)data.materialDebugSettings.debugViewMaterialCommonValue, setter = value => SetDebugViewCommonMaterialProperty((MaterialSharedProperty)value), autoEnum = typeof(MaterialSharedProperty), getIndex = () => (int)data.materialDebugSettings.debugViewMaterialCommonValue, setIndex = value => { data.ResetExclusiveEnumIndices(); data.materialDebugSettings.debugViewMaterialCommonValue = (MaterialSharedProperty)value; } }); list.Add(new DebugUI.EnumField { nameAndTooltip = MaterialStrings.Material, getter = () => (data.materialDebugSettings.debugViewMaterial[0]) == 0 ? 0 : data.materialDebugSettings.debugViewMaterial[1], setter = value => SetDebugViewMaterial(value), enumNames = MaterialDebugSettings.debugViewMaterialStrings, enumValues = MaterialDebugSettings.debugViewMaterialValues, getIndex = () => data.materialDebugSettings.materialEnumIndex, setIndex = value => { data.ResetExclusiveEnumIndices(); data.materialDebugSettings.materialEnumIndex = value; } }); list.Add(new DebugUI.EnumField { nameAndTooltip = MaterialStrings.Engine, getter = () => data.materialDebugSettings.debugViewEngine, setter = value => SetDebugViewEngine(value), enumNames = MaterialDebugSettings.debugViewEngineStrings, enumValues = MaterialDebugSettings.debugViewEngineValues, getIndex = () => data.engineEnumIndex, setIndex = value => { data.ResetExclusiveEnumIndices(); data.engineEnumIndex = value; } }); @@ -1108,7 +1127,7 @@ void RefreshLightingDebug(DebugUI.Field field, T value) void RefreshDecalsDebug(DebugUI.Field field, T value) { - UnregisterDebugItems(k_PanelDecals, m_DebugDecalsAffectingTransparentItems); + UnregisterDebugItems(k_PanelDecals, m_DebugDecalsItems); RegisterDecalsDebug(); } @@ -1225,7 +1244,7 @@ static class LightingStrings void RegisterLightingDebug() { var list = new List(); - + list.Add(CreateMissingDebugShadersWarning()); { var shadows = new DebugUI.Container() { displayName = "Shadows" }; @@ -1918,6 +1937,8 @@ void RegisterRenderingDebug() { var widgetList = new List(); + widgetList.Add(CreateMissingDebugShadersWarning()); + widgetList.Add( new DebugUI.EnumField { nameAndTooltip = RenderingStrings.FullscreenDebugMode, getter = () => (int)data.fullScreenDebugMode, setter = value => SetFullScreenDebugMode((FullScreenDebugMode)value), onValueChanged = RefreshRenderingDebug, enumNames = s_RenderingFullScreenDebugStrings, enumValues = s_RenderingFullScreenDebugValues, getIndex = () => data.renderingFulscreenDebugModeEnumIndex, setIndex = value => { data.ResetExclusiveEnumIndices(); data.renderingFulscreenDebugModeEnumIndex = value; } } ); @@ -2059,9 +2080,14 @@ void RegisterDecalsDebug() } }; - m_DebugDecalsAffectingTransparentItems = new DebugUI.Widget[] { decalAffectingTransparent }; + m_DebugDecalsItems = new DebugUI.Widget[] + { + CreateMissingDebugShadersWarning(), + decalAffectingTransparent + }; + var panel = DebugManager.instance.GetPanel(k_PanelDecals, true); - panel.children.Add(m_DebugDecalsAffectingTransparentItems); + panel.children.Add(m_DebugDecalsItems); } internal void RegisterDebug() @@ -2077,7 +2103,7 @@ internal void RegisterDebug() internal void UnregisterDebug() { - UnregisterDebugItems(k_PanelDecals, m_DebugDecalsAffectingTransparentItems); + UnregisterDebugItems(k_PanelDecals, m_DebugDecalsItems); DisableProfilingRecorders(); if (HDRenderPipeline.currentAsset?.currentPlatformRenderPipelineSettings.supportRayTracing ?? true) diff --git a/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsCommon.cs b/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsCommon.cs index ec93542bfec..8a03d0c5a2f 100644 --- a/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsCommon.cs +++ b/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsCommon.cs @@ -5,6 +5,25 @@ namespace UnityEngine.Rendering.Universal { class DebugDisplaySettingsCommon : IDebugDisplaySettingsData { + internal static class WidgetFactory + { + internal static DebugUI.Widget CreateMissingDebugShadersWarning() => new DebugUI.MessageBox + { + displayName = "Warning: the debug shader variants are missing. Ensure that the \"Strip Debug Variants\" option is disabled in URP Global Settings.", + style = DebugUI.MessageBox.Style.Warning, + isHiddenCallback = () => + { +#if UNITY_EDITOR + return true; +#else + if (UniversalRenderPipelineGlobalSettings.instance != null) + return !UniversalRenderPipelineGlobalSettings.instance.stripDebugVariants; + return true; +#endif + } + }; + } + private class SettingsPanel : DebugDisplaySettingsPanel { public override string PanelName => "Frequently Used"; @@ -13,6 +32,8 @@ private class SettingsPanel : DebugDisplaySettingsPanel public SettingsPanel() { + AddWidget(DebugDisplaySettingsCommon.WidgetFactory.CreateMissingDebugShadersWarning()); + var materialSettingsData = DebugDisplaySettings.Instance.MaterialSettings; AddWidget(new DebugUI.Foldout { @@ -66,6 +87,7 @@ public SettingsPanel() DebugDisplaySettingsRendering.WidgetFactory.CreateMSAA(renderingSettingsData), DebugDisplaySettingsRendering.WidgetFactory.CreatePostProcessing(renderingSettingsData), DebugDisplaySettingsRendering.WidgetFactory.CreateAdditionalWireframeShaderViews(renderingSettingsData), + DebugDisplaySettingsRendering.WidgetFactory.CreateWireframeNotSupportedWarning(renderingSettingsData), DebugDisplaySettingsRendering.WidgetFactory.CreateOverdraw(renderingSettingsData) }, contextMenuItems = new List() diff --git a/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsLighting.cs b/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsLighting.cs index e9babe10d5f..6dce156a8ce 100644 --- a/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsLighting.cs +++ b/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsLighting.cs @@ -41,6 +41,8 @@ private class SettingsPanel : DebugDisplaySettingsPanel public SettingsPanel(DebugDisplaySettingsLighting data) { + AddWidget(DebugDisplaySettingsCommon.WidgetFactory.CreateMissingDebugShadersWarning()); + AddWidget(new DebugUI.Foldout { displayName = "Lighting Debug Modes", diff --git a/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsMaterial.cs b/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsMaterial.cs index e7d25dc7d62..8310ee6b93f 100644 --- a/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsMaterial.cs +++ b/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsMaterial.cs @@ -296,6 +296,8 @@ private class SettingsPanel : DebugDisplaySettingsPanel public override string PanelName => "Material"; public SettingsPanel(DebugDisplaySettingsMaterial data) { + AddWidget(DebugDisplaySettingsCommon.WidgetFactory.CreateMissingDebugShadersWarning()); + AddWidget(new DebugUI.Foldout { displayName = "Material Filters", @@ -307,7 +309,6 @@ public SettingsPanel(DebugDisplaySettingsMaterial data) WidgetFactory.CreateVertexAttribute(data) } }); - AddWidget(new DebugUI.Foldout { displayName = "Material Validation", diff --git a/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsRendering.cs b/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsRendering.cs index 46cb4e2ee02..eacc16634c7 100644 --- a/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsRendering.cs +++ b/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsRendering.cs @@ -82,6 +82,7 @@ static class Strings public static readonly NameAndTooltip MapOverlays = new() { name = "Map Overlays", tooltip = "Overlays render pipeline textures to validate the scene." }; public static readonly NameAndTooltip MapSize = new() { name = "Map Size", tooltip = "Set the size of the render pipeline texture in the scene." }; public static readonly NameAndTooltip AdditionalWireframeModes = new() { name = "Additional Wireframe Modes", tooltip = "Debug the scene with additional wireframe shader views that are different from those in the scene view." }; + public static readonly NameAndTooltip WireframeNotSupportedWarning = new() { name = "Warning: This platform might not support wireframe rendering.", tooltip = "Some platforms, for example, mobile platforms using OpenGL ES and Vulkan, might not support wireframe rendering." }; public static readonly NameAndTooltip Overdraw = new() { name = "Overdraw", tooltip = "Debug anywhere pixels are overdrawn on top of each other." }; public static readonly NameAndTooltip PostProcessing = new() { name = "Post-processing", tooltip = "Override the controls for Post Processing in the scene." }; public static readonly NameAndTooltip MSAA = new() { name = "MSAA", tooltip = "Use the checkbox to disable MSAA in the scene." }; @@ -129,7 +130,30 @@ internal static class WidgetFactory getter = () => (int)data.wireframeMode, setter = (value) => { }, getIndex = () => (int)data.wireframeMode, - setIndex = (value) => data.wireframeMode = (WireframeMode)value + setIndex = (value) => data.wireframeMode = (WireframeMode)value, + onValueChanged = (_, _) => DebugManager.instance.ReDrawOnScreenDebug() + }; + + internal static DebugUI.Widget CreateWireframeNotSupportedWarning(DebugDisplaySettingsRendering data) => new DebugUI.MessageBox + { + nameAndTooltip = Strings.WireframeNotSupportedWarning, + style = DebugUI.MessageBox.Style.Warning, + isHiddenCallback = () => + { +#if UNITY_EDITOR + return true; +#else + switch (SystemInfo.graphicsDeviceType) + { + case GraphicsDeviceType.OpenGLES2: + case GraphicsDeviceType.OpenGLES3: + case GraphicsDeviceType.Vulkan: + return data.wireframeMode == WireframeMode.None; + default: + return true; + } +#endif + } }; internal static DebugUI.Widget CreateOverdraw(DebugDisplaySettingsRendering data) => new DebugUI.BoolField @@ -207,6 +231,8 @@ private class SettingsPanel : DebugDisplaySettingsPanel public SettingsPanel(DebugDisplaySettingsRendering data) { + AddWidget(DebugDisplaySettingsCommon.WidgetFactory.CreateMissingDebugShadersWarning()); + AddWidget(new DebugUI.Foldout { displayName = "Rendering Debug", @@ -220,6 +246,7 @@ public SettingsPanel(DebugDisplaySettingsRendering data) WidgetFactory.CreateMSAA(data), WidgetFactory.CreatePostProcessing(data), WidgetFactory.CreateAdditionalWireframeShaderViews(data), + WidgetFactory.CreateWireframeNotSupportedWarning(data), WidgetFactory.CreateOverdraw(data) } });