Add GPU context name transfer to the protocol.

This commit is contained in:
Bartosz Taudul 2021-01-31 18:46:42 +01:00
parent dba35cfa21
commit 7f5810dfd6
2 changed files with 40 additions and 0 deletions

View File

@ -1828,9 +1828,14 @@ static void FreeAssociatedMemory( const QueueItem& item )
ptr = MemRead<uint64_t>( &item.lockNameFat.name );
tracy_free( (void*)ptr );
break;
case QueueType::GpuContextName:
ptr = MemRead<uint64_t>( &item.gpuContextNameFat.ptr );
tracy_free( (void*)ptr );
break;
#endif
#ifdef TRACY_ON_DEMAND
case QueueType::MessageAppInfo:
case QueueType::GpuContextName:
// Don't free memory associated with deferred messages.
break;
#endif
@ -2029,6 +2034,16 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token )
MemWrite( &item->gpuZoneEnd.cpuTime, dt );
break;
}
case QueueType::GpuContextName:
{
ptr = MemRead<uint64_t>( &item->gpuContextNameFat.ptr );
uint16_t size = MemRead<uint16_t>( &item->gpuContextNameFat.size );
SendSingleString( (const char*)ptr, size );
#ifndef TRACY_ON_DEMAND
tracy_free( (void*)ptr );
#endif
break;
}
case QueueType::PlotData:
{
int64_t t = MemRead<int64_t>( &item->plotData.time );
@ -2279,6 +2294,16 @@ Profiler::DequeueStatus Profiler::DequeueSerial()
MemWrite( &item->gpuTime.gpuTime, dt );
break;
}
case QueueType::GpuContextName:
{
ptr = MemRead<uint64_t>( &item->gpuContextNameFat.ptr );
uint16_t size = MemRead<uint16_t>( &item->gpuContextNameFat.size );
SendSingleString( (const char*)ptr, size );
#ifndef TRACY_ON_DEMAND
tracy_free( (void*)ptr );
#endif
break;
}
default:
assert( false );
break;

View File

@ -54,6 +54,7 @@ enum class QueueType : uint8_t
ContextSwitch,
ThreadWakeup,
GpuTime,
GpuContextName,
Terminate,
KeepAlive,
ThreadContext,
@ -357,6 +358,17 @@ struct QueueGpuCalibration
uint8_t context;
};
struct QueueGpuContextName
{
uint8_t context;
};
struct QueueGpuContextNameFat : public QueueGpuContextName
{
uint64_t ptr;
uint16_t size;
};
struct QueueMemNamePayload
{
uint64_t name;
@ -534,6 +546,8 @@ struct QueueItem
QueueGpuZoneEnd gpuZoneEnd;
QueueGpuTime gpuTime;
QueueGpuCalibration gpuCalibration;
QueueGpuContextName gpuContextName;
QueueGpuContextNameFat gpuContextNameFat;
QueueMemAlloc memAlloc;
QueueMemFree memFree;
QueueMemNamePayload memName;
@ -607,6 +621,7 @@ static constexpr size_t QueueDataSize[] = {
sizeof( QueueHeader ) + sizeof( QueueContextSwitch ),
sizeof( QueueHeader ) + sizeof( QueueThreadWakeup ),
sizeof( QueueHeader ) + sizeof( QueueGpuTime ),
sizeof( QueueHeader ) + sizeof( QueueGpuContextName ),
// above items must be first
sizeof( QueueHeader ), // terminate
sizeof( QueueHeader ), // keep alive