Skip to content

Commit f4723f4

Browse files
Internal/6000.1/staging
Internal/6000.1/staging
2 parents 1bf4414 + 4f5cc2e commit f4723f4

File tree

323 files changed

+20549
-3761
lines changed

Some content is hidden

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

323 files changed

+20549
-3761
lines changed

Packages/com.unity.render-pipelines.core/Documentation~/advanced-properties.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ There is a global state per user that stores if Unity displays **advanced proper
1010
Not every component or Volume Override includes advanced properties.
1111
If one does, it has a contextual menu to the right of each property section header that includes additional properties. To expose advanced properties for that section, open the contextual menu and click **Advanced Properties**.
1212

13-
For an example, see the **Water Surface** component in [High Definition Render Pipeline (HDRP)](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest).
13+
For an example, refer to the **Water Surface** component in [High Definition Render Pipeline (HDRP)](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest?subfolder=/manual/settings-and-properties-related-to-the-water-system.html).
1414

1515
By default only standard properties are shown.
1616

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,12 +1656,18 @@ void InitializePersistentElements()
16561656

16571657
void OnGraphRegistered(RenderGraph graph)
16581658
{
1659+
if (m_RegisteredGraphs.ContainsKey(graph))
1660+
return;
1661+
16591662
m_RegisteredGraphs.Add(graph, new HashSet<string>());
16601663
RebuildHeaderUI();
16611664
}
16621665

16631666
void OnGraphUnregistered(RenderGraph graph)
16641667
{
1668+
if (!m_RegisteredGraphs.ContainsKey(graph))
1669+
return;
1670+
16651671
m_RegisteredGraphs.Remove(graph);
16661672
RebuildHeaderUI();
16671673
if (m_RegisteredGraphs.Count == 0)

Packages/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentEditor.cs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,6 @@ internal void Init()
279279
var supportedOn = volumeComponentType.GetCustomAttribute<VolumeComponentMenuForRenderPipeline>();
280280
m_LegacyPipelineTypes = supportedOn != null ? supportedOn.pipelineTypes : Array.Empty<Type>();
281281
#pragma warning restore CS0618
282-
283-
EditorApplication.contextualPropertyMenu += OnPropertyContextMenu;
284-
}
285-
286-
void OnDestroy()
287-
{
288-
EditorApplication.contextualPropertyMenu -= OnPropertyContextMenu;
289282
}
290283

291284
internal void DetermineVisibility(Type renderPipelineAssetType, Type renderPipelineType)
@@ -393,23 +386,13 @@ internal void AddDefaultProfileContextMenuEntries(
393386
profile != null &&
394387
defaultProfile != profile)
395388
{
389+
menu.AddSeparator(string.Empty);
396390
menu.AddItem(EditorGUIUtility.TrTextContent($"Show Default Volume Profile"), false,
397391
() => Selection.activeObject = defaultProfile);
398392
menu.AddItem(EditorGUIUtility.TrTextContent($"Apply Values to Default Volume Profile"), false, copyAction);
399393
}
400394
}
401395

402-
void OnPropertyContextMenu(GenericMenu menu, SerializedProperty property)
403-
{
404-
if (property.serializedObject.targetObject != target)
405-
return;
406-
407-
var targetComponent = property.serializedObject.targetObject as VolumeComponent;
408-
409-
AddDefaultProfileContextMenuEntries(menu, VolumeManager.instance.globalDefaultProfile,
410-
() => VolumeProfileUtils.AssignValuesToProfile(VolumeManager.instance.globalDefaultProfile, targetComponent, property));
411-
}
412-
413396
/// <summary>
414397
/// Unity calls this method after drawing the header for each VolumeComponentEditor
415398
/// </summary>

Packages/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,14 @@ public void OnGUI()
236236

237237
// Even if the asset is not dirty, the list of component may have been changed by another inspector.
238238
// In this case, only the hash will tell us that we need to refresh.
239-
if (asset.isDirty || asset.GetComponentListHashCode() != m_CurrentHashCode)
239+
if (asset.dirtyState != VolumeProfile.DirtyState.None || asset.GetComponentListHashCode() != m_CurrentHashCode)
240240
{
241241
RefreshEditors();
242242
VolumeManager.instance.OnVolumeProfileChanged(asset);
243-
asset.isDirty = false;
243+
244+
if ((asset.dirtyState & VolumeProfile.DirtyState.DirtyByProfileReset) != 0)
245+
UnityEditorInternal.InternalEditorUtility.RepaintAllViews();
246+
asset.dirtyState = VolumeProfile.DirtyState.None;
244247
}
245248

246249
if (m_IsDefaultVolumeProfile && VolumeManager.instance.isInitialized && m_EditorsByCategory.Count == 0)
@@ -445,13 +448,14 @@ void OnContextClick(Vector2 position, VolumeComponentEditor targetEditor, int id
445448
if (!m_IsDefaultVolumeProfile)
446449
menu.AddItem(EditorGUIUtility.TrTextContent("Remove"), false, () => RemoveComponent(id));
447450

448-
menu.AddSeparator(string.Empty);
449451

450452
if (targetEditor.hasAdditionalProperties)
453+
{
454+
menu.AddSeparator(string.Empty);
451455
menu.AddAdvancedPropertiesBoolMenuItem(() => targetEditor.showAdditionalProperties,
452456
() => targetEditor.showAdditionalProperties ^= true);
457+
}
453458

454-
menu.AddSeparator(string.Empty);
455459
targetEditor.AddDefaultProfileContextMenuEntries(menu, VolumeManager.instance.globalDefaultProfile,
456460
() => VolumeProfileUtils.CopyValuesToProfile(targetComponent, VolumeManager.instance.globalDefaultProfile));
457461

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

Lines changed: 153 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
using System;
22
using System.Collections.Generic;
33
using Unity.Collections;
4+
#if UNITY_EDITOR
5+
using UnityEditor;
6+
#endif
47
using static UnityEngine.Rendering.DebugUI;
58
using static UnityEngine.Rendering.DebugUI.Widget;
69

@@ -106,6 +109,7 @@ private static InstanceOcclusionEventStats GetInstanceOcclusionEventStats(int pa
106109
else
107110
return new InstanceOcclusionEventStats();
108111
}
112+
109113
static class Strings
110114
{
111115
public const string drawerSettingsContainerName = "GPU Resident Drawer Settings";
@@ -144,6 +148,7 @@ private static int GetInstanceOcclusionEventCount()
144148
{
145149
return GPUResidentDrawer.GetDebugStats()?.instanceOcclusionEventStats.Length ?? 0;
146150
}
151+
147152
private static DebugUI.Table.Row AddInstanceCullerViewDataRow(int viewIndex)
148153
{
149154
return new DebugUI.Table.Row
@@ -154,9 +159,32 @@ private static DebugUI.Table.Row AddInstanceCullerViewDataRow(int viewIndex)
154159
children =
155160
{
156161
new DebugUI.Value { displayName = "View Type", refreshRate = k_RefreshRate, formatString = k_FormatString, getter = () => GetInstanceCullerViewStats(viewIndex).viewType },
157-
new DebugUI.Value { displayName = "View Instance ID", refreshRate = k_RefreshRate, formatString = k_FormatString, getter = () => GetInstanceCullerViewStats(viewIndex).viewInstanceID },
162+
new DebugUI.Value { displayName = "View Instance ID", refreshRate = k_RefreshRate, formatString = k_FormatString, getter = () =>
163+
{
164+
var viewStats = GetInstanceCullerViewStats(viewIndex);
165+
#if UNITY_EDITOR
166+
Object view = EditorUtility.InstanceIDToObject(viewStats.viewInstanceID);
167+
if (view)
168+
{
169+
return $"{viewStats.viewInstanceID} ({view.name})";
170+
}
171+
#endif
172+
return viewStats.viewInstanceID;
173+
}
174+
},
158175
new DebugUI.Value { displayName = "Split Index", refreshRate = k_RefreshRate, formatString = k_FormatString, getter = () => GetInstanceCullerViewStats(viewIndex).splitIndex },
159-
new DebugUI.Value { displayName = "Visible Instances", refreshRate = k_RefreshRate, formatString = k_FormatString, getter = () => GetInstanceCullerViewStats(viewIndex).visibleInstances },
176+
new DebugUI.Value { displayName = "Visible Instances CPU | GPU", tooltip = "Visible instances after CPU culling and after GPU culling.", refreshRate = k_RefreshRate, formatString = k_FormatString, getter = () =>
177+
{
178+
var viewStats = GetInstanceCullerViewStats(viewIndex);
179+
return $"{viewStats.visibleInstancesOnCPU} | {viewStats.visibleInstancesOnGPU}";
180+
}
181+
},
182+
new DebugUI.Value { displayName = "Visible Primitives CPU | GPU", tooltip = "Visible primitives after CPU culling and after GPU culling.", refreshRate = k_RefreshRate, formatString = k_FormatString, getter = () =>
183+
{
184+
var viewStats = GetInstanceCullerViewStats(viewIndex);
185+
return $"{viewStats.visiblePrimitivesOnCPU} | {viewStats.visiblePrimitivesOnGPU}";
186+
}
187+
},
160188
new DebugUI.Value { displayName = "Draw Commands", refreshRate = k_RefreshRate, formatString = k_FormatString, getter = () => GetInstanceCullerViewStats(viewIndex).drawCommands },
161189
}
162190
};
@@ -182,6 +210,16 @@ private static object CulledInstancesString(in InstanceOcclusionEventStats stats
182210
return (stats.eventType == InstanceOcclusionEventType.OcclusionTest) ? stats.culledInstances : "-";
183211
}
184212

213+
private static object VisiblePrimitivesString(in InstanceOcclusionEventStats stats)
214+
{
215+
return (stats.eventType == InstanceOcclusionEventType.OcclusionTest) ? stats.visiblePrimitives : "-";
216+
}
217+
218+
private static object CulledPrimitivesString(in InstanceOcclusionEventStats stats)
219+
{
220+
return (stats.eventType == InstanceOcclusionEventType.OcclusionTest) ? stats.culledPrimitives : "-";
221+
}
222+
185223
private static DebugUI.Table.Row AddInstanceOcclusionPassDataRow(int eventIndex)
186224
{
187225
return new DebugUI.Table.Row
@@ -191,13 +229,27 @@ private static DebugUI.Table.Row AddInstanceOcclusionPassDataRow(int eventIndex)
191229
isHiddenCallback = () => { return eventIndex >= GetInstanceOcclusionEventCount(); },
192230
children =
193231
{
194-
new DebugUI.Value { displayName = "View Instance ID", refreshRate = k_RefreshRate, formatString = k_FormatString, getter = () => GetInstanceOcclusionEventStats(eventIndex).viewInstanceID },
232+
new DebugUI.Value { displayName = "View Instance ID", refreshRate = k_RefreshRate, formatString = k_FormatString, getter = () =>
233+
{
234+
var eventStats = GetInstanceOcclusionEventStats(eventIndex);
235+
#if UNITY_EDITOR
236+
Object view = EditorUtility.InstanceIDToObject(eventStats.viewInstanceID);
237+
if (view)
238+
{
239+
return $"{eventStats.viewInstanceID} ({view.name})";
240+
}
241+
#endif
242+
return eventStats.viewInstanceID;
243+
}
244+
},
195245
new DebugUI.Value { displayName = "Event Type", refreshRate = k_RefreshRate, formatString = k_FormatString, getter = () => $"{GetInstanceOcclusionEventStats(eventIndex).eventType}" },
196246
new DebugUI.Value { displayName = "Occluder Version", refreshRate = k_RefreshRate, formatString = k_FormatString, getter = () => OccluderVersionString(GetInstanceOcclusionEventStats(eventIndex)) },
197247
new DebugUI.Value { displayName = "Subview Mask", refreshRate = k_RefreshRate, formatString = k_FormatString, getter = () => $"0x{GetInstanceOcclusionEventStats(eventIndex).subviewMask:X}" },
198248
new DebugUI.Value { displayName = "Occlusion Test", refreshRate = k_RefreshRate, formatString = k_FormatString, getter = () => $"{OcclusionTestString(GetInstanceOcclusionEventStats(eventIndex))}" },
199249
new DebugUI.Value { displayName = "Visible Instances", refreshRate = k_RefreshRate, formatString = k_FormatString, getter = () => VisibleInstancesString(GetInstanceOcclusionEventStats(eventIndex)) },
200250
new DebugUI.Value { displayName = "Culled Instances", refreshRate = k_RefreshRate, formatString = k_FormatString, getter = () => CulledInstancesString(GetInstanceOcclusionEventStats(eventIndex)) },
251+
new DebugUI.Value { displayName = "Visible Primitives", refreshRate = k_RefreshRate, formatString = k_FormatString, getter = () => VisiblePrimitivesString(GetInstanceOcclusionEventStats(eventIndex)) },
252+
new DebugUI.Value { displayName = "Culled Primitives", refreshRate = k_RefreshRate, formatString = k_FormatString, getter = () => CulledPrimitivesString(GetInstanceOcclusionEventStats(eventIndex)) },
201253
}
202254
};
203255
}
@@ -298,6 +350,104 @@ private void AddInstanceCullingStatsWidget(DebugDisplayGPUResidentDrawer data)
298350
}
299351
});
300352

353+
instanceCullerStats.children.Add(new DebugUI.ValueTuple()
354+
{
355+
displayName = "Total Visible Instances (Cameras | Lights | Both)",
356+
values = new[]
357+
{
358+
new DebugUI.Value { refreshRate = k_RefreshRate, formatString = k_FormatString, getter = () =>
359+
{
360+
int totalGRDInstances = 0;
361+
362+
for (int viewIndex = 0; viewIndex < GetInstanceCullerViewCount(); viewIndex++)
363+
{
364+
var viewStats = GetInstanceCullerViewStats(viewIndex);
365+
if (viewStats.viewType == BatchCullingViewType.Camera)
366+
totalGRDInstances += viewStats.visibleInstancesOnGPU;
367+
}
368+
return totalGRDInstances;
369+
}
370+
},
371+
new DebugUI.Value { refreshRate = k_RefreshRate, formatString = k_FormatString, getter = () =>
372+
{
373+
int totalGRDInstances = 0;
374+
375+
for (int viewIndex = 0; viewIndex < GetInstanceCullerViewCount(); viewIndex++)
376+
{
377+
var viewStats = GetInstanceCullerViewStats(viewIndex);
378+
if (viewStats.viewType == BatchCullingViewType.Light)
379+
totalGRDInstances += viewStats.visibleInstancesOnGPU;
380+
}
381+
return totalGRDInstances;
382+
}
383+
},
384+
new DebugUI.Value { refreshRate = k_RefreshRate, formatString = k_FormatString, getter = () =>
385+
{
386+
int totalGRDInstances = 0;
387+
388+
for (int viewIndex = 0; viewIndex < GetInstanceCullerViewCount(); viewIndex++)
389+
{
390+
var viewStats = GetInstanceCullerViewStats(viewIndex);
391+
if (viewStats.viewType != BatchCullingViewType.Filtering
392+
&& viewStats.viewType != BatchCullingViewType.Picking
393+
&& viewStats.viewType != BatchCullingViewType.SelectionOutline)
394+
totalGRDInstances += viewStats.visibleInstancesOnGPU;
395+
}
396+
return totalGRDInstances;
397+
}
398+
},
399+
}
400+
});
401+
402+
instanceCullerStats.children.Add(new DebugUI.ValueTuple()
403+
{
404+
displayName = "Total Visible Primitives (Cameras | Lights | Both)",
405+
values = new[]
406+
{
407+
new DebugUI.Value { refreshRate = k_RefreshRate, formatString = k_FormatString, getter = () =>
408+
{
409+
int totalGRDPrimitives = 0;
410+
411+
for (int viewIndex = 0; viewIndex < GetInstanceCullerViewCount(); viewIndex++)
412+
{
413+
var viewStats = GetInstanceCullerViewStats(viewIndex);
414+
if (viewStats.viewType == BatchCullingViewType.Camera)
415+
totalGRDPrimitives += viewStats.visiblePrimitivesOnGPU;
416+
}
417+
return totalGRDPrimitives;
418+
}
419+
},
420+
new DebugUI.Value { refreshRate = k_RefreshRate, formatString = k_FormatString, getter = () =>
421+
{
422+
int totalGRDPrimitives = 0;
423+
424+
for (int viewIndex = 0; viewIndex < GetInstanceCullerViewCount(); viewIndex++)
425+
{
426+
var viewStats = GetInstanceCullerViewStats(viewIndex);
427+
if (viewStats.viewType == BatchCullingViewType.Light)
428+
totalGRDPrimitives += viewStats.visiblePrimitivesOnGPU;
429+
}
430+
return totalGRDPrimitives;
431+
}
432+
},
433+
new DebugUI.Value { refreshRate = k_RefreshRate, formatString = k_FormatString, getter = () =>
434+
{
435+
int totalGRDPrimitives = 0;
436+
437+
for (int viewIndex = 0; viewIndex < GetInstanceCullerViewCount(); viewIndex++)
438+
{
439+
var viewStats = GetInstanceCullerViewStats(viewIndex);
440+
if (viewStats.viewType != BatchCullingViewType.Filtering
441+
&& viewStats.viewType != BatchCullingViewType.Picking
442+
&& viewStats.viewType != BatchCullingViewType.SelectionOutline)
443+
totalGRDPrimitives += viewStats.visiblePrimitivesOnGPU;
444+
}
445+
return totalGRDPrimitives;
446+
}
447+
},
448+
}
449+
});
450+
301451
DebugUI.Table viewTable = new DebugUI.Table
302452
{
303453
displayName = "",

0 commit comments

Comments
 (0)