From f9449bc938caf7dbeec544f2c42dcd682903e7ad Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 4 Mar 2023 00:32:15 +0100 Subject: [PATCH] Only retrieve frame offset internally in GetFrameNumber(). --- server/TracyView.hpp | 2 +- server/TracyView_FrameOverview.cpp | 2 +- server/TracyView_Playback.cpp | 2 +- server/TracyView_Utility.cpp | 5 +++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 13fb89f2..5eb94374 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -316,7 +316,7 @@ private: const GpuCtxData* GetZoneCtx( const GpuEvent& zone ) const; bool FindMatchingZone( int prev0, int prev1, int flags ); const ZoneEvent* FindZoneAtTime( uint64_t thread, int64_t time ) const; - uint64_t GetFrameNumber( const FrameData& fd, int i, uint64_t offset ) const; + uint64_t GetFrameNumber( const FrameData& fd, int i ) const; const char* GetFrameText( const FrameData& fd, int i, uint64_t ftime ) const; const char* GetFrameSetName( const FrameData& fd ) const; static const char* GetFrameSetName( const FrameData& fd, const Worker& worker ); diff --git a/server/TracyView_FrameOverview.cpp b/server/TracyView_FrameOverview.cpp index a0ae69a9..91c24e3f 100644 --- a/server/TracyView_FrameOverview.cpp +++ b/server/TracyView_FrameOverview.cpp @@ -141,7 +141,7 @@ void View::DrawFrames() } else { - const auto fnum = GetFrameNumber( *m_frames, sel, m_worker.GetFrameOffset() ); + const auto fnum = GetFrameNumber( *m_frames, sel ); m_frameHover = sel; if( m_frames->name == 0 ) { diff --git a/server/TracyView_Playback.cpp b/server/TracyView_Playback.cpp index eb92f96b..cc0af5d9 100644 --- a/server/TracyView_Playback.cpp +++ b/server/TracyView_Playback.cpp @@ -194,7 +194,7 @@ void View::DrawPlayback() ImGui::SameLine(); ImGui::Spacing(); ImGui::SameLine(); - TextFocused( "Frame:", RealToString( GetFrameNumber( *frameSet, fi->frameRef, m_worker.GetFrameOffset() ) ) ); + TextFocused( "Frame:", RealToString( GetFrameNumber( *frameSet, fi->frameRef ) ) ); ImGui::SameLine(); ImGui::Spacing(); ImGui::SameLine(); diff --git a/server/TracyView_Utility.cpp b/server/TracyView_Utility.cpp index a7e5839c..61b8751a 100644 --- a/server/TracyView_Utility.cpp +++ b/server/TracyView_Utility.cpp @@ -749,10 +749,11 @@ int64_t View::AdjustGpuTime( int64_t time, int64_t begin, int drift ) return time + t / 1000000000 * drift; } -uint64_t View::GetFrameNumber( const FrameData& fd, int i, uint64_t offset ) const +uint64_t View::GetFrameNumber( const FrameData& fd, int i ) const { if( fd.name == 0 ) { + const auto offset = m_worker.GetFrameOffset(); if( offset == 0 ) { return i; @@ -770,7 +771,7 @@ uint64_t View::GetFrameNumber( const FrameData& fd, int i, uint64_t offset ) con const char* View::GetFrameText( const FrameData& fd, int i, uint64_t ftime ) const { - const auto fnum = GetFrameNumber( fd, i, m_worker.GetFrameOffset() ); + const auto fnum = GetFrameNumber( fd, i ); static char buf[1024]; if( fd.name == 0 ) {