diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 94ad7ea1..95572a92 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -3542,6 +3542,25 @@ uint64_t View::GetZoneThread( const ZoneEvent& zone ) const return 0; } +uint64_t View::GetZoneThread( const GpuEvent& zone ) const +{ + for( const auto& ctx : m_worker.GetGpuData() ) + { + const Vector* timeline = &ctx->timeline; + if( timeline->empty() ) continue; + for(;;) + { + auto it = std::upper_bound( timeline->begin(), timeline->end(), zone.gpuStart, [] ( const auto& l, const auto& r ) { return l < r->gpuStart; } ); + if( it != timeline->begin() ) --it; + if( zone.gpuEnd != -1 && (*it)->gpuStart > zone.gpuEnd ) break; + if( *it == &zone ) return ctx->thread; + if( (*it)->child.empty() ) break; + timeline = &(*it)->child; + } + } + return 0; +} + #ifndef TRACY_NO_STATISTICS void View::FindZones() { diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 88fef3ac..fab1f34d 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -97,6 +97,7 @@ private: const ZoneEvent* GetZoneParent( const ZoneEvent& zone ) const; const GpuEvent* GetZoneParent( const GpuEvent& zone ) const; uint64_t GetZoneThread( const ZoneEvent& zone ) const; + uint64_t GetZoneThread( const GpuEvent& zone ) const; #ifndef TRACY_NO_STATISTICS void FindZones();