From b2d5d9bc529828c0325104a6a83dfbffbe60dfd7 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 5 Jul 2026 18:53:52 +0200 Subject: [PATCH] Allow limiting playback to section scope. --- profiler/src/profiler/TracyView_Playback.cpp | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/profiler/src/profiler/TracyView_Playback.cpp b/profiler/src/profiler/TracyView_Playback.cpp index 2a2347db..4f8438f6 100644 --- a/profiler/src/profiler/TracyView_Playback.cpp +++ b/profiler/src/profiler/TracyView_Playback.cpp @@ -294,6 +294,30 @@ void View::DrawPlayback() } ImGui::EndMenu(); } + + auto& sections = m_worker.GetSections(); + if( sections.empty() ) + { + TextDisabledUnformatted( "Sections" ); + } + else if( ImGui::BeginMenu( "Sections" ) ) + { + int id = 0; + for( auto& v : sections ) + { + ImGui::PushID( id++ ); + if( ImGui::MenuItem( m_worker.GetString( v.text ) ) ) + { + m_playback.range = GetPlaybackFrameRangeFromTime( v.start.Val(), v.end.Val(), m_playback.requireCoverage ); + limitChanged = true; + } + ImGui::PopID(); + ImGui::SameLine(); + ImGui::TextDisabled( "%s - %s (%s)", TimeToStringExact( v.start.Val() ), TimeToStringExact( v.end.Val() ), TimeToString( v.end.Val() - v.start.Val() ) ); + } + ImGui::EndMenu(); + } + for( auto& r : m_ranges ) { if( r.range->min == 0 && r.range->max == 0 )