diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 5ac1fc9a..954d8d5b 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -4330,6 +4330,43 @@ void View::DrawOptions() void View::DrawMessages() { ImGui::Begin( "Messages", &m_showMessages ); + +#ifdef TRACY_EXTENDED_FONT + auto expand = ImGui::TreeNode( ICON_FA_RANDOM " Visible threads:" ); +#else + auto expand = ImGui::TreeNode( "Visible threads:" ); +#endif + ImGui::SameLine(); + ImGui::TextDisabled( "(%zu)", m_worker.GetThreadData().size() ); + if( expand ) + { + if( ImGui::SmallButton( "Select all" ) ) + { + for( const auto& t : m_worker.GetThreadData() ) + { + VisibleMsgThread( t->id ) = true; + } + } + ImGui::SameLine(); + if( ImGui::SmallButton( "Unselect all" ) ) + { + for( const auto& t : m_worker.GetThreadData() ) + { + VisibleMsgThread( t->id ) = false; + } + } + + int idx = 0; + for( const auto& t : m_worker.GetThreadData() ) + { + ImGui::PushID( idx++ ); + ImGui::Checkbox( m_worker.GetThreadString( t->id ), &VisibleMsgThread( t->id ) ); + ImGui::PopID(); + } + ImGui::TreePop(); + } + + ImGui::Separator(); ImGui::Columns( 3 ); ImGui::Text( "Time" ); ImGui::SameLine(); @@ -4349,28 +4386,31 @@ void View::DrawMessages() for( const auto& v : m_worker.GetMessages() ) { - ImGui::PushID( v ); - if( ImGui::Selectable( TimeToString( v->time - m_worker.GetTimeBegin() ), m_msgHighlight == v, ImGuiSelectableFlags_SpanAllColumns ) ) + if( VisibleMsgThread( v->thread ) ) { - CenterAtTime( v->time ); + ImGui::PushID( v ); + if( ImGui::Selectable( TimeToString( v->time - m_worker.GetTimeBegin() ), m_msgHighlight == v, ImGuiSelectableFlags_SpanAllColumns ) ) + { + CenterAtTime( v->time ); + } + if( ImGui::IsItemHovered() ) + { + m_msgHighlight = v; + } + if( m_msgToFocus == v ) + { + ImGui::SetScrollHere(); + m_msgToFocus = nullptr; + } + ImGui::PopID(); + ImGui::NextColumn(); + ImGui::Text( "%s", m_worker.GetThreadString( v->thread ) ); + ImGui::SameLine(); + ImGui::TextDisabled( "(0x%" PRIX64 ")", v->thread ); + ImGui::NextColumn(); + ImGui::TextWrapped( "%s", m_worker.GetString( v->ref ) ); + ImGui::NextColumn(); } - if( ImGui::IsItemHovered() ) - { - m_msgHighlight = v; - } - if( m_msgToFocus == v ) - { - ImGui::SetScrollHere(); - m_msgToFocus = nullptr; - } - ImGui::PopID(); - ImGui::NextColumn(); - ImGui::Text( "%s", m_worker.GetThreadString( v->thread ) ); - ImGui::SameLine(); - ImGui::TextDisabled( "(0x%" PRIX64 ")", v->thread ); - ImGui::NextColumn(); - ImGui::TextWrapped( "%s", m_worker.GetString( v->ref ) ); - ImGui::NextColumn(); } ImGui::EndColumns(); ImGui::End(); diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 33f60c58..45c6175e 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -151,6 +151,7 @@ private: void SmallCallstackButton( const char* name, uint32_t callstack, int& idx ); flat_hash_map> m_visible; + flat_hash_map> m_visibleMsgThread; flat_hash_map> m_showFull; flat_hash_map> m_gpuDrift; @@ -164,6 +165,16 @@ private: return it->second; } + tracy_force_inline bool& VisibleMsgThread( uint64_t thread ) + { + auto it = m_visibleMsgThread.find( thread ); + if( it == m_visibleMsgThread.end() ) + { + it = m_visibleMsgThread.emplace( thread, true ).first; + } + return it->second; + } + tracy_force_inline bool& ShowFull( const void* ptr ) { auto it = m_showFull.find( ptr );