Add serial functions

This commit is contained in:
Ashley Ruglys 2021-11-24 11:56:43 +01:00
parent 2995db4b5e
commit 2db109ab98
No known key found for this signature in database
GPG Key ID: 1CDD7E27FB663837
2 changed files with 66 additions and 1 deletions

View File

@ -158,6 +158,12 @@ TRACY_API void ___tracy_emit_gpu_time( const struct ___tracy_gpu_time_data );
TRACY_API void ___tracy_emit_gpu_new_context( const struct ___tracy_gpu_new_context_data );
TRACY_API void ___tracy_emit_gpu_context_name( const struct ___tracy_gpu_context_name_data );
TRACY_API void ___tracy_emit_gpu_zone_begin_alloc_serial( const struct ___tracy_gpu_zone_begin_data );
TRACY_API void ___tracy_emit_gpu_zone_end_serial( const struct ___tracy_gpu_zone_end_data data );
TRACY_API void ___tracy_emit_gpu_time_serial( const struct ___tracy_gpu_time_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 );
#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 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 );

View File

@ -3995,7 +3995,6 @@ TRACY_API void ___tracy_emit_gpu_zone_end( const struct ___tracy_gpu_zone_end_da
TracyLfqCommitC;
}
TRACY_API void ___tracy_emit_gpu_new_context( ___tracy_gpu_new_context_data data )
{
TracyLfqPrepareC( tracy::QueueType::GpuNewContext );
@ -4021,6 +4020,66 @@ TRACY_API void ___tracy_emit_gpu_context_name( const struct ___tracy_gpu_context
TracyLfqCommitC;
}
TRACY_API void ___tracy_emit_gpu_zone_begin_alloc_serial( const struct ___tracy_gpu_zone_begin_data data )
{
auto item = tracy::Profiler::QueueSerial();
tracy::MemWrite( &item->hdr.type, tracy::QueueType::GpuZoneBeginAllocSrcLocSerial );
tracy::MemWrite( &item->gpuZoneBegin.cpuTime, tracy::Profiler::GetTime() );
tracy::MemWrite( &item->gpuNewContext.thread, tracy::GetThreadHandle() );
tracy::MemWrite( &item->gpuZoneBegin.srcloc, data.srcloc );
tracy::MemWrite( &item->gpuZoneBegin.queryId, data.queryId );
tracy::MemWrite( &item->gpuZoneBegin.context, data.context );
tracy::Profiler::QueueSerialFinish();
}
TRACY_API void ___tracy_emit_gpu_time_serial( const struct ___tracy_gpu_time_data data )
{
auto item = tracy::Profiler::QueueSerial();
tracy::MemWrite( &item->hdr.type, tracy::QueueType::GpuTime );
tracy::MemWrite( &item->gpuTime.gpuTime, data.gpuTime );
tracy::MemWrite( &item->gpuTime.queryId, data.queryId );
tracy::MemWrite( &item->gpuTime.context, data.context );
tracy::Profiler::QueueSerialFinish();
}
TRACY_API void ___tracy_emit_gpu_zone_end_serial( const struct ___tracy_gpu_zone_end_data data )
{
auto item = tracy::Profiler::QueueSerial();
tracy::MemWrite( &item->hdr.type, tracy::QueueType::GpuZoneEndSerial );
tracy::MemWrite( &item->gpuZoneEnd.cpuTime, tracy::Profiler::GetTime() );
memset( &item->gpuZoneEnd.thread, 0, sizeof( item->gpuZoneEnd.thread ) );
tracy::MemWrite( &item->gpuZoneEnd.queryId, data.queryId );
tracy::MemWrite( &item->gpuZoneEnd.context, data.context );
tracy::Profiler::QueueSerialFinish();
}
TRACY_API void ___tracy_emit_gpu_new_context_serial( ___tracy_gpu_new_context_data data )
{
auto item = tracy::Profiler::QueueSerial();
tracy::MemWrite( &item->hdr.type, tracy::QueueType::GpuNewContext );
tracy::MemWrite( &item->gpuNewContext.cpuTime, tracy::Profiler::GetTime() );
tracy::MemWrite( &item->gpuNewContext.thread, tracy::GetThreadHandle() );
tracy::MemWrite( &item->gpuNewContext.gpuTime, data.gpuTime );
tracy::MemWrite( &item->gpuNewContext.period, data.period );
tracy::MemWrite( &item->gpuNewContext.context, data.context );
tracy::MemWrite( &item->gpuNewContext.flags, data.flags );
tracy::MemWrite( &item->gpuNewContext.type, data.type );
tracy::Profiler::QueueSerialFinish();
}
TRACY_API void ___tracy_emit_gpu_context_name_serial( const struct ___tracy_gpu_context_name_data data )
{
auto ptr = (char*)tracy::tracy_malloc( data.len );
memcpy( ptr, data.name, data.len );
auto item = tracy::Profiler::QueueSerial();
tracy::MemWrite( &item->hdr.type, tracy::QueueType::GpuContextName );
tracy::MemWrite( &item->gpuContextNameFat.context, data.context );
tracy::MemWrite( &item->gpuContextNameFat.ptr, (uint64_t)ptr );
tracy::MemWrite( &item->gpuContextNameFat.size, data.len );
tracy::Profiler::QueueSerialFinish();
}
# ifdef TRACY_MANUAL_LIFETIME
TRACY_API void ___tracy_startup_profiler( void )
{