Add source contents callback setup.

This commit is contained in:
Bartosz Taudul 2022-08-17 15:36:54 +02:00
parent 4bcb59bbe6
commit ed7be2faaa
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 11 additions and 0 deletions

View File

@ -1356,6 +1356,7 @@ Profiler::Profiler()
, m_deferredQueue( 64*1024 ) , m_deferredQueue( 64*1024 )
#endif #endif
, m_paramCallback( nullptr ) , m_paramCallback( nullptr )
, m_sourceCallback( nullptr )
, m_queryImage( nullptr ) , m_queryImage( nullptr )
, m_queryData( nullptr ) , m_queryData( nullptr )
, m_crashHandlerInstalled( false ) , m_crashHandlerInstalled( false )

View File

@ -150,6 +150,7 @@ struct LuaZoneState
typedef void(*ParameterCallback)( uint32_t idx, int32_t val ); typedef void(*ParameterCallback)( uint32_t idx, int32_t val );
typedef char*(*SourceContentsCallback)( void* data, const char* filename, size_t& size );
class Profiler class Profiler
{ {
@ -634,6 +635,13 @@ public:
TracyLfqCommit; TracyLfqCommit;
} }
static tracy_force_inline void SourceCallbackRegister( SourceContentsCallback cb, void* data )
{
auto& profiler = GetProfiler();
profiler.m_sourceCallback = cb;
profiler.m_sourceCallbackData = data;
}
#ifdef TRACY_FIBERS #ifdef TRACY_FIBERS
static tracy_force_inline void EnterFiber( const char* fiber ) static tracy_force_inline void EnterFiber( const char* fiber )
{ {
@ -928,6 +936,8 @@ private:
#endif #endif
ParameterCallback m_paramCallback; ParameterCallback m_paramCallback;
SourceContentsCallback m_sourceCallback;
void* m_sourceCallbackData;
char* m_queryImage; char* m_queryImage;
char* m_queryData; char* m_queryData;