From 02db5f52d1425f357fd9f94b6a25be1adfd70d22 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Mon, 18 Mar 2019 18:40:03 +0100 Subject: [PATCH] Pass nspx to zone drawing functions. --- server/TracyView.cpp | 33 ++++++++++++++++----------------- server/TracyView.hpp | 12 ++++++------ 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 55ec0c87..e500ee6d 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -1891,7 +1891,7 @@ void View::DrawZones() { const auto begin = v->timeline.front()->gpuStart; const auto drift = GpuDrift( v ); - depth = DispatchGpuZoneLevel( v->timeline, hover, pxns, wpos, offset, 0, v->thread, yMin, yMax, begin, drift ); + depth = DispatchGpuZoneLevel( v->timeline, hover, pxns, int64_t( nspx ), wpos, offset, 0, v->thread, yMin, yMax, begin, drift ); offset += ostep * depth; } offset += ostep * 0.2f; @@ -2004,7 +2004,7 @@ void View::DrawZones() m_lastCpu = -1; if( m_drawZones ) { - depth = DispatchZoneLevel( v->timeline, hover, pxns, wpos, offset, 0, yMin, yMax ); + depth = DispatchZoneLevel( v->timeline, hover, pxns, int64_t( nspx ), wpos, offset, 0, yMin, yMax ); offset += ostep * depth; } @@ -2294,7 +2294,7 @@ void View::DrawZones() } } -int View::DispatchZoneLevel( const Vector& vec, bool hover, double pxns, const ImVec2& wpos, int _offset, int depth, float yMin, float yMax ) +int View::DispatchZoneLevel( const Vector& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int _offset, int depth, float yMin, float yMax ) { const auto ty = ImGui::GetFontSize(); const auto ostep = ty + 1; @@ -2303,15 +2303,15 @@ int View::DispatchZoneLevel( const Vector& vec, bool hover, double p const auto yPos = wpos.y + offset; if( yPos + ostep >= yMin && yPos <= yMax ) { - return DrawZoneLevel( vec, hover, pxns, wpos, _offset, depth, yMin, yMax ); + return DrawZoneLevel( vec, hover, pxns, nspx, wpos, _offset, depth, yMin, yMax ); } else { - return SkipZoneLevel( vec, hover, pxns, wpos, _offset, depth, yMin, yMax ); + return SkipZoneLevel( vec, hover, pxns, nspx, wpos, _offset, depth, yMin, yMax ); } } -int View::DrawZoneLevel( const Vector& vec, bool hover, double pxns, const ImVec2& wpos, int _offset, int depth, float yMin, float yMax ) +int View::DrawZoneLevel( const Vector& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int _offset, int depth, float yMin, float yMax ) { const auto delay = m_worker.GetDelay(); const auto resolution = m_worker.GetResolution(); @@ -2330,7 +2330,6 @@ int View::DrawZoneLevel( const Vector& vec, bool hover, double pxns, auto draw = ImGui::GetWindowDrawList(); const auto dsz = delay * pxns; const auto rsz = resolution * pxns; - const auto nspx = int64_t( 1.0 / pxns ); depth++; int maxdepth = depth; @@ -2419,7 +2418,7 @@ int View::DrawZoneLevel( const Vector& vec, bool hover, double pxns, if( ev.child >= 0 ) { - const auto d = DispatchZoneLevel( m_worker.GetZoneChildren( ev.child ), hover, pxns, wpos, _offset, depth, yMin, yMax ); + const auto d = DispatchZoneLevel( m_worker.GetZoneChildren( ev.child ), hover, pxns, nspx, wpos, _offset, depth, yMin, yMax ); if( d > maxdepth ) maxdepth = d; } @@ -2504,7 +2503,7 @@ int View::DrawZoneLevel( const Vector& vec, bool hover, double pxns, return maxdepth; } -int View::SkipZoneLevel( const Vector& vec, bool hover, double pxns, const ImVec2& wpos, int _offset, int depth, float yMin, float yMax ) +int View::SkipZoneLevel( const Vector& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int _offset, int depth, float yMin, float yMax ) { const auto delay = m_worker.GetDelay(); const auto resolution = m_worker.GetResolution(); @@ -2542,7 +2541,7 @@ int View::SkipZoneLevel( const Vector& vec, bool hover, double pxns, if( ev.child >= 0 ) { - const auto d = DispatchZoneLevel( m_worker.GetZoneChildren( ev.child ), hover, pxns, wpos, _offset, depth, yMin, yMax ); + const auto d = DispatchZoneLevel( m_worker.GetZoneChildren( ev.child ), hover, pxns, nspx, wpos, _offset, depth, yMin, yMax ); if( d > maxdepth ) maxdepth = d; } @@ -2557,7 +2556,7 @@ int View::SkipZoneLevel( const Vector& vec, bool hover, double pxns, return maxdepth; } -int View::DispatchGpuZoneLevel( const Vector& vec, bool hover, double pxns, const ImVec2& wpos, int _offset, int depth, uint64_t thread, float yMin, float yMax, int64_t begin, int drift ) +int View::DispatchGpuZoneLevel( const Vector& 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 ) { const auto ty = ImGui::GetFontSize(); const auto ostep = ty + 1; @@ -2566,11 +2565,11 @@ int View::DispatchGpuZoneLevel( const Vector& vec, bool hover, double const auto yPos = wpos.y + offset; if( yPos + ostep >= yMin && yPos <= yMax ) { - return DrawGpuZoneLevel( vec, hover, pxns, wpos, _offset, depth, thread, yMin, yMax, begin, drift ); + return DrawGpuZoneLevel( vec, hover, pxns, nspx, wpos, _offset, depth, thread, yMin, yMax, begin, drift ); } else { - return SkipGpuZoneLevel( vec, hover, pxns, wpos, _offset, depth, thread, yMin, yMax, begin, drift ); + return SkipGpuZoneLevel( vec, hover, pxns, nspx, wpos, _offset, depth, thread, yMin, yMax, begin, drift ); } } @@ -2580,7 +2579,7 @@ static int64_t AdjustGpuTime( int64_t time, int64_t begin, int drift ) return time + t / 1000000000 * drift; } -int View::DrawGpuZoneLevel( const Vector& vec, bool hover, double pxns, const ImVec2& wpos, int _offset, int depth, uint64_t thread, float yMin, float yMax, int64_t begin, int drift ) +int View::DrawGpuZoneLevel( const Vector& 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 ) { const auto delay = m_worker.GetDelay(); const auto resolution = m_worker.GetResolution(); @@ -2676,7 +2675,7 @@ int View::DrawGpuZoneLevel( const Vector& vec, bool hover, double pxn { if( ev.child >= 0 ) { - const auto d = DispatchGpuZoneLevel( m_worker.GetGpuChildren( ev.child ), hover, pxns, wpos, _offset, depth, thread, yMin, yMax, begin, drift ); + const auto d = DispatchGpuZoneLevel( m_worker.GetGpuChildren( ev.child ), hover, pxns, nspx, wpos, _offset, depth, thread, yMin, yMax, begin, drift ); if( d > maxdepth ) maxdepth = d; } @@ -2753,7 +2752,7 @@ int View::DrawGpuZoneLevel( const Vector& vec, bool hover, double pxn return maxdepth; } -int View::SkipGpuZoneLevel( const Vector& vec, bool hover, double pxns, const ImVec2& wpos, int _offset, int depth, uint64_t thread, float yMin, float yMax, int64_t begin, int drift ) +int View::SkipGpuZoneLevel( const Vector& 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 ) { const auto delay = m_worker.GetDelay(); const auto resolution = m_worker.GetResolution(); @@ -2792,7 +2791,7 @@ int View::SkipGpuZoneLevel( const Vector& vec, bool hover, double pxn { if( ev.child >= 0 ) { - const auto d = DispatchGpuZoneLevel( m_worker.GetGpuChildren( ev.child ), hover, pxns, wpos, _offset, depth, thread, yMin, yMax, begin, drift ); + const auto d = DispatchGpuZoneLevel( m_worker.GetGpuChildren( ev.child ), hover, pxns, nspx, wpos, _offset, depth, thread, yMin, yMax, begin, drift ); if( d > maxdepth ) maxdepth = d; } ++it; diff --git a/server/TracyView.hpp b/server/TracyView.hpp index e7d51d17..daba5a82 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -105,12 +105,12 @@ private: bool DrawZoneFramesHeader(); bool DrawZoneFrames( const FrameData& frames ); void DrawZones(); - int DispatchZoneLevel( const Vector& vec, bool hover, double pxns, const ImVec2& wpos, int offset, int depth, float yMin, float yMax ); - int DrawZoneLevel( const Vector& vec, bool hover, double pxns, const ImVec2& wpos, int offset, int depth, float yMin, float yMax ); - int SkipZoneLevel( const Vector& vec, bool hover, double pxns, const ImVec2& wpos, int offset, int depth, float yMin, float yMax ); - int DispatchGpuZoneLevel( const Vector& vec, bool hover, double pxns, const ImVec2& wpos, int offset, int depth, uint64_t thread, float yMin, float yMax, int64_t begin, int drift ); - int DrawGpuZoneLevel( const Vector& vec, bool hover, double pxns, const ImVec2& wpos, int offset, int depth, uint64_t thread, float yMin, float yMax, int64_t begin, int drift ); - int SkipGpuZoneLevel( const Vector& vec, bool hover, double pxns, const ImVec2& wpos, int offset, int depth, uint64_t thread, float yMin, float yMax, int64_t begin, int drift ); + int DispatchZoneLevel( const Vector& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int offset, int depth, float yMin, float yMax ); + int DrawZoneLevel( const Vector& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int offset, int depth, float yMin, float yMax ); + int SkipZoneLevel( const Vector& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int offset, int depth, float yMin, float yMax ); + int DispatchGpuZoneLevel( const Vector& 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 ); + int DrawGpuZoneLevel( const Vector& 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 ); + int SkipGpuZoneLevel( const Vector& 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 ); void DrawLockHeader( uint32_t id, const LockMap& lockmap, const SourceLocation& srcloc, bool hover, ImDrawList* draw, const ImVec2& wpos, float w, float ty, float offset, uint8_t tid ); int DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos, int offset, LockHighlight& highlight, float yMin, float yMax ); int DrawPlots( int offset, double pxns, const ImVec2& wpos, bool hover, float yMin, float yMax );