diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/TracyEvent.hpp | 1 | ||||
-rw-r--r-- | server/TracyVersion.hpp | 2 | ||||
-rw-r--r-- | server/TracyView.cpp | 12 | ||||
-rw-r--r-- | server/TracyWorker.cpp | 41 | ||||
-rw-r--r-- | server/TracyWorker.hpp | 3 |
5 files changed, 55 insertions, 4 deletions
diff --git a/server/TracyEvent.hpp b/server/TracyEvent.hpp index baacb409..047ccf8b 100644 --- a/server/TracyEvent.hpp +++ b/server/TracyEvent.hpp @@ -207,6 +207,7 @@ struct ZoneExtra Int24 callstack; StringIdx text; StringIdx name; + Int24 color; }; enum { ZoneExtraSize = sizeof( ZoneExtra ) }; diff --git a/server/TracyVersion.hpp b/server/TracyVersion.hpp index 739a2dfb..4b81c7c8 100644 --- a/server/TracyVersion.hpp +++ b/server/TracyVersion.hpp @@ -7,7 +7,7 @@ namespace Version { enum { Major = 0 }; enum { Minor = 7 }; -enum { Patch = 4 }; +enum { Patch = 5 }; } } diff --git a/server/TracyView.cpp b/server/TracyView.cpp index bce1a8ed..b3a9b5a1 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -16561,8 +16561,16 @@ uint32_t View::GetRawZoneColor( const ZoneEvent& ev, uint64_t thread, int depth { const auto sl = ev.SrcLoc(); const auto& srcloc = m_worker.GetSourceLocation( sl ); - const auto color = srcloc.color; - if( color != 0 && !m_vd.forceColors ) return color | 0xFF000000; + if( !m_vd.forceColors ) + { + if( m_worker.HasZoneExtra( ev ) ) + { + const auto custom_color = m_worker.GetZoneExtra( ev ).color.Val(); + if( custom_color != 0 ) return custom_color | 0xFF000000; + } + const auto color = srcloc.color; + if( color != 0 ) return color | 0xFF000000; + } switch( m_vd.dynamicColors ) { case 0: diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 5061f3ac..80692de8 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -822,13 +822,25 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks ) f.Skip( sz * ( sizeof( uint64_t ) + sizeof( MessageData::time ) + sizeof( MessageData::ref ) + sizeof( MessageData::color ) + sizeof( MessageData::callstack ) ) ); } - if( fileVer >= FileVersion( 0, 6, 3 ) ) + if( fileVer >= FileVersion( 0, 7, 5 ) ) { f.Read( sz ); assert( sz != 0 ); m_data.zoneExtra.reserve_exact( sz, m_slab ); f.Read( m_data.zoneExtra.data(), sz * sizeof( ZoneExtra ) ); } + else if( fileVer >= FileVersion( 0, 6, 3 ) ) + { + f.Read( sz ); + assert( sz != 0 ); + m_data.zoneExtra.reserve_exact( sz, m_slab ); + for( uint64_t i=0; i<sz; i++ ) + { + auto* zoneExtra = &m_data.zoneExtra[i]; + f.Read3( zoneExtra->callstack, zoneExtra->text, zoneExtra->name ); + zoneExtra->color = 0; + } + } else { m_data.zoneExtra.push_back( ZoneExtra {} ); @@ -4116,6 +4128,9 @@ bool Worker::Process( const QueueItem& ev ) case QueueType::ZoneName: ProcessZoneName(); break; + case QueueType::ZoneColor: + ProcessZoneColor( ev.zoneColor ); + break; case QueueType::ZoneValue: ProcessZoneValue( ev.zoneValue ); break; @@ -4506,6 +4521,12 @@ void Worker::ZoneTextFailure( uint64_t thread ) m_failureData.thread = thread; } +void Worker::ZoneColorFailure( uint64_t thread ) +{ + m_failure = Failure::ZoneColor; + m_failureData.thread = thread; +} + void Worker::ZoneNameFailure( uint64_t thread ) { m_failure = Failure::ZoneName; @@ -4738,6 +4759,23 @@ void Worker::ProcessZoneName() extra.name = StringIdx( GetSingleStringIdx() ); } +void Worker::ProcessZoneColor( const QueueZoneColor& ev ) +{ + auto td = RetrieveThread( m_threadCtx ); + if( !td || td->stack.empty() || td->nextZoneId != td->zoneIdStack.back() ) + { + ZoneColorFailure( m_threadCtx ); + return; + } + + td->nextZoneId = 0; + auto& stack = td->stack; + auto zone = stack.back(); + auto& extra = RequestZoneExtra( *zone ); + const uint32_t color = ( ev.b << 16 ) | ( ev.g << 8 ) | ev.r; + extra.color = color; +} + void Worker::ProcessZoneValue( const QueueZoneValue& ev ) { char tmp[32]; @@ -7221,6 +7259,7 @@ static const char* s_failureReasons[] = { "Invalid order of zone begin and end events.", "Zone is ended twice.", "Zone text transfer destination doesn't match active zone.", + "Zone color transfer destination doesn't match active zone.", "Zone name transfer destination doesn't match active zone.", "Memory free event without a matching allocation.", "Discontinuous frame begin/end mismatch.", diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index 5b9409b8..2fe6ba00 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -383,6 +383,7 @@ public: ZoneStack, ZoneDoubleEnd, ZoneText, + ZoneColor, ZoneName, MemFree, FrameEnd, @@ -608,6 +609,7 @@ private: tracy_force_inline void ProcessFrameImage( const QueueFrameImage& ev ); tracy_force_inline void ProcessZoneText(); tracy_force_inline void ProcessZoneName(); + tracy_force_inline void ProcessZoneColor( const QueueZoneColor& ev ); tracy_force_inline void ProcessZoneValue( const QueueZoneValue& ev ); tracy_force_inline void ProcessLockAnnounce( const QueueLockAnnounce& ev ); tracy_force_inline void ProcessLockTerminate( const QueueLockTerminate& ev ); @@ -670,6 +672,7 @@ private: void ZoneStackFailure( uint64_t thread, const ZoneEvent* ev ); void ZoneDoubleEndFailure( uint64_t thread, const ZoneEvent* ev ); void ZoneTextFailure( uint64_t thread ); + void ZoneColorFailure( uint64_t thread ); void ZoneNameFailure( uint64_t thread ); void MemFreeFailure( uint64_t thread ); void FrameEndFailure(); |