From 89b1ff233746c8404f2443e54bfd8e3fbf183d70 Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 5 Jan 2017 11:38:00 +0000 Subject: [PATCH] Export drawcall times with proper summation over regions. Refs #468 --- renderdocui/Windows/EventBrowser.cs | 33 ++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/renderdocui/Windows/EventBrowser.cs b/renderdocui/Windows/EventBrowser.cs index 1b365a16f..938fe35d8 100644 --- a/renderdocui/Windows/EventBrowser.cs +++ b/renderdocui/Windows/EventBrowser.cs @@ -1234,6 +1234,29 @@ namespace renderdocui.Windows GetMaxNameLength(ref maxNameLength, indent + 1, i == 0, drawcall.children[i]); } + private double GetDrawTime(FetchDrawcall drawcall) + { + if (drawcall.children.Length > 0) + { + double total = 0.0; + + foreach (FetchDrawcall c in drawcall.children) + { + double f = GetDrawTime(c); + if(f >= 0) + total += f; + } + + return total; + } + else if (m_Times.ContainsKey(drawcall.eventID)) + { + return m_Times[drawcall.eventID][0].value.d; + } + + return -1.0; + } + private void ExportDrawcall(StreamWriter sw, int maxNameLength, int indent, bool firstchild, FetchDrawcall drawcall) { string eidString = drawcall.children.Length > 0 ? "" : drawcall.eventID.ToString(); @@ -1247,10 +1270,10 @@ namespace renderdocui.Windows if (m_Core.Config.EventBrowser_TimeUnit != m_TimeUnit) UpdateDurationColumn(); - if(m_Times.ContainsKey(drawcall.eventID)) - { - double f = m_Times[drawcall.eventID][0].value.d; + double f = GetDrawTime(drawcall); + if (f >= 0) + { if (m_Core.Config.EventBrowser_TimeUnit == PersistantConfig.TimeUnit.Milliseconds) f *= 1000.0; else if (m_Core.Config.EventBrowser_TimeUnit == PersistantConfig.TimeUnit.Microseconds) @@ -1260,6 +1283,10 @@ namespace renderdocui.Windows line += String.Format(" | {0}", Formatter.Format(f)); } + else + { + line += " |"; + } } sw.WriteLine(line);