diff --git a/Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugWindow.cs b/Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugWindow.cs index 625821b9870..8c869115100 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugWindow.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugWindow.cs @@ -30,7 +30,7 @@ public int selectedPanel get => Mathf.Max(0, DebugManager.instance.PanelIndex(selectedPanelDisplayName)); set { - var displayName = DebugManager.instance.PanelDiplayName(value); + var displayName = DebugManager.instance.PanelDisplayName(value); if (!string.IsNullOrEmpty(displayName)) selectedPanelDisplayName = displayName; } diff --git a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeLightingTab.cs b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeLightingTab.cs index ab94e7d8f23..bb2045301a0 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeLightingTab.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeLightingTab.cs @@ -361,6 +361,7 @@ void BakingGUI() activeSet = newSet; ProbeReferenceVolume.instance.Clear(); + ProbeReferenceVolume.instance.SetActiveBakingSet(newSet); } if (activeSet != null) diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsUI.cs b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsUI.cs index 2dbc44e203a..ba1c864a7c2 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsUI.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsUI.cs @@ -32,6 +32,10 @@ private void Reset() /// to be registered public void RegisterDebug(IDebugDisplaySettings settings) { +#if UNITY_EDITOR + if (UnityEditor.BuildPipeline.isBuildingPlayer) + return; +#endif DebugManager debugManager = DebugManager.instance; List panels = new List(); diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugManager.cs b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugManager.cs index b90eed0d6da..f519eb4d8fe 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugManager.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugManager.cs @@ -297,12 +297,24 @@ public int PanelIndex([DisallowNull] string displayName) return -1; } + + /// + /// Returns the panel display name + /// + /// The panelIndex for the panel to get the name + /// The display name of the panel, or empty string otherwise + [Obsolete("Method is obsolete. Use PanelDisplayName instead. #from(6000.4) (UnityUpgradable) -> PanelDisplayName", true)] + public string PanelDiplayName(int panelIndex) + { + return PanelDisplayName(panelIndex); + } + /// /// Returns the panel display name /// /// The panelIndex for the panel to get the name /// The display name of the panel, or empty string otherwise - public string PanelDiplayName([DisallowNull] int panelIndex) + public string PanelDisplayName(int panelIndex) { if (panelIndex < 0 || panelIndex > m_Panels.Count - 1) return string.Empty; diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs index 2f732228409..2803b3dce0d 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs @@ -574,9 +574,7 @@ IEnumerable cameras if (camera.cameraType != CameraType.Preview && camera.cameraType != CameraType.Reflection) { - if (!camera.TryGetComponent(out var additionalData)) - Debug.LogWarning($"Camera {camera.name} does not contain an additional camera data component. Open the Game Object in the inspector to add additional camera data."); - else + if (camera.TryGetComponent(out _)) m_Cameras.Add(camera); } } diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.hlsl b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.hlsl index 370b708c71c..268d33280ac 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.hlsl +++ b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.hlsl @@ -77,7 +77,13 @@ struct APVResources struct APVResourcesRW { +#ifdef SHADER_API_METAL + // We need to use float4 on Metal, since HLSLcc will generate invalid MSL otherwise. + // See https://jira.unity3d.com/browse/UUM-127198 + RWTexture3D L0_L1Rx; +#else RWTexture3D L0_L1Rx; +#endif RWTexture3D L1G_L1Ry; RWTexture3D L1B_L1Rz; RWTexture3D L2_0; diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeBlendStates.compute b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeBlendStates.compute index 30f8252f1d0..75d333d3b4f 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeBlendStates.compute +++ b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeBlendStates.compute @@ -15,7 +15,13 @@ Texture3D _State1_L0_L1Rx; Texture3D _State1_L1G_L1Ry; Texture3D _State1_L1B_L1Rz; +#ifdef SHADER_API_METAL +// We need to use float4 on Metal, since HLSLcc will generate invalid MSL otherwise. +// See https://jira.unity3d.com/browse/UUM-127198 +RWTexture3D _Out_L0_L1Rx; +#else RWTexture3D _Out_L0_L1Rx; +#endif RWTexture3D _Out_L1G_L1Ry; RWTexture3D _Out_L1B_L1Rz; diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeUploadData.compute b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeUploadData.compute index 33418a71fe4..e43d5d7767e 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeUploadData.compute +++ b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeUploadData.compute @@ -9,7 +9,13 @@ #pragma multi_compile_local _ PROBE_VOLUMES_SKY_SHADING_DIRECTION #pragma multi_compile_local _ PROBE_VOLUMES_PROBE_OCCLUSION +#ifdef SHADER_API_METAL +// We need to use float4 on Metal, since HLSLcc will generate invalid MSL otherwise. +// See https://jira.unity3d.com/browse/UUM-127198 +RWTexture3D _Out_L0_L1Rx; +#else RWTexture3D _Out_L0_L1Rx; +#endif RWTexture3D _Out_L1G_L1Ry; RWTexture3D _Out_L1B_L1Rz; diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs index a350074b455..e7f5dff8105 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs @@ -2125,6 +2125,11 @@ void UnregisterRenderingDebug() internal void RegisterDebug() { +#if UNITY_EDITOR + if (UnityEditor.BuildPipeline.isBuildingPlayer) + return; +#endif + RegisterMaterialDebug(); RegisterLightingDebug(); RegisterRenderingDebug(); @@ -2142,6 +2147,9 @@ internal void UnregisterDebug() void UnregisterDebugItems(string panelName, DebugUI.Widget[] items) { + if (items == null || items.Length == 0) + return; + var panel = DebugManager.instance.GetPanel(panelName); if (panel != null) panel.children.Remove(items); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/NVIDIADebugView.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/NVIDIADebugView.cs index 20c7a447011..8f03c9aa460 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/NVIDIADebugView.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/NVIDIADebugView.cs @@ -253,6 +253,9 @@ String resToString(uint a, uint b) private void UpdateDebugUITable() { + if (m_DlssViewStateTableRows == null) + return; + for (int r = 0; r < m_DlssViewStateTableRows.Length; ++r) { var d = m_Data.dlssFeatureInfos[r].data; diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs index 9cbf08dfde1..8f8759159fa 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs @@ -1125,6 +1125,7 @@ internal static void SetExposureTextureToEmpty(RTHandle exposureTexture) bool IsExposureFixed(HDCamera camera) => m_Exposure.mode.value == ExposureMode.Fixed || m_Exposure.mode.value == ExposureMode.UsePhysicalCamera #if UNITY_EDITOR || (camera.camera.cameraType == CameraType.SceneView && HDAdditionalSceneViewSettings.sceneExposureOverriden) + || (UnityEditor.SceneView.lastActiveSceneView != null && UnityEditor.SceneView.lastActiveSceneView.isUsingSceneFiltering) #endif ; diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs index 125318f9f41..9bb02c732a7 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs @@ -670,8 +670,7 @@ public HDRenderPipeline(HDRenderPipelineAsset asset) m_DepthPyramidMipLevelOffsetsBuffer = new ComputeBuffer(15, sizeof(int) * 2); - m_CustomPassColorBuffer = new Lazy(() => RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GetCustomBufferFormat(), enableRandomWrite: true, useDynamicScale: true, name: "CustomPassColorBuffer")); - m_CustomPassDepthBuffer = new Lazy(() => RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GraphicsFormat.None, useDynamicScale: true, name: "CustomPassDepthBuffer", depthBufferBits: CoreUtils.GetDefaultDepthBufferBits())); + AllocateCustomPassBuffers(); // For debugging MousePositionDebug.instance.Build(); @@ -2239,6 +2238,14 @@ protected override void Render(ScriptableRenderContext renderContext, List(() => RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GetCustomBufferFormat(), enableRandomWrite: true, useDynamicScale: true, name: "CustomPassColorBuffer")); + m_CustomPassDepthBuffer = new Lazy(() => RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GraphicsFormat.None, useDynamicScale: true, name: "CustomPassDepthBuffer", depthBufferBits: CoreUtils.GetDefaultDepthBufferBits())); + } } } diff --git a/Packages/com.unity.render-pipelines.universal/Editor/Converter/ConversionIndexers.cs b/Packages/com.unity.render-pipelines.universal/Editor/Converter/ConversionIndexers.cs deleted file mode 100644 index 533d2bd743e..00000000000 --- a/Packages/com.unity.render-pipelines.universal/Editor/Converter/ConversionIndexers.cs +++ /dev/null @@ -1,45 +0,0 @@ -using UnityEditor.Search; -using UnityEngine; -using Object = UnityEngine.Object; - -namespace UnityEditor.Rendering.Universal -{ - static class ConversionIndexers - { - private const int k_Version = 8; - - [CustomObjectIndexer(typeof(Object), version = k_Version)] - internal static void ConversionIndexer(CustomObjectIndexerTarget context, ObjectIndexer indexer) - { - //Custom finding of all default Material properties on every single object type including custom types - if (MaterialReferenceBuilder.MaterialReferenceLookup.TryGetValue(context.targetType, out var methods)) - { - foreach (var method in methods) - { - if (method == null) continue; - - var result = method.GetMaterialFromMethod(context.target, (methodName, objectName) => - $"The method {methodName} was not found on {objectName}. This property will not be indexed."); - - if (result is Material materialResult) - { - if (materialResult != null && MaterialReferenceBuilder.GetIsReadonlyMaterial(materialResult)) - { - indexer.AddProperty("urp", "convert-readonly", context.documentIndex); - } - } - else if (result is Material[] materialArrayResult) - { - foreach (var material in materialArrayResult) - { - if (material != null && MaterialReferenceBuilder.GetIsReadonlyMaterial(material)) - { - indexer.AddProperty("urp", "convert-readonly", context.documentIndex); - } - } - } - } - } - } - } -} diff --git a/Packages/com.unity.render-pipelines.universal/Editor/Converter/ConversionIndexers.cs.meta b/Packages/com.unity.render-pipelines.universal/Editor/Converter/ConversionIndexers.cs.meta deleted file mode 100644 index c1cdbb66abe..00000000000 --- a/Packages/com.unity.render-pipelines.universal/Editor/Converter/ConversionIndexers.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 192e94d6ebdfb96438e2d027c77f9519 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.render-pipelines.universal/Editor/Converter/MaterialReferenceBuilder.cs b/Packages/com.unity.render-pipelines.universal/Editor/Converter/MaterialReferenceBuilder.cs index fbd49bd9b4e..344c0972e31 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/Converter/MaterialReferenceBuilder.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/Converter/MaterialReferenceBuilder.cs @@ -130,7 +130,8 @@ public static object GetMaterialFromMethod(this MethodInfo method, // and we've already checked for other possible null exceptions here if ((e.InnerException is NullReferenceException)) { - Debug.LogWarning(generateErrorString(method.Name, obj.name)); + if (generateErrorString != null) + Debug.LogWarning(generateErrorString(method.Name, obj.name)); } else { diff --git a/Packages/com.unity.render-pipelines.universal/Editor/Converter/ReadonlyMaterialConverter.cs b/Packages/com.unity.render-pipelines.universal/Editor/Converter/ReadonlyMaterialConverter.cs index 6711b944ac1..a0834799650 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/Converter/ReadonlyMaterialConverter.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/Converter/ReadonlyMaterialConverter.cs @@ -45,35 +45,94 @@ internal class ReadonlyMaterialConverter : RenderPipelineConverter List guids = new List(); + public Material[] GetBuiltInMaterials() + { + using (UnityEngine.Pool.ListPool.Get(out var tmp)) + { + foreach (var materialName in ReadonlyMaterialMap.Map.Keys) + { + var name = materialName + ".mat"; + + Material mat = null; + foreach (var material in AssetDatabaseHelper.FindAssets()) + { + if (material.name == materialName) + { + mat = material; + break; + } + } + + if (mat == null) + { + mat = AssetDatabase.GetBuiltinExtraResource(name); + if (mat == null) + { + mat = Resources.GetBuiltinResource(name); + if (mat == null) + { + mat = Resources.Load(name); + } + } + } + + if (mat == null) + { + Debug.LogError($"Material '{materialName}' not found in built-in resources or project assets."); + continue; + } + + tmp.Add(mat); + } + return tmp.ToArray(); + } + } + + private string BuildQuery() + { + using (UnityEngine.Pool.ListPool.Get(out var tmp)) + { + var materials = GetBuiltInMaterials(); + foreach (var mat in materials) + { + string formattedId = $"<$object:{GlobalObjectId.GetGlobalObjectIdSlow(mat)},UnityEngine.Object$>"; + tmp.Add($"ref={formattedId}"); + } + + return string.Join(" or ", tmp) + " -t:RenderPipelineGlobalSettings"; + } + } + public override void OnInitialize(InitializeConverterContext ctx, Action callback) { + var query = BuildQuery(); Search.SearchService.Request ( - Search.SearchService.CreateContext("asset", "urp=convert-readonly a=URPConverterIndex"), + Search.SearchService.CreateContext(new[] { "asset", "scene" }, query), (searchContext, items) => { - // we're going to do this step twice in order to get them ordered, but it should be fast - var orderedRequest = items.OrderBy(req => + foreach (var r in items) { - GlobalObjectId.TryParse(req.id, out var gid); - return gid.assetGUID; - }); + if (r == null || r.id == null) + continue; - foreach (var r in orderedRequest) - { - if (string.IsNullOrEmpty(r?.id) || - !GlobalObjectId.TryParse(r.id, out var gid)) - { + // Direct conversion - works for both assets and scene objects + var unityObject = r.ToObject(); + + if (unityObject == null) continue; - } var label = r.provider.fetchLabel(r, r.context); var description = r.provider.fetchDescription(r, r.context); + var gid = GlobalObjectId.GetGlobalObjectIdSlow(unityObject); + int type = gid.identifierType; // 1=Asset, 2=SceneObject + + var go = unityObject as GameObject; var item = new ConverterItemDescriptor() { - name = description.Split('/').Last().Split('.').First(), - info = $"{label}", + name = $"{unityObject.name} ({(type == 1 ? "Prefab" : "SceneObject")})", + info = type == 1 ? AssetDatabase.GetAssetPath(unityObject) : go.scene.path, }; guids.Add(gid.ToString()); diff --git a/Packages/com.unity.render-pipelines.universal/Editor/Converter/RenderPipelineConvertersEditor.cs b/Packages/com.unity.render-pipelines.universal/Editor/Converter/RenderPipelineConvertersEditor.cs index 61ef2cf5d64..96f44a87011 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/Converter/RenderPipelineConvertersEditor.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/Converter/RenderPipelineConvertersEditor.cs @@ -97,8 +97,6 @@ internal class RenderPipelineConvertersEditor : EditorWindow Button m_InitAnConvertButton; Button m_ContainerHelpButton; - bool m_InitAndConvert; - List m_CoreConvertersList = new List(); List m_VEList = new List(); @@ -269,9 +267,6 @@ public void CreateGUI() m_InitButton = rootVisualElement.Q