diff options
author | Ben Vanik <ben.vanik@gmail.com> | 2020-11-27 14:37:35 +0300 |
---|---|---|
committer | Bartosz Taudul <wolf.pld@gmail.com> | 2020-11-27 22:12:24 +0300 |
commit | 7dfdad2e02f41343c3ecf61faa6af00f8d616edf (patch) | |
tree | 69c89ad09899bd6abed96f128ca4ba7f4168eaf2 /client | |
parent | dfdf70aea35efb5b8aafc47025d1b1bce04ea9f4 (diff) |
Adding ZoneColor to set a dynamic color override to an existing zone.
Diffstat (limited to 'client')
-rw-r--r-- | client/TracyProfiler.cpp | 18 | ||||
-rw-r--r-- | client/TracyScoped.hpp | 13 |
2 files changed, 31 insertions, 0 deletions
diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 778a5b1c..2d6e65fb 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -3290,6 +3290,24 @@ TRACY_API void ___tracy_emit_zone_name( TracyCZoneCtx ctx, const char* txt, size } } +TRACY_API void ___tracy_emit_zone_color( TracyCZoneCtx ctx, uint32_t color ) { + if( !ctx.active ) return; +#ifndef TRACY_NO_VERIFY + { + TracyLfqPrepareC( tracy::QueueType::ZoneValidation ); + tracy::MemWrite( &item->zoneValidation.id, ctx.id ); + TracyLfqCommitC; + } +#endif + { + TracyLfqPrepareC( tracy::QueueType::ZoneColor ); + tracy::MemWrite( &item->zoneColor.r, uint8_t( ( color ) & 0xFF ) ); + tracy::MemWrite( &item->zoneColor.g, uint8_t( ( color >> 8 ) & 0xFF ) ); + tracy::MemWrite( &item->zoneColor.b, uint8_t( ( color >> 16 ) & 0xFF ) ); + TracyLfqCommitC; + } +} + TRACY_API void ___tracy_emit_zone_value( TracyCZoneCtx ctx, uint64_t value ) { if( !ctx.active ) return; diff --git a/client/TracyScoped.hpp b/client/TracyScoped.hpp index 78005e62..d6ad56b3 100644 --- a/client/TracyScoped.hpp +++ b/client/TracyScoped.hpp @@ -136,6 +136,19 @@ public: TracyLfqCommit; } + tracy_force_inline void Color( uint32_t color ) + { + if( !m_active ) return; +#ifdef TRACY_ON_DEMAND + if( GetProfiler().ConnectionId() != m_connectionId ) return; +#endif + TracyLfqPrepare( QueueType::ZoneColor ); + MemWrite( &item->zoneColor.r, uint8_t( ( color ) & 0xFF ) ); + MemWrite( &item->zoneColor.g, uint8_t( ( color >> 8 ) & 0xFF ) ); + MemWrite( &item->zoneColor.b, uint8_t( ( color >> 16 ) & 0xFF ) ); + TracyLfqCommit; + } + tracy_force_inline void Value( uint64_t value ) { if( !m_active ) return; |