From c64406b18f68b688535f6c064dbffebe451efcc0 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 8 Aug 2022 10:18:04 +0100 Subject: [PATCH] Accumulate timings for fake markers last. Closes #2679 * Fake markers have higher EIDs than their children, unlike normal markers. --- qrenderdoc/Windows/EventBrowser.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/qrenderdoc/Windows/EventBrowser.cpp b/qrenderdoc/Windows/EventBrowser.cpp index c554987cf..be2ea4346 100644 --- a/qrenderdoc/Windows/EventBrowser.cpp +++ b/qrenderdoc/Windows/EventBrowser.cpp @@ -309,8 +309,19 @@ struct EventItemModel : public QAbstractItemModel // iterate nodes in reverse order, because parent nodes will always be before children // so we know we'll have the results QList nodeEIDs = m_Nodes.keys(); + // calculate fake marker durations last, as they have higher eventIds even as parents so are + // out of order. Normal markers do not have this problem + QList fakeMarkers; for(auto it = nodeEIDs.rbegin(); it != nodeEIDs.rend(); it++) - CalculateTotalDuration(m_Nodes[*it]); + { + if(m_Nodes[*it].action && m_Nodes[*it].action->IsFakeMarker()) + fakeMarkers.push_back(*it); + else + CalculateTotalDuration(m_Nodes[*it]); + } + + for(uint32_t markerEID : fakeMarkers) + CalculateTotalDuration(m_Nodes[markerEID]); // Qt's item model kind of sucks and doesn't have a good way to say "all data in this column has // changed" let alone "all data has changed". dataChanged() is limited to only a group of model