@@ -46,7 +46,7 @@ bool View::DrawGpu( const TimelineContext& ctx, const GpuCtxData& gpu, int& offs
4646 const auto begin = tlm.front ().Start ();
4747 const auto drift = GpuDrift ( &gpu );
4848 if ( !singleThread ) offset += sstep;
49- const auto partDepth = DispatchGpuZoneLevel ( tl, hover, pxns, int64_t ( nspx ), wpos, offset, 0 , gpu. thread , yMin, yMax, begin, drift );
49+ const auto partDepth = DispatchGpuZoneLevel ( tl, hover, pxns, int64_t ( nspx ), wpos, offset, 0 , & gpu, yMin, yMax, begin, drift );
5050 if ( partDepth != 0 )
5151 {
5252 if ( !singleThread )
@@ -73,7 +73,7 @@ bool View::DrawGpu( const TimelineContext& ctx, const GpuCtxData& gpu, int& offs
7373 const auto begin = tl.front ()->Start ();
7474 const auto drift = GpuDrift ( &gpu );
7575 if ( !singleThread ) offset += sstep;
76- const auto partDepth = DispatchGpuZoneLevel ( tl, hover, pxns, int64_t ( nspx ), wpos, offset, 0 , gpu. thread , yMin, yMax, begin, drift );
76+ const auto partDepth = DispatchGpuZoneLevel ( tl, hover, pxns, int64_t ( nspx ), wpos, offset, 0 , & gpu, yMin, yMax, begin, drift );
7777 if ( partDepth != 0 )
7878 {
7979 if ( !singleThread )
@@ -97,7 +97,7 @@ bool View::DrawGpu( const TimelineContext& ctx, const GpuCtxData& gpu, int& offs
9797 return depth != 0 ;
9898}
9999
100- int View::DispatchGpuZoneLevel ( const Vector<short_ptr<ZoneEvent>>& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int _offset, int depth, uint64_t thread , float yMin, float yMax, int64_t begin, int drift )
100+ int View::DispatchGpuZoneLevel ( const Vector<short_ptr<ZoneEvent>>& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int _offset, int depth, const GpuCtxData *ctx , float yMin, float yMax, int64_t begin, int drift )
101101{
102102 const auto ty = ImGui::GetTextLineHeight ();
103103 const auto ostep = ty + 1 ;
@@ -108,28 +108,28 @@ int View::DispatchGpuZoneLevel( const Vector<short_ptr<ZoneEvent>>& vec, bool ho
108108 {
109109 if ( vec.is_magic () )
110110 {
111- return DrawGpuZoneLevel<VectorAdapterDirect<ZoneEvent>>( *(Vector<ZoneEvent>*)&vec, hover, pxns, nspx, wpos, _offset, depth, thread , yMin, yMax, begin, drift );
111+ return DrawGpuZoneLevel<VectorAdapterDirect<ZoneEvent>>( *(Vector<ZoneEvent>*)&vec, hover, pxns, nspx, wpos, _offset, depth, ctx , yMin, yMax, begin, drift );
112112 }
113113 else
114114 {
115- return DrawGpuZoneLevel<VectorAdapterPointer<ZoneEvent>>( vec, hover, pxns, nspx, wpos, _offset, depth, thread , yMin, yMax, begin, drift );
115+ return DrawGpuZoneLevel<VectorAdapterPointer<ZoneEvent>>( vec, hover, pxns, nspx, wpos, _offset, depth, ctx , yMin, yMax, begin, drift );
116116 }
117117 }
118118 else
119119 {
120120 if ( vec.is_magic () )
121121 {
122- return SkipGpuZoneLevel<VectorAdapterDirect<ZoneEvent>>( *(Vector<ZoneEvent>*)&vec, hover, pxns, nspx, wpos, _offset, depth, thread , yMin, yMax, begin, drift );
122+ return SkipGpuZoneLevel<VectorAdapterDirect<ZoneEvent>>( *(Vector<ZoneEvent>*)&vec, hover, pxns, nspx, wpos, _offset, depth, ctx , yMin, yMax, begin, drift );
123123 }
124124 else
125125 {
126- return SkipGpuZoneLevel<VectorAdapterPointer<ZoneEvent>>( vec, hover, pxns, nspx, wpos, _offset, depth, thread , yMin, yMax, begin, drift );
126+ return SkipGpuZoneLevel<VectorAdapterPointer<ZoneEvent>>( vec, hover, pxns, nspx, wpos, _offset, depth, ctx , yMin, yMax, begin, drift );
127127 }
128128 }
129129}
130130
131131template <typename Adapter, typename V>
132- int View::DrawGpuZoneLevel ( const V& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int _offset, int depth, uint64_t thread , float yMin, float yMax, int64_t begin, int drift )
132+ int View::DrawGpuZoneLevel ( const V& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int _offset, int depth, const GpuCtxData* ctx , float yMin, float yMax, int64_t begin, int drift )
133133{
134134 // cast to uint64_t, so that unended zones (end = -1) are still drawn
135135 auto it = std::lower_bound ( vec.begin (), vec.end (), std::max<int64_t >( 0 , m_vd.zvStart ), [begin, drift] ( const auto & l, const auto & r ) { Adapter a; return (uint64_t )AdjustGpuTime ( a (l).End (), begin, drift ) < (uint64_t )r; } );
@@ -159,6 +159,7 @@ 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 = ctx->thread != 0 ? ctx->thread : m_worker.DecompressThread ( ev.Thread () );
162163 if ( zsz < MinVisSize )
163164 {
164165 const auto color = GetZoneColor ( ev );
@@ -202,16 +203,15 @@ 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 () );
206- ZoneTooltipGPU ( ev );
206+ ZoneTooltipGPU ( { &ev.event , ctx } );
207207
208208 if ( IsMouseClicked ( 2 ) && rend - start > 0 )
209209 {
210- ZoomToZoneGPU ( ev );
210+ ZoomToZoneGPU ( { &ev. event , ctx } );
211211 }
212212 if ( IsMouseClicked ( 0 ) )
213213 {
214- ShowZoneInfo ( ev , zoneThread );
214+ ShowZoneInfo ( { &ev. event , ctx } , zoneThread );
215215 }
216216
217217 m_gpuThread = zoneThread;
@@ -231,7 +231,7 @@ int View::DrawGpuZoneLevel( const V& vec, bool hover, double pxns, int64_t nspx,
231231 {
232232 if ( ev.Child () >= 0 )
233233 {
234- const auto d = DispatchGpuZoneLevel ( m_worker.GetGpuChildren ( ev.Child () ), hover, pxns, nspx, wpos, _offset, depth, thread , yMin, yMax, begin, drift );
234+ const auto d = DispatchGpuZoneLevel ( m_worker.GetGpuChildren ( ev.Child () ), hover, pxns, nspx, wpos, _offset, depth, ctx , yMin, yMax, begin, drift );
235235 if ( d > maxdepth ) maxdepth = d;
236236 }
237237
@@ -288,16 +288,15 @@ 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 );
292- ZoneTooltipGPU ( ev );
291+ ZoneTooltipGPU ( { &ev.event , ctx } );
293292
294293 if ( !m_zoomAnim.active && IsMouseClicked ( 2 ) )
295294 {
296- ZoomToZoneGPU ( ev );
295+ ZoomToZoneGPU ( { &ev. event , ctx } );
297296 }
298297 if ( IsMouseClicked ( 0 ) )
299298 {
300- ShowZoneInfo ( ev , zoneThread );
299+ ShowZoneInfo ( { &ev. event , ctx } , zoneThread );
301300 }
302301
303302 m_gpuThread = zoneThread;
@@ -312,7 +311,7 @@ int View::DrawGpuZoneLevel( const V& vec, bool hover, double pxns, int64_t nspx,
312311}
313312
314313template <typename Adapter, typename V>
315- int View::SkipGpuZoneLevel ( const V& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int _offset, int depth, uint64_t thread , float yMin, float yMax, int64_t begin, int drift )
314+ int View::SkipGpuZoneLevel ( const V& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int _offset, int depth, const GpuCtxData* ctx , float yMin, float yMax, int64_t begin, int drift )
316315{
317316 // cast to uint64_t, so that unended zones (end = -1) are still drawn
318317 auto it = std::lower_bound ( vec.begin (), vec.end (), std::max<int64_t >( 0 , m_vd.zvStart ), [begin, drift] ( const auto & l, const auto & r ) { Adapter a; return (uint64_t )AdjustGpuTime ( a (l).End (), begin, drift ) < (uint64_t )r; } );
@@ -357,7 +356,7 @@ int View::SkipGpuZoneLevel( const V& vec, bool hover, double pxns, int64_t nspx,
357356 {
358357 if ( ev.Child () >= 0 )
359358 {
360- const auto d = DispatchGpuZoneLevel ( m_worker.GetGpuChildren ( ev.Child () ), hover, pxns, nspx, wpos, _offset, depth, thread , yMin, yMax, begin, drift );
359+ const auto d = DispatchGpuZoneLevel ( m_worker.GetGpuChildren ( ev.Child () ), hover, pxns, nspx, wpos, _offset, depth, ctx , yMin, yMax, begin, drift );
361360 if ( d > maxdepth ) maxdepth = d;
362361 }
363362 ++it;
0 commit comments