From b7af9a0860ad0cbb97f8a5bf735c6953205636ee Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 26 Jul 2020 13:23:44 +0200 Subject: [PATCH] Reduce frame images frame index to 32 bit. --- client/TracyProfiler.hpp | 5 +++-- common/TracyProtocol.hpp | 2 +- common/TracyQueue.hpp | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/client/TracyProfiler.hpp b/client/TracyProfiler.hpp index 3f6ea631..d617cea9 100644 --- a/client/TracyProfiler.hpp +++ b/client/TracyProfiler.hpp @@ -112,7 +112,7 @@ class Profiler struct FrameImageQueueItem { void* image; - uint64_t frame; + uint32_t frame; uint16_t w; uint16_t h; uint8_t offset; @@ -205,6 +205,7 @@ public: static tracy_force_inline void SendFrameImage( const void* image, uint16_t w, uint16_t h, uint8_t offset, bool flip ) { auto& profiler = GetProfiler(); + assert( profiler.m_frameCount.load( std::memory_order_relaxed ) < std::numeric_limits::max() ); #ifdef TRACY_ON_DEMAND if( !profiler.IsConnected() ) return; #endif @@ -215,7 +216,7 @@ public: profiler.m_fiLock.lock(); auto fi = profiler.m_fiQueue.prepare_next(); fi->image = ptr; - fi->frame = profiler.m_frameCount.load( std::memory_order_relaxed ) - offset; + fi->frame = uint32_t( profiler.m_frameCount.load( std::memory_order_relaxed ) - offset ); fi->w = w; fi->h = h; fi->flip = flip; diff --git a/common/TracyProtocol.hpp b/common/TracyProtocol.hpp index 82794fdb..8b5cdbf8 100644 --- a/common/TracyProtocol.hpp +++ b/common/TracyProtocol.hpp @@ -9,7 +9,7 @@ namespace tracy constexpr unsigned Lz4CompressBound( unsigned isize ) { return isize + ( isize / 255 ) + 16; } -enum : uint32_t { ProtocolVersion = 38 }; +enum : uint32_t { ProtocolVersion = 39 }; enum : uint32_t { BroadcastVersion = 1 }; using lz4sz_t = uint32_t; diff --git a/common/TracyQueue.hpp b/common/TracyQueue.hpp index 187d4351..3ef95fa9 100644 --- a/common/TracyQueue.hpp +++ b/common/TracyQueue.hpp @@ -144,7 +144,7 @@ struct QueueFrameMark struct QueueFrameImageLean { - uint64_t frame; + uint32_t frame; uint16_t w; uint16_t h; uint8_t flip;