From a4764141c68ea5be97712bb0101e57f0ca4f20bf Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 15 Jan 2021 21:40:51 +0100 Subject: [PATCH] Support serial callstacks when processing GPU zones. --- server/TracyWorker.cpp | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 59ae01a7..3b45bc0c 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -5276,10 +5276,19 @@ void Worker::ProcessGpuZoneBeginCallstack( const QueueGpuZoneBegin& ev, bool ser { auto zone = m_slab.Alloc(); ProcessGpuZoneBeginImpl( zone, ev, serial ); - auto it = m_nextCallstack.find( m_threadCtx ); - assert( it != m_nextCallstack.end() ); - zone->callstack.SetVal( it->second ); - it->second = 0; + if( serial ) + { + assert( m_serialNextCallstack != 0 ); + zone->callstack.SetVal( m_serialNextCallstack ); + m_serialNextCallstack = 0; + } + else + { + auto it = m_nextCallstack.find( m_threadCtx ); + assert( it != m_nextCallstack.end() ); + zone->callstack.SetVal( it->second ); + it->second = 0; + } } void Worker::ProcessGpuZoneBeginAllocSrcLoc( const QueueGpuZoneBeginLean& ev, bool serial ) @@ -5292,10 +5301,19 @@ void Worker::ProcessGpuZoneBeginAllocSrcLocCallstack( const QueueGpuZoneBeginLea { auto zone = m_slab.Alloc(); ProcessGpuZoneBeginAllocSrcLocImpl( zone, ev, serial ); - auto it = m_nextCallstack.find( m_threadCtx ); - assert( it != m_nextCallstack.end() ); - zone->callstack.SetVal( it->second ); - it->second = 0; + if( serial ) + { + assert( m_serialNextCallstack != 0 ); + zone->callstack.SetVal( m_serialNextCallstack ); + m_serialNextCallstack = 0; + } + else + { + auto it = m_nextCallstack.find( m_threadCtx ); + assert( it != m_nextCallstack.end() ); + zone->callstack.SetVal( it->second ); + it->second = 0; + } } void Worker::ProcessGpuZoneEnd( const QueueGpuZoneEnd& ev, bool serial )