From 995caa2636a9f06845178e1f61c15f25b9507928 Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 4 Oct 2018 13:56:21 +0100 Subject: [PATCH] Implement empty-marker hiding options for event browser --- qrenderdoc/Windows/EventBrowser.cpp | 54 +++++++++++++++++++++++++++++ qrenderdoc/Windows/EventBrowser.h | 1 + 2 files changed, 55 insertions(+) diff --git a/qrenderdoc/Windows/EventBrowser.cpp b/qrenderdoc/Windows/EventBrowser.cpp index 7ff93c91f..65466d8d6 100644 --- a/qrenderdoc/Windows/EventBrowser.cpp +++ b/qrenderdoc/Windows/EventBrowser.cpp @@ -276,6 +276,57 @@ void EventBrowser::OnEventChanged(uint32_t eventId) highlightBookmarks(); } +bool EventBrowser::ShouldHide(const DrawcallDescription &drawcall) +{ + if(drawcall.flags & DrawFlags::PushMarker) + { + if(m_Ctx.Config().EventBrowser_HideEmpty) + { + if(drawcall.children.isEmpty()) + return true; + + bool allhidden = true; + + for(const DrawcallDescription &child : drawcall.children) + { + if(ShouldHide(child)) + continue; + + allhidden = false; + break; + } + + if(allhidden) + return true; + } + + if(m_Ctx.Config().EventBrowser_HideAPICalls) + { + if(drawcall.children.isEmpty()) + return false; + + bool onlyapi = true; + + for(const DrawcallDescription &child : drawcall.children) + { + if(ShouldHide(child)) + continue; + + if(!(child.flags & DrawFlags::APICalls)) + { + onlyapi = false; + break; + } + } + + if(onlyapi) + return true; + } + } + + return false; +} + QPair EventBrowser::AddDrawcalls(RDTreeWidgetItem *parent, const rdcarray &draws) { @@ -285,6 +336,9 @@ QPair EventBrowser::AddDrawcalls(RDTreeWidgetItem *parent, { const DrawcallDescription &d = draws[i]; + if(ShouldHide(d)) + continue; + QVariant name = QString(d.name); RichResourceTextInitialise(name); diff --git a/qrenderdoc/Windows/EventBrowser.h b/qrenderdoc/Windows/EventBrowser.h index 180e5dba1..7928974fa 100644 --- a/qrenderdoc/Windows/EventBrowser.h +++ b/qrenderdoc/Windows/EventBrowser.h @@ -95,6 +95,7 @@ public slots: void jumpToBookmark(int idx); private: + bool ShouldHide(const DrawcallDescription &drawcall); QPair AddDrawcalls(RDTreeWidgetItem *parent, const rdcarray &draws); void SetDrawcallTimes(RDTreeWidgetItem *node, const rdcarray &results);