diff --git a/server/TracyEvent.hpp b/server/TracyEvent.hpp index cfc6edf3..31096c22 100644 --- a/server/TracyEvent.hpp +++ b/server/TracyEvent.hpp @@ -39,6 +39,18 @@ struct StringRef uint8_t active : 1; }; +struct StringIdx +{ + StringIdx() : active( 0 ) {} + StringIdx( uint32_t idx ) + : idx( idx ) + , active( 1 ) + {} + + uint32_t idx : 31; + uint32_t active : 1; +}; + struct SourceLocation { StringRef name; @@ -59,7 +71,7 @@ struct ZoneEvent int8_t cpu_start; int8_t cpu_end; - StringRef text; + StringIdx text; Vector child; }; diff --git a/server/TracyView.cpp b/server/TracyView.cpp index f2499972..f3f7ef6a 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -686,7 +686,7 @@ void View::ProcessZoneText( const QueueZoneText& ev ) auto it = m_pendingCustomStrings.find( ev.text ); assert( it != m_pendingCustomStrings.end() ); m_lock.lock(); - zone->text = StringRef( StringRef::Idx, it->second.idx ); + zone->text = StringIdx( it->second.idx ); m_lock.unlock(); m_pendingCustomStrings.erase( it ); } @@ -1403,6 +1403,12 @@ const char* View::GetString( const StringRef& ref ) const } } +const char* View::GetString( const StringIdx& idx ) const +{ + assert( idx.active ); + return m_stringData[idx.idx]; +} + const char* View::GetThreadString( uint64_t id ) const { const auto it = m_threadNames.find( id ); diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 30f73836..9462157a 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -109,6 +109,7 @@ private: int64_t GetZoneEnd( const GpuEvent& ev ) const; const char* GetString( uint64_t ptr ) const; const char* GetString( const StringRef& ref ) const; + const char* GetString( const StringIdx& idx ) const; const char* GetThreadString( uint64_t id ) const; const SourceLocation& GetSourceLocation( int32_t srcloc ) const;