From 6411b35d68e77d0ae49495077148a489c57f5445 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 9 Oct 2021 14:55:32 +0200 Subject: [PATCH] Provide macros for async-or-sync queue insertion. If fibers are enabled, then some events which were traditionally stored in async queues will have to be serialized. These macros provide the needed infrastructure for this. --- client/TracyProfiler.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/client/TracyProfiler.hpp b/client/TracyProfiler.hpp index 19041599..bebe86bb 100644 --- a/client/TracyProfiler.hpp +++ b/client/TracyProfiler.hpp @@ -105,6 +105,19 @@ struct LuaZoneState __tail.store( __magic + 1, std::memory_order_release ); +#ifdef TRACY_FIBERS +# define TracyQueuePrepare( _type ) \ + auto item = Profiler::QueueSerial(); \ + MemWrite( &item->hdr.type, _type ); +# define TracyQueueCommit( _name ) \ + MemWrite( &item->_name.thread, GetThreadHandle() ); \ + Profiler::QueueSerialFinish(); +#else +# define TracyQueuePrepare( _type ) TracyLfqPrepare( _type ) +# define TracyQueueCommit( _name ) TracyLfqCommit +#endif + + typedef void(*ParameterCallback)( uint32_t idx, int32_t val ); class Profiler