mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-30 01:04:36 +00:00
Retrieval of GPU context from GPU zone.
This commit is contained in:
parent
4a467b6d03
commit
0b9559c05b
@ -5941,6 +5941,25 @@ uint64_t View::GetZoneThread( const GpuEvent& zone ) const
|
||||
}
|
||||
}
|
||||
|
||||
const GpuCtxData* View::GetZoneCtx( const GpuEvent& zone ) const
|
||||
{
|
||||
for( const auto& ctx : m_worker.GetGpuData() )
|
||||
{
|
||||
const Vector<GpuEvent*>* 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 >= 0 && (*it)->gpuStart > zone.gpuEnd ) break;
|
||||
if( *it == &zone ) return ctx;
|
||||
if( (*it)->child.empty() ) break;
|
||||
timeline = &(*it)->child;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const ZoneEvent* View::FindZoneAtTime( uint64_t thread, int64_t time ) const
|
||||
{
|
||||
// TODO add thread rev-map
|
||||
|
@ -118,6 +118,7 @@ private:
|
||||
const GpuEvent* GetZoneParent( const GpuEvent& zone ) const;
|
||||
uint64_t GetZoneThread( const ZoneEvent& zone ) const;
|
||||
uint64_t GetZoneThread( const GpuEvent& zone ) const;
|
||||
const GpuCtxData* GetZoneCtx( const GpuEvent& zone ) const;
|
||||
const ZoneEvent* FindZoneAtTime( uint64_t thread, int64_t time ) const;
|
||||
|
||||
#ifndef TRACY_NO_STATISTICS
|
||||
|
Loading…
Reference in New Issue
Block a user