Skip to content

Commit 3e58ebf

Browse files
authored
Merge pull request #8258 from Unity-Technologies/internal/6000.4/staging
Mirror Internal/6000.4/staging
2 parents 1309681 + 7f0d5c2 commit 3e58ebf

File tree

111 files changed

+2408
-593
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+2408
-593
lines changed

Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.LightTransport.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ static void UpdateLightStatus()
668668
var sceneLights = new Dictionary<Scene, List<Light>>();
669669

670670
// Modify each baked light, take note of which scenes they belong to.
671-
var allLights = Object.FindObjectsByType<Light>(FindObjectsSortMode.None);
671+
var allLights = Object.FindObjectsByType<Light>();
672672
foreach (var light in allLights)
673673
{
674674
if (light.lightmapBakeType != LightmapBakeType.Realtime)

Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.Placement.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ internal static List<ProbeVolumePerSceneData> GetPerSceneDataList()
7373

7474
internal static List<ProbeVolume> GetProbeVolumeList()
7575
{
76+
#pragma warning disable CS0618 // Type or member is obsolete
7677
var fullPvList = GameObject.FindObjectsByType<ProbeVolume>(FindObjectsSortMode.InstanceID);
78+
#pragma warning restore CS0618 // Type or member is obsolete
7779
List<ProbeVolume> usedPVList;
7880

7981
if (isBakingSceneSubset)

Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,13 @@ public BakingBatch(Vector3Int cellCount, ProbeReferenceVolume refVolume)
306306
maxBrickCount = cellCount * ProbeReferenceVolume.CellSize(refVolume.GetMaxSubdivision());
307307
inverseScale = ProbeBrickPool.kBrickCellCount / refVolume.MinBrickSize();
308308
offset = refVolume.ProbeOffset();
309-
309+
310310
// Initialize NativeHashMaps with reasonable initial capacity
311311
// Using a larger capacity to reduce allocations during baking
312312
positionToIndex = new NativeHashMap<int, int>(100000, Allocator.Persistent);
313313
uniqueBrickSubdiv = new NativeHashMap<int, int>(100000, Allocator.Persistent);
314314
}
315-
315+
316316
public void Dispose()
317317
{
318318
if (positionToIndex.IsCreated)
@@ -746,7 +746,9 @@ static internal void Clear()
746746
if (activeSet != null)
747747
activeSet.Clear();
748748

749+
#pragma warning disable CS0618 // Type or member is obsolete
749750
var probeVolumes = GameObject.FindObjectsByType<ProbeVolume>(FindObjectsSortMode.InstanceID);
751+
#pragma warning restore CS0618 // Type or member is obsolete
750752
foreach (var probeVolume in probeVolumes)
751753
probeVolume.OnLightingDataAssetCleared();
752754
}
@@ -879,7 +881,9 @@ static void CellCountInDirections(out Vector3Int minCellPositionXYZ, out Vector3
879881
static TouchupVolumeWithBoundsList GetAdjustementVolumes()
880882
{
881883
// This is slow, but we should have very little amount of touchup volumes.
884+
#pragma warning disable CS0618 // Type or member is obsolete
882885
var touchupVolumes = Object.FindObjectsByType<ProbeAdjustmentVolume>(FindObjectsSortMode.InstanceID);
886+
#pragma warning restore CS0618 // Type or member is obsolete
883887

884888
var touchupVolumesAndBounds = new TouchupVolumeWithBoundsList(touchupVolumes.Length);
885889
foreach (var touchup in touchupVolumes)
@@ -1098,7 +1102,7 @@ static void BakeDelegate(ref float progress, ref bool done)
10981102
{
10991103
FixSeams(
11001104
s_BakeData.positionRemap,
1101-
s_BakeData.originalPositions,
1105+
s_BakeData.sortedPositions,
11021106
s_BakeData.lightingJob.irradiance,
11031107
s_BakeData.lightingJob.validity,
11041108
s_BakeData.lightingJob.occlusion,
@@ -1323,7 +1327,7 @@ internal static void FixSeams(
13231327
NativeArray<Vector4> skyOcclusion,
13241328
NativeArray<uint> renderingLayerMasks)
13251329
{
1326-
// Seams are caused are caused by probes on the boundary between two subdivision levels
1330+
// Seams are caused by probes on the boundary between two subdivision levels
13271331
// The idea is to find first them and do a kind of dilation to smooth the values on the boundary
13281332
// the dilation process consits in doing a trilinear sample of the higher subdivision brick and override the lower subdiv with that
13291333
// We have to mark the probes on the boundary as valid otherwise leak reduction at runtime will interfere with this method
@@ -1443,7 +1447,8 @@ Vector3Int GetCellPositionFromVoxel(Vector3Int voxelToLookup, int cellSizeInBric
14431447
{
14441448
uint renderingLayerMask = renderingLayerMasks[positionRemap[index]];
14451449
bool commonRenderingLayer = (renderingLayerMask & probeRenderingLayerMask) != 0;
1446-
if (!commonRenderingLayer) continue; // We do not use this probe contribution if it does not share at least a common rendering layer
1450+
if (!commonRenderingLayer)
1451+
continue; // We do not use this probe contribution if it does not share at least a common rendering layer
14471452
}
14481453

14491454
// Do the lerp in compressed format to match result on GPU
@@ -1512,7 +1517,7 @@ static void ApplyPostBakeOperations()
15121517
var chunkSizeInProbes = ProbeBrickPool.GetChunkSizeInProbeCount();
15131518
var hasVirtualOffsets = m_BakingSet.settings.virtualOffsetSettings.useVirtualOffset;
15141519
var hasRenderingLayers = m_BakingSet.useRenderingLayers;
1515-
1520+
15161521
if (!ValidateBakingCellsSize(bakingCellsArray, chunkSizeInProbes, hasVirtualOffsets, hasRenderingLayers))
15171522
return; // Early exit if validation fails
15181523

Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeSubdivisionContext.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ static void UpdateRealtimeSubdivisionDebug()
4242

4343
if (Time.realtimeSinceStartupAsDouble - s_LastSubdivisionTime > debugDisplay.subdivisionDelayInSeconds)
4444
{
45+
#pragma warning disable CS0618 // Type or member is obsolete
4546
var probeVolume = GameObject.FindFirstObjectByType<ProbeVolume>();
47+
#pragma warning restore CS0618 // Type or member is obsolete
4648
if (probeVolume == null || !probeVolume.isActiveAndEnabled)
4749
return;
4850

Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeLightingTab.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,7 +1216,9 @@ internal class ProbeVolumeOverlay : Overlay, ITransientOverlay
12161216
{
12171217
if (ProbeReferenceVolume.instance.probeVolumeDebug.realtimeSubdivision)
12181218
{
1219+
#pragma warning disable CS0618 // Type or member is obsolete
12191220
var probeVolume = GameObject.FindFirstObjectByType<ProbeVolume>();
1221+
#pragma warning restore CS0618 // Type or member is obsolete
12201222
if (probeVolume != null && probeVolume.isActiveAndEnabled)
12211223
{
12221224
var profile = ProbeVolumeBakingSet.GetBakingSetForScene(probeVolume.gameObject.scene);

Packages/com.unity.render-pipelines.core/Editor/RenderGraph/RenderGraphViewer.PlayerConnection.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ public PlayerConnection(IConnectionState connectionState, UnityEngine.Events.Uni
2424
EditorConnection.instance.Initialize();
2525
EditorConnection.instance.RegisterConnection(m_OnPlayerConnected);
2626
EditorConnection.instance.RegisterDisconnection(m_OnPlayerDisconnected);
27-
28-
EditorApplication.quitting += OnEditorQuitting;
2927
}
3028

3129
public void Dispose()
@@ -35,27 +33,15 @@ public void Dispose()
3533
EditorConnection.instance.UnregisterConnection(m_OnPlayerConnected);
3634
EditorConnection.instance.UnregisterDisconnection(m_OnPlayerDisconnected);
3735

38-
// NOTE: There is a bug where editor crashes if we call DisconnectAll during shutdown flow. In this case
39-
// it's fine to skip the disconnect as the player will get notified of it anyway.
40-
if (!m_EditorQuitting)
41-
EditorConnection.instance.DisconnectAll();
42-
4336
m_ConnectionState.Dispose();
4437
m_ConnectionState = null;
45-
46-
EditorApplication.quitting -= OnEditorQuitting;
4738
}
4839
}
4940

5041
public void OnConnectionDropdownIMGUI()
5142
{
5243
PlayerConnectionGUILayout.ConnectionTargetSelectionDropdown(m_ConnectionState, EditorStyles.toolbarDropDown, 250);
5344
}
54-
55-
void OnEditorQuitting()
56-
{
57-
m_EditorQuitting = true;
58-
}
5945
}
6046
}
6147
}

Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugManager.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@ void EnsurePersistentCanvas()
227227
{
228228
if (m_RootUIPersistentCanvas == null)
229229
{
230+
#pragma warning disable CS0618 // Type or member is obsolete
230231
var uiManager = UnityObject.FindFirstObjectByType<DebugUIHandlerPersistentCanvas>();
232+
#pragma warning restore CS0618 // Type or member is obsolete
231233

232234
if (uiManager == null)
233235
{

Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugUpdater.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ internal static void HandleInternalEventSystemComponents(bool uiEnabled)
8080

8181
void EnsureExactlyOneEventSystem()
8282
{
83-
var eventSystems = FindObjectsByType<EventSystem>(FindObjectsSortMode.None);
83+
var eventSystems = FindObjectsByType<EventSystem>();
8484
var debugEventSystem = GetComponent<EventSystem>();
8585

8686
if (eventSystems.Length > 1 && debugEventSystem != null)

Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/GPUResidentDrawer.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -924,12 +924,12 @@ private unsafe struct FindRenderersFromMaterialOrMeshJob : IJobParallelForBatch
924924

925925
public void Execute(int startIndex, int count)
926926
{
927-
int* renderersToAddForMaterialsPtr = stackalloc int[k_BatchSize];
928-
var renderersToAddForMaterials = new UnsafeList<int>(renderersToAddForMaterialsPtr, k_BatchSize);
927+
EntityId* renderersToAddForMaterialsPtr = stackalloc EntityId[k_BatchSize];
928+
var renderersToAddForMaterials = new UnsafeList<EntityId>(renderersToAddForMaterialsPtr, k_BatchSize);
929929
renderersToAddForMaterials.Length = 0;
930930

931-
int* renderersToAddForMeshesPtr = stackalloc int[k_BatchSize];
932-
var renderersToAddForMeshes = new UnsafeList<int>(renderersToAddForMeshesPtr, k_BatchSize);
931+
EntityId* renderersToAddForMeshesPtr = stackalloc EntityId[k_BatchSize];
932+
var renderersToAddForMeshes = new UnsafeList<EntityId>(renderersToAddForMeshesPtr, k_BatchSize);
933933
renderersToAddForMeshes.Length = 0;
934934

935935
for (int index = 0; index < count; index++)
@@ -945,9 +945,7 @@ public void Execute(int startIndex, int count)
945945
var meshID = meshIDArray[rendererIndex];
946946
if (meshIDs.Contains(meshID))
947947
{
948-
#pragma warning disable 618 // todo @emilie.thaulow make renderID an EntityId
949948
renderersToAddForMeshes.AddNoResize(rendererID);
950-
#pragma warning restore 618
951949
// We can skip the material check if we found a mesh match since at this point
952950
// the renderer is already added and will be processed by the mesh branch
953951
continue;

Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/InstanceCuller.cs

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,7 +1281,7 @@ internal enum FilteringJobMode
12811281
internal unsafe struct DrawCommandOutputFiltering : IJob
12821282
{
12831283
[ReadOnly] public NativeParallelHashMap<uint, BatchID> batchIDs;
1284-
[ReadOnly] public int viewID;
1284+
[ReadOnly] public EntityId viewID;
12851285

12861286
[ReadOnly] public GPUInstanceDataBuffer.ReadOnly instanceDataBuffer;
12871287

@@ -1816,10 +1816,8 @@ private JobHandle AnimateCrossFades(CPUPerCameraInstanceData perCameraInstanceDa
18161816
}
18171817

18181818
//For main camera, animate crossfades, and store the result in the hashmap to be retrieved by other cameras
1819-
var viewID = cc.viewID.GetInstanceID();
1820-
#pragma warning disable 618 // todo @emilie.thaulow make viewID an EntityId
1821-
hasAnimatedCrossfade = perCameraInstanceData.perCameraData.TryGetValue(viewID, out var tmpCameraInstanceData);
1822-
#pragma warning restore 618
1819+
var viewID = cc.viewID;
1820+
hasAnimatedCrossfade = perCameraInstanceData.perCameraData.TryGetValue(viewID.GetEntityId(), out var tmpCameraInstanceData);
18231821
if (hasAnimatedCrossfade == false)
18241822
{
18251823
// For picking / filtering and outlining passes. We do not have animated crossfade data.
@@ -1836,9 +1834,7 @@ private JobHandle AnimateCrossFades(CPUPerCameraInstanceData perCameraInstanceDa
18361834
crossFadeArray = cameraInstanceData.crossFades
18371835
}.Schedule(perCameraInstanceData.instancesLength, AnimateCrossFadeJob.k_BatchSize);
18381836

1839-
#pragma warning disable 618 // todo @emilie.thaulow make viewID an EntityId
1840-
m_LODParamsToCameraID.TryAdd(lodHash, new AnimatedFadeData(){ cameraID = viewID, jobHandle = handle});
1841-
#pragma warning restore 618
1837+
m_LODParamsToCameraID.TryAdd(lodHash, new AnimatedFadeData(){ cameraID = viewID.GetEntityId(), jobHandle = handle});
18421838
return handle;
18431839
}
18441840

@@ -1868,10 +1864,8 @@ private unsafe JobHandle CreateFrustumCullingJob(
18681864
InstanceCullerBurst.SetupCullingJobInput(QualitySettings.lodBias, QualitySettings.meshLodThreshold, contextPtr, &receiverPlanes, &receiverSphereCuller,
18691865
&frustumPlaneCuller, &screenRelativeMetric, &meshLodConstant);
18701866
}
1871-
#pragma warning disable 618 // todo @emilie.thaulow make GetInstanceID return EntityId
18721867
if (occlusionCullingCommon != null)
1873-
occlusionCullingCommon.UpdateSilhouettePlanes(cc.viewID.GetInstanceID(), receiverPlanes.SilhouettePlaneSubArray());
1874-
#pragma warning restore 618
1868+
occlusionCullingCommon.UpdateSilhouettePlanes(cc.viewID.GetEntityId(), receiverPlanes.SilhouettePlaneSubArray());
18751869

18761870
var jobHandle = AnimateCrossFades(perCameraInstanceData, cc, out var cameraInstanceData, out var hasAnimatedCrossfade);
18771871

@@ -2012,9 +2006,7 @@ public unsafe JobHandle CreateCullJobTree(
20122006
int debugCounterBaseIndex = -1;
20132007
if (m_DebugStats?.enabled ?? false)
20142008
{
2015-
#pragma warning disable 618 // todo @emilie.thaulow make GetInstanceID return EntityId
2016-
debugCounterBaseIndex = m_SplitDebugArray.TryAddSplits(cc.viewType, cc.viewID.GetInstanceID(), cc.cullingSplits.Length);
2017-
#pragma warning restore 618
2009+
debugCounterBaseIndex = m_SplitDebugArray.TryAddSplits(cc.viewType, cc.viewID.GetEntityId(), cc.cullingSplits.Length);
20182010
}
20192011

20202012
var batchCount = drawInstanceData.drawBatches.Length;
@@ -2030,16 +2022,12 @@ public unsafe JobHandle CreateCullJobTree(
20302022
var binVisibleInstanceOffsets = new NativeArray<int>(maxBinCount, Allocator.TempJob, NativeArrayOptions.UninitializedMemory);
20312023

20322024
int indirectContextIndex = -1;
2033-
#pragma warning disable 618 //todo @emilie.thaulow make GetInstanceID return EntityId
2034-
bool useOcclusionCulling = (occlusionCullingCommon != null) && occlusionCullingCommon.HasOccluderContext(cc.viewID.GetInstanceID());
2035-
#pragma warning restore 618
2025+
bool useOcclusionCulling = (occlusionCullingCommon != null) && occlusionCullingCommon.HasOccluderContext(cc.viewID.GetEntityId());
20362026
if (useOcclusionCulling)
20372027
{
2038-
#pragma warning disable 618 // todo @emilie.thaulow make GetInstanceID return EntityId
2039-
int viewInstanceID = cc.viewID.GetInstanceID();
2040-
indirectContextIndex = m_IndirectStorage.TryAllocateContext(viewInstanceID);
2041-
#pragma warning restore 618
2042-
cullingOutput.customCullingResult[0] = (IntPtr)viewInstanceID;
2028+
EntityId viewEntityId = cc.viewID.GetEntityId();
2029+
indirectContextIndex = m_IndirectStorage.TryAllocateContext(viewEntityId);
2030+
cullingOutput.customCullingResult[0] = (IntPtr)viewEntityId.GetRawData();
20432031
}
20442032
IndirectBufferLimits indirectBufferLimits = m_IndirectStorage.GetLimits(indirectContextIndex);
20452033
NativeArray<IndirectBufferAllocInfo> indirectBufferAllocInfo = m_IndirectStorage.GetAllocInfoSubArray(indirectContextIndex);
@@ -2201,7 +2189,7 @@ private JobHandle CreateFilteringCullingOutputJob_EditorOnly(in BatchCullingCont
22012189

22022190
var drawOutputJob = new DrawCommandOutputFiltering
22032191
{
2204-
viewID = cc.viewID.GetInstanceID(),
2192+
viewID = cc.viewID.GetEntityId(),
22052193
batchIDs = batchIDs,
22062194
instanceDataBuffer = instanceDataBuffer,
22072195
rendererVisibilityMasks = rendererVisibilityMasks,
@@ -2244,7 +2232,7 @@ private JobHandle CreatePickingCullingOutputJob_EditorOnly(in BatchCullingContex
22442232

22452233
var drawOutputJob = new DrawCommandOutputFiltering
22462234
{
2247-
viewID = cc.viewID.GetInstanceID(),
2235+
viewID = cc.viewID.GetEntityId(),
22482236
batchIDs = batchIDs,
22492237
instanceDataBuffer = instanceDataBuffer,
22502238
rendererVisibilityMasks = rendererVisibilityMasks,

0 commit comments

Comments
 (0)