Add user data pointer to parameter callback.

This commit is contained in:
Bartosz Taudul 2022-08-26 00:46:01 +02:00
parent 655d8a01ea
commit 72b7d0db5b
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
3 changed files with 12 additions and 5 deletions

View File

@ -3796,7 +3796,7 @@ void Profiler::HandleParameter( uint64_t payload )
assert( m_paramCallback );
const auto idx = uint32_t( payload >> 32 );
const auto val = int32_t( payload & 0xFFFFFFFF );
m_paramCallback( idx, val );
m_paramCallback( m_paramCallbackData, idx, val );
AckServerQuery();
}

View File

@ -149,7 +149,7 @@ struct LuaZoneState
#endif
typedef void(*ParameterCallback)( uint32_t idx, int32_t val );
typedef void(*ParameterCallback)( void* data, uint32_t idx, int32_t val );
typedef char*(*SourceContentsCallback)( void* data, const char* filename, size_t& size );
class Profiler
@ -619,7 +619,13 @@ public:
#endif
}
static tracy_force_inline void ParameterRegister( ParameterCallback cb ) { GetProfiler().m_paramCallback = cb; }
static tracy_force_inline void ParameterRegister( ParameterCallback cb, void* data )
{
auto& profiler = GetProfiler();
profiler.m_paramCallback = cb;
profiler.m_paramCallbackData = data;
}
static tracy_force_inline void ParameterSetup( uint32_t idx, const char* name, bool isBool, int32_t val )
{
TracyLfqPrepare( QueueType::ParamSetup );
@ -936,6 +942,7 @@ private:
#endif
ParameterCallback m_paramCallback;
void* m_paramCallbackData;
SourceContentsCallback m_sourceCallback;
void* m_sourceCallbackData;

View File

@ -94,7 +94,7 @@
#define TracyMessageLCS(x,y,z)
#define TracySourceCallbackRegister(x,y)
#define TracyParameterRegister(x)
#define TracyParameterRegister(x,y)
#define TracyParameterSetup(x,y,z,w)
#define TracyIsConnected false
@ -255,7 +255,7 @@
#endif
#define TracySourceCallbackRegister( cb, data ) tracy::Profiler::SourceCallbackRegister( cb, data )
#define TracyParameterRegister( cb ) tracy::Profiler::ParameterRegister( cb )
#define TracyParameterRegister( cb, data ) tracy::Profiler::ParameterRegister( cb, data )
#define TracyParameterSetup( idx, name, isBool, val ) tracy::Profiler::ParameterSetup( idx, name, isBool, val )
#define TracyIsConnected tracy::GetProfiler().IsConnected()