Added IsConnected C API Equivalent

This commit is contained in:
Nathan Day 2021-12-04 16:55:41 +00:00
parent bbbae35925
commit bdafd0c7b6
2 changed files with 11 additions and 0 deletions

View File

@ -73,6 +73,8 @@ typedef const void* TracyCZoneCtx;
#define TracyCMessageCS(x,y,z,w) #define TracyCMessageCS(x,y,z,w)
#define TracyCMessageLCS(x,y,z) #define TracyCMessageLCS(x,y,z)
#define TracyCIsConnected 0
#ifdef TRACY_FIBERS #ifdef TRACY_FIBERS
# define TracyCFiberEnter(fiber) # define TracyCFiberEnter(fiber)
# define TracyCFiberLeave # define TracyCFiberLeave
@ -169,6 +171,8 @@ TRACY_API void ___tracy_emit_gpu_time_serial( const struct ___tracy_gpu_time_dat
TRACY_API void ___tracy_emit_gpu_new_context_serial( const struct ___tracy_gpu_new_context_data ); TRACY_API void ___tracy_emit_gpu_new_context_serial( const struct ___tracy_gpu_new_context_data );
TRACY_API void ___tracy_emit_gpu_context_name_serial( const struct ___tracy_gpu_context_name_data ); TRACY_API void ___tracy_emit_gpu_context_name_serial( const struct ___tracy_gpu_context_name_data );
TRACY_API int ___tracy_connected(void);
#if defined TRACY_HAS_CALLSTACK && defined TRACY_CALLSTACK #if defined TRACY_HAS_CALLSTACK && defined TRACY_CALLSTACK
# define TracyCZone( ctx, active ) static const struct ___tracy_source_location_data TracyConcat(__tracy_source_location,__LINE__) = { NULL, __func__, __FILE__, (uint32_t)__LINE__, 0 }; TracyCZoneCtx ctx = ___tracy_emit_zone_begin_callstack( &TracyConcat(__tracy_source_location,__LINE__), TRACY_CALLSTACK, active ); # define TracyCZone( ctx, active ) static const struct ___tracy_source_location_data TracyConcat(__tracy_source_location,__LINE__) = { NULL, __func__, __FILE__, (uint32_t)__LINE__, 0 }; TracyCZoneCtx ctx = ___tracy_emit_zone_begin_callstack( &TracyConcat(__tracy_source_location,__LINE__), TRACY_CALLSTACK, active );
# define TracyCZoneN( ctx, name, active ) static const struct ___tracy_source_location_data TracyConcat(__tracy_source_location,__LINE__) = { name, __func__, __FILE__, (uint32_t)__LINE__, 0 }; TracyCZoneCtx ctx = ___tracy_emit_zone_begin_callstack( &TracyConcat(__tracy_source_location,__LINE__), TRACY_CALLSTACK, active ); # define TracyCZoneN( ctx, name, active ) static const struct ___tracy_source_location_data TracyConcat(__tracy_source_location,__LINE__) = { name, __func__, __FILE__, (uint32_t)__LINE__, 0 }; TracyCZoneCtx ctx = ___tracy_emit_zone_begin_callstack( &TracyConcat(__tracy_source_location,__LINE__), TRACY_CALLSTACK, active );
@ -297,6 +301,8 @@ TRACY_API void ___tracy_emit_message_appinfo( const char* txt, size_t size );
# define TracyCMessageLCS( txt, color, depth ) TracyCMessageLC( txt, color ) # define TracyCMessageLCS( txt, color, depth ) TracyCMessageLC( txt, color )
#endif #endif
#define TracyCIsConnected ___tracy_connected()
TRACY_API void ___tracy_fiber_enter( const char* fiber ); TRACY_API void ___tracy_fiber_enter( const char* fiber );
TRACY_API void ___tracy_fiber_leave( void ); TRACY_API void ___tracy_fiber_leave( void );

View File

@ -4158,6 +4158,11 @@ TRACY_API void ___tracy_emit_gpu_context_name_serial( const struct ___tracy_gpu_
tracy::Profiler::QueueSerialFinish(); tracy::Profiler::QueueSerialFinish();
} }
TRACY_API int ___tracy_connected( void )
{
return tracy::GetProfiler().IsConnected();
}
#ifdef TRACY_FIBERS #ifdef TRACY_FIBERS
TRACY_API void ___tracy_fiber_enter( const char* fiber ){ tracy::Profiler::EnterFiber( fiber ); } TRACY_API void ___tracy_fiber_enter( const char* fiber ){ tracy::Profiler::EnterFiber( fiber ); }
TRACY_API void ___tracy_fiber_leave( void ){ tracy::Profiler::LeaveFiber(); } TRACY_API void ___tracy_fiber_leave( void ){ tracy::Profiler::LeaveFiber(); }