Skip to content

Commit 08bfd9a

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 08bfd9a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

profiler/src/profiler/TracyView_GpuTimeline.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,10 @@ int View::DrawGpuZoneLevel( const V& vec, bool hover, double pxns, int64_t nspx,
159159
const auto start = AdjustGpuTime( ev.GpuStart(), begin, drift );
160160
end = AdjustGpuTime( end, begin, drift );
161161
const auto zsz = std::max( ( end - start ) * pxns, pxns * 0.5 );
162+
const auto zoneThread = thread != 0 ? thread : m_worker.DecompressThread( ev.Thread() );
162163
if( zsz < MinVisSize )
163164
{
164-
const auto color = GetZoneColor( { &ev.event, ctx }, thread, depth );
165+
const auto color = GetZoneColor( { &ev.event, ctx }, zoneThread, depth );
165166
const auto MinVisNs = MinVisSize * nspx;
166167
int num = 0;
167168
const auto px0 = ( start - m_vd.zvStart ) * pxns;
@@ -202,7 +203,6 @@ int View::DrawGpuZoneLevel( const V& vec, bool hover, double pxns, int64_t nspx,
202203
}
203204
else
204205
{
205-
const auto zoneThread = thread != 0 ? thread : m_worker.DecompressThread( ev.Thread() );
206206
ZoneTooltipGPU( { &ev.event, ctx } );
207207

208208
if( IsMouseClicked( 2 ) && rend - start > 0 )
@@ -242,7 +242,7 @@ int View::DrawGpuZoneLevel( const V& vec, bool hover, double pxns, int64_t nspx,
242242
const auto pr1 = ( end - m_vd.zvStart ) * pxns;
243243
const auto px0 = std::max( pr0, -10.0 );
244244
const auto px1 = std::max( { std::min( pr1, double( w + 10 ) ), px0 + pxns * 0.5, px0 + MinVisSize } );
245-
const auto zoneColor = GetZoneColorData( { &ev.event, ctx }, thread, depth, 0 );
245+
const auto zoneColor = GetZoneColorData( { &ev.event, ctx }, zoneThread, depth, 0 );
246246
draw->AddRectFilled( wpos + ImVec2( px0, offset ), wpos + ImVec2( px1, offset + tsz.y ), zoneColor.color );
247247
if( zoneColor.highlight )
248248
{
@@ -288,7 +288,6 @@ int View::DrawGpuZoneLevel( const V& vec, bool hover, double pxns, int64_t nspx,
288288

289289
if( hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( px0, offset ), wpos + ImVec2( px1, offset + tsz.y + 1 ) ) )
290290
{
291-
const auto zoneThread = thread != 0 ? thread : m_worker.DecompressThread( ev.thread );
292291
ZoneTooltipGPU( { &ev.event, ctx } );
293292

294293
if( !m_zoomAnim.active && IsMouseClicked( 2 ) )

0 commit comments

Comments
 (0)