Skip to content

Commit a75debb

Browse files
svc-reach-platform-supportEvergreen
authored andcommitted
[Port] [6000.4] [Render Graph Viewer] Gather Debug data and properly update the connection when the player is disconnected.
1 parent 9035030 commit a75debb

2 files changed

Lines changed: 27 additions & 5 deletions

File tree

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@ void SetSelectedExecutionIndex(int executionIndex)
11311131
if (m_SelectedExecutionIndex != executionIndex)
11321132
{
11331133
m_SelectedExecutionIndex = executionIndex;
1134-
UpdateCurrentDebugData();
1134+
UpdateCurrentDebugData(true);
11351135
}
11361136

11371137
// Using a custom toolbar menu instead of default Dropdown in order to get access to allowDuplicateNames,
@@ -2032,7 +2032,7 @@ void UpdateStatusLabel()
20322032

20332033
string connectionStatus = m_IsDeviceConnected ? "Online" : "Offline";
20342034

2035-
bool isEditor = m_ConnectedDeviceName == "Editor";
2035+
bool isEditor = m_ConnectedDeviceName == k_EditorName;
20362036
string sourceLabel = isEditor ? "Source: Editor" : $"Source: {m_ConnectedDeviceName} ({connectionStatus})";
20372037

20382038
bool hasCapture = HasValidDebugData && m_LastDataCaptureTime != DateTime.MinValue;
@@ -2052,7 +2052,8 @@ void UpdateCurrentDebugData(bool force = false)
20522052
{
20532053
m_CurrentDebugData = RenderGraphDebugSession.GetDebugData(m_SelectedRenderGraph, selectedExecutionItem.id);
20542054

2055-
if (HasValidDebugData)
2055+
// Update timestamp when we get valid data, or when forcing an update
2056+
if (HasValidDebugData || force)
20562057
m_LastDataCaptureTime = DateTime.Now;
20572058
}
20582059
else
@@ -2066,6 +2067,8 @@ void UpdateCurrentDebugData(bool force = false)
20662067
currentGraphDropdown.style.display = DisplayStyle.None;
20672068
if (currentExecutionToolbarMenu != null)
20682069
currentExecutionToolbarMenu.style.display = DisplayStyle.None;
2070+
2071+
m_LastDataCaptureTime = DateTime.MinValue;
20692072
}
20702073

20712074
UpdateStatusLabel();
@@ -2170,6 +2173,7 @@ void OnPlayerConnected(int playerID)
21702173
void OnPlayerDisconnected(int playerID)
21712174
{
21722175
m_IsDeviceConnected = false;
2176+
m_ConnectedDeviceName = k_EditorName;
21732177

21742178
if (!m_Paused)
21752179
{

Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Debug/RenderGraphDebugSession.cs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,27 @@ public static void EndSession()
158158
}
159159
}
160160

161-
public static List<string> GetRegisteredGraphs() => s_CurrentDebugSession.debugDataContainer.GetRenderGraphs();
161+
public static List<string> s_EmptyRegisteredGraphs = new();
162+
public static List<string> GetRegisteredGraphs()
163+
{
164+
if (s_CurrentDebugSession == null || s_CurrentDebugSession.debugDataContainer == null)
165+
{
166+
return s_EmptyRegisteredGraphs;
167+
}
168+
169+
return s_CurrentDebugSession.debugDataContainer.GetRenderGraphs();
170+
}
162171

163-
public static List<DebugExecutionItem> GetExecutions(string graphName) => s_CurrentDebugSession.debugDataContainer.GetExecutions(graphName);
172+
public static List<DebugExecutionItem> s_EmptyExecutions = new();
173+
public static List<DebugExecutionItem> GetExecutions(string graphName)
174+
{
175+
if (s_CurrentDebugSession == null || s_CurrentDebugSession.debugDataContainer == null)
176+
{
177+
return s_EmptyExecutions;
178+
}
179+
180+
return s_CurrentDebugSession.debugDataContainer.GetExecutions(graphName);
181+
}
164182

165183
public static DebugData GetDebugData(string renderGraph, EntityId executionId)
166184
{

0 commit comments

Comments
 (0)