From 5d4ba366baec14d06f5d9069dd4b92a01c16f8be Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 17 May 2026 17:58:22 +0200 Subject: [PATCH] DrawSourceTooltip reports if source was printed. --- profiler/src/profiler/TracyView.cpp | 9 +++++---- profiler/src/profiler/TracyView.hpp | 2 +- profiler/src/profiler/TracyView_Samples.cpp | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/profiler/src/profiler/TracyView.cpp b/profiler/src/profiler/TracyView.cpp index 44969ceb..9d3caf51 100644 --- a/profiler/src/profiler/TracyView.cpp +++ b/profiler/src/profiler/TracyView.cpp @@ -1420,12 +1420,12 @@ void View::CrashTooltip() ImGui::EndTooltip(); } -void View::DrawSourceTooltip( const char* filename, uint32_t srcline, int before, int after, bool separateTooltip ) +bool View::DrawSourceTooltip( const char* filename, uint32_t srcline, int before, int after, bool separateTooltip ) { - if( !filename ) return; - if( !SourceFileValid( filename, m_worker.GetCaptureTime(), *this, m_worker ) ) return; + if( !filename ) return false; + if( !SourceFileValid( filename, m_worker.GetCaptureTime(), *this, m_worker ) ) return false; m_srcHintCache.Parse( filename, m_worker, *this ); - if( m_srcHintCache.empty() ) return; + if( m_srcHintCache.empty() ) return false; ImGui::PushStyleVar( ImGuiStyleVar_ItemSpacing, ImVec2( 0, 0 ) ); if( separateTooltip ) ImGui::BeginTooltip(); ImGui::PushFont( g_fonts.mono, FontNormal ); @@ -1478,6 +1478,7 @@ void View::DrawSourceTooltip( const char* filename, uint32_t srcline, int before ImGui::PopFont(); if( separateTooltip ) ImGui::EndTooltip(); ImGui::PopStyleVar(); + return true; } bool View::Save( const char* fn, FileCompression comp, int zlevel, bool buildDict, int streams ) diff --git a/profiler/src/profiler/TracyView.hpp b/profiler/src/profiler/TracyView.hpp index cc4052e4..855d20aa 100644 --- a/profiler/src/profiler/TracyView.hpp +++ b/profiler/src/profiler/TracyView.hpp @@ -181,7 +181,7 @@ public: bool DrawGpu( const TimelineContext& ctx, const GpuCtxData& gpu, int& offset ); bool DrawCpuData( const TimelineContext& ctx, const std::vector& cpuDraw, const std::vector>& ctxDraw, int& offset, bool hasCpuData ); void DrawThreadMigrations( const TimelineContext& ctx, const int origOffset, uint64_t thread ); - void DrawSourceTooltip( const char* filename, uint32_t line, int before = 3, int after = 3, bool separateTooltip = true ); + bool DrawSourceTooltip( const char* filename, uint32_t line, int before = 3, int after = 3, bool separateTooltip = true ); bool IsBackgroundDone() const { return m_worker.IsBackgroundDone(); } diff --git a/profiler/src/profiler/TracyView_Samples.cpp b/profiler/src/profiler/TracyView_Samples.cpp index ec1a8c1f..59f067a9 100644 --- a/profiler/src/profiler/TracyView_Samples.cpp +++ b/profiler/src/profiler/TracyView_Samples.cpp @@ -8,6 +8,7 @@ #include "TracySourceView.hpp" #include "TracyTimelineContext.hpp" #include "TracyTimelineDraw.hpp" +#include "TracyUtility.hpp" #include "TracyView.hpp" #include "tracy_pdqsort.h" #include "../Fonts.hpp"