#1301

GPU: Tracy C API for "non-threaded" contexts

Openslompopened 7mo ago

This is a continuation of the conversation in https://github.com/wolfpld/tracy/pull/1293.

Put simply, ___tracy_emit_gpu_new_context (and the _serial variant) sets gpuNewContext.thread to tracy::GetThreadHandle(): https://github.com/wolfpld/tracy/blob/80c849a2aabb7034baca688635232fbc5cc23e94/public/client/TracyProfiler.cpp#L4821

This creates a GPU context for a "threaded" (immediate) GPU context (like OpenGL or vanilla D3D11). There is no way to create a "non-threaded" GPU context (for modern graphics APIs) from the Tracy C API.

Activity

2
slomp7mo ago

A few more things that will need attention to address this issue:

The GPU zone begin/end Tracy C APIs also manage the thread field: https://github.com/wolfpld/tracy/blob/80c849a2aabb7034baca688635232fbc5cc23e94/public/client/TracyProfiler.cpp#L4753 https://github.com/wolfpld/tracy/blob/80c849a2aabb7034baca688635232fbc5cc23e94/public/client/TracyProfiler.cpp#L4810

In a threaded context, the thread specified in the begin-zone is ignored: https://github.com/wolfpld/tracy/blob/aa30c611a84690655325ef62efb2ec9ec69a18f9/server/TracyWorker.cpp#L5828-L5834

but in the end-zone message, the thread field is used, but is expected to be zero in threaded context: https://github.com/wolfpld/tracy/blob/aa30c611a84690655325ef62efb2ec9ec69a18f9/server/TracyWorker.cpp#L5920-L5921

slomp5mo ago

Specific to D3D12, we could:

  • add C-style interfaces for it: ___tracy_d3d12_***
  • isolate begin/end logic into inline static class methods

This can also accommodate for cases where the begin and end markers need to be placed in different command lists.