Skip to content

Commit b923816

Browse files
author
Eric Eaton
committed
Make GPU zones colored according to their thread
There was an issue that the GPU zones were always purple. This patch changes the the color of GPU zones to match the CPU thread making the GPU calls.
1 parent 30759d1 commit b923816

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

profiler/src/profiler/TracyView_GpuTimeline.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,24 @@ bool View::DrawGpu( const TimelineContext& ctx, const GpuCtxData& gpu, int& offs
3838
{
3939
auto& tl = td.second.timeline;
4040
assert( !tl.empty() );
41+
uint64_t thread = gpu.thread;
42+
if( thread == 0 )
43+
{
44+
thread = td.first;
45+
}
4146
if( tl.is_magic() )
4247
{
4348
auto& tlm = *(Vector<ZoneEvent>*)&tl;
4449
if( tlm.front().Start() >= 0 )
4550
{
51+
if( thread == 0 )
52+
{
53+
thread = m_worker.GetGpuExtra( tlm.front() ).Thread();
54+
}
4655
const auto begin = tlm.front().Start();
4756
const auto drift = GpuDrift( &gpu );
4857
if( !singleThread ) offset += sstep;
49-
const auto partDepth = DispatchGpuZoneLevel( tl, hover, pxns, int64_t( nspx ), wpos, offset, 0, gpu.thread, &gpu, yMin, yMax, begin, drift );
58+
const auto partDepth = DispatchGpuZoneLevel( tl, hover, pxns, int64_t( nspx ), wpos, offset, 0, thread, &gpu, yMin, yMax, begin, drift );
5059
if( partDepth != 0 )
5160
{
5261
if( !singleThread )
@@ -70,10 +79,14 @@ bool View::DrawGpu( const TimelineContext& ctx, const GpuCtxData& gpu, int& offs
7079
{
7180
if( tl.front()->Start() >= 0 )
7281
{
82+
if( thread == 0 )
83+
{
84+
thread = m_worker.GetGpuExtra( *tl.front() ).Thread();
85+
}
7386
const auto begin = tl.front()->Start();
7487
const auto drift = GpuDrift( &gpu );
7588
if( !singleThread ) offset += sstep;
76-
const auto partDepth = DispatchGpuZoneLevel( tl, hover, pxns, int64_t( nspx ), wpos, offset, 0, gpu.thread, &gpu, yMin, yMax, begin, drift );
89+
const auto partDepth = DispatchGpuZoneLevel( tl, hover, pxns, int64_t( nspx ), wpos, offset, 0, thread, &gpu, yMin, yMax, begin, drift );
7790
if( partDepth != 0 )
7891
{
7992
if( !singleThread )

0 commit comments

Comments
 (0)