Merge pull request #465 from Pilzschaf/gpu_c_api_improvements

Added gpu calibration to the C API
This commit is contained in:
Bartosz Taudul 2022-09-09 19:22:25 +02:00 committed by GitHub
commit 097b68e7bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 0 deletions

View File

@ -4219,6 +4219,16 @@ TRACY_API void ___tracy_emit_gpu_context_name( const struct ___tracy_gpu_context
TracyLfqCommitC;
}
TRACY_API void ___tracy_emit_gpu_calibration( const struct ___tracy_gpu_calibration_data data )
{
TracyLfqPrepareC( tracy::QueueType::GpuCalibration );
tracy::MemWrite( &item->gpuCalibration.cpuTime, tracy::Profiler::GetTime() );
tracy::MemWrite( &item->gpuCalibration.gpuTime, data.gpuTime );
tracy::MemWrite( &item->gpuCalibration.cpuDelta, data.cpuDelta );
tracy::MemWrite( &item->gpuCalibration.context, data.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();
@ -4279,6 +4289,17 @@ TRACY_API void ___tracy_emit_gpu_context_name_serial( const struct ___tracy_gpu_
tracy::Profiler::QueueSerialFinish();
}
TRACY_API void ___tracy_emit_gpu_calibration_serial( const struct ___tracy_gpu_calibration_data data )
{
auto item = tracy::Profiler::QueueSerial();
tracy::MemWrite( &item->hdr.type, tracy::QueueType::GpuCalibration );
tracy::MemWrite( &item->gpuCalibration.cpuTime, tracy::Profiler::GetTime() );
tracy::MemWrite( &item->gpuCalibration.gpuTime, data.gpuTime );
tracy::MemWrite( &item->gpuCalibration.cpuDelta, data.cpuDelta );
tracy::MemWrite( &item->gpuCalibration.context, data.context );
tracy::Profiler::QueueSerialFinish();
}
TRACY_API int ___tracy_connected( void )
{
return tracy::GetProfiler().IsConnected();

View File

@ -136,6 +136,12 @@ struct ___tracy_gpu_context_name_data {
uint16_t len;
};
struct ___tracy_gpu_calibration_data {
int64_t gpuTime;
int64_t cpuDelta;
uint8_t context;
};
// Some containers don't support storing const types.
// This struct, as visible to user, is immutable, so treat it as if const was declared here.
typedef /*const*/ struct ___tracy_c_zone_context TracyCZoneCtx;
@ -164,12 +170,14 @@ TRACY_API void ___tracy_emit_gpu_zone_end( const struct ___tracy_gpu_zone_end_da
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_calibration( const struct ___tracy_gpu_calibration_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 );
TRACY_API void ___tracy_emit_gpu_calibration_serial( const struct ___tracy_gpu_calibration_data );
TRACY_API int ___tracy_connected(void);