diff --git a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.RenderingLayers.cs b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.RenderingLayers.cs index 78fe73ff26c..1cef74c3290 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.RenderingLayers.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.RenderingLayers.cs @@ -127,14 +127,14 @@ static AccelStructAdapter BuildAccelerationStructure() Span perSubMeshOpaqueness = stackalloc bool[subMeshCount]; perSubMeshOpaqueness.Fill(true); - accelStruct.AddInstance(renderer.component.GetEntityId().GetRawData(), renderer.component, perSubMeshMask, matIndices, perSubMeshOpaqueness, 1); + accelStruct.AddInstance(EntityId.ToULong(renderer.component.GetEntityId()), renderer.component, perSubMeshMask, matIndices, perSubMeshOpaqueness, 1); } foreach (var terrain in contributors.terrains) { uint mask = GetInstanceMask(terrain.component.shadowCastingMode); uint materialID = terrain.component.renderingLayerMask; // repurpose the material id as we don't need it here - accelStruct.AddInstance(terrain.component.GetEntityId().GetRawData(), terrain.component, new uint[1] { mask }, new uint[1] { materialID }, new bool[1] { true }, 1); + accelStruct.AddInstance(EntityId.ToULong(terrain.component.GetEntityId()), terrain.component, new uint[1] { mask }, new uint[1] { materialID }, new bool[1] { true }, 1); } return accelStruct; diff --git a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.SkyOcclusion.cs b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.SkyOcclusion.cs index a1a3439789e..7e58424b088 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.SkyOcclusion.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.SkyOcclusion.cs @@ -223,13 +223,13 @@ static AccelStructAdapter BuildAccelerationStructure() Span perSubMeshOpaqueness = stackalloc bool[subMeshCount]; perSubMeshOpaqueness.Fill(true); - accelStruct.AddInstance(renderer.component.GetEntityId().GetRawData(), renderer.component, perSubMeshMask, matIndices, perSubMeshOpaqueness, 1); + accelStruct.AddInstance(EntityId.ToULong(renderer.component.GetEntityId()), renderer.component, perSubMeshMask, matIndices, perSubMeshOpaqueness, 1); } foreach (var terrain in contributors.terrains) { uint mask = GetInstanceMask(terrain.component.shadowCastingMode); - accelStruct.AddInstance(terrain.component.GetEntityId().GetRawData(), terrain.component, new uint[1] { mask }, new uint[1] { 0 }, new bool[1] { true }, 1); + accelStruct.AddInstance(EntityId.ToULong(terrain.component.GetEntityId()), terrain.component, new uint[1] { mask }, new uint[1] { 0 }, new bool[1] { true }, 1); } return accelStruct; diff --git a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.VirtualOffset.cs b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.VirtualOffset.cs index 1f306686115..bc1b14f4ff5 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.VirtualOffset.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.VirtualOffset.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Runtime.InteropServices; using Unity.Collections; +using Unity.Collections.LowLevel.Unsafe; using UnityEditor; using UnityEngine.Rendering.UnifiedRayTracing; @@ -149,7 +150,7 @@ static AccelStructAdapter BuildAccelerationStructure(int mask) Span perSubMeshOpaqueness = stackalloc bool[subMeshCount]; perSubMeshOpaqueness.Fill(true); - accelStruct.AddInstance(renderer.component.GetEntityId().GetRawData(), renderer.component, maskAndMatDummy, maskAndMatDummy, perSubMeshOpaqueness, 1); + accelStruct.AddInstance(EntityId.ToULong(renderer.component.GetEntityId()), renderer.component, maskAndMatDummy, maskAndMatDummy, perSubMeshOpaqueness, 1); } foreach (var terrain in contributors.terrains) @@ -157,7 +158,7 @@ static AccelStructAdapter BuildAccelerationStructure(int mask) int layerMask = 1 << terrain.component.gameObject.layer; if ((layerMask & mask) == 0) continue; - accelStruct.AddInstance(terrain.component.GetEntityId().GetRawData(), terrain.component, new uint[1] { 0xFFFFFFFF }, new uint[1] { 0xFFFFFFFF }, new bool[1] { true }, 1); + accelStruct.AddInstance(EntityId.ToULong(terrain.component.GetEntityId()), terrain.component, new uint[1] { 0xFFFFFFFF }, new uint[1] { 0xFFFFFFFF }, new bool[1] { true }, 1); } return accelStruct; @@ -478,8 +479,9 @@ static uint[] GetMaterialIndices(Renderer renderer) uint[] matIndices = new uint[submeshCount]; for (int i = 0; i < matIndices.Length; ++i) { + Debug.Assert(UnsafeUtility.SizeOf() == sizeof(int), "If this assert is firing, the size of EntityId has changed. This downcase to uint is unsafe."); if (i < renderer.sharedMaterials.Length && renderer.sharedMaterials[i] != null) - matIndices[i] = (uint)renderer.sharedMaterials[i].GetEntityId().GetRawData(); + matIndices[i] = (uint)EntityId.ToULong(renderer.sharedMaterials[i].GetEntityId()); else matIndices[i] = 0; } diff --git a/Packages/com.unity.render-pipelines.core/Editor/SampleDependencyImportSystem/SampleDependencyImporter.cs b/Packages/com.unity.render-pipelines.core/Editor/SampleDependencyImportSystem/SampleDependencyImporter.cs index d2a8bef4d18..c0af592b1ee 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/SampleDependencyImportSystem/SampleDependencyImporter.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/SampleDependencyImportSystem/SampleDependencyImporter.cs @@ -48,7 +48,7 @@ VisualElement panelRoot { get { - _panelRoot ??= injectingElement.panel.visualTree; + _panelRoot ??= injectingElement?.panel?.visualTree; return _panelRoot; } } @@ -82,11 +82,11 @@ VisualElement IPackageManagerExtension.CreateExtensionUI() void RefreshSampleButtons() { - if (injectingElement == null || m_PackageInfo == null || m_SampleList == null) + if (injectingElement == null || m_PackageInfo == null || m_SampleList == null || panelRoot == null) return; // Call refresh of samples and button injection when switching to the "Samples" tab. - if (samplesButton == null ) + if (samplesButton == null) { samplesButton = panelRoot.Q