1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Adding ZoneColor to set a dynamic color override to an existing zone.

This commit is contained in:
Ben Vanik
2020-11-27 03:37:35 -08:00
committed by Bartosz Taudul
parent dfdf70aea3
commit 7dfdad2e02
12 changed files with 106 additions and 7 deletions
+18
View File
@@ -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;
+13
View File
@@ -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;