Backend-uniform fence between QRhi command-buffer + CUDA stream. More...
Detailed Description
Backend-uniform fence between QRhi command-buffer + CUDA stream.
Vendor-direct video paths (AJA, Magewell, Rivermax, ...) need to be sure the GPU has finished writing a buffer before the peer device DMA-reads it. The synchronisation primitive differs by graphics API:
- D3D11 : no-op. The immediate context flush done at
endOffscreenFrameis sufficient; CUDA mapped resources share the same queue. - OpenGL :
glFinish(). CPU-stalls but cheap when called once per frame at 25-60 Hz, and required because GL+CUDA buffer interop has no native fence path on every driver. - D3D12 : ID3D12Fence shared with CUDA via
cuda_interop_import_d3d12_fencecuda_interop_wait_semaphore— stub today.
- Vulkan : a ring of exportable binary VkSemaphores (OPAQUE_FD / OPAQUE_WIN32) imported into CUDA via
cuda_interop_import_vulkan_semaphore+cuda_interop_wait_semaphore.
Per-frame lifecycle on Vulkan (and on D3D12 once it is real):
// inside offscreen frame, after compute dispatch: fence.signalAfterEncode(cb, ++value); // outside the frame, before handing the buffer to the peer: fence.waitOnCuda(value);
Keeps the glFinish / D3D11-immediate-context-flush handling in one place instead of open-coded in each per-backend output path, and gives a stable hook for the D3D12 path when it lands.
Go to the source code of this file.
Classes | |
| struct | score::gfx::interop::InteropFence |
| Backend-uniform fence interface. Per-vendor adapters hold one instance, signal it after the per-frame compute dispatch, wait on it from CUDA before peer DMA. More... | |
Namespaces | |
| namespace | score |
| Base toolkit upon which the software is built. | |
| namespace | score::gfx |
| Graphics rendering pipeline for ossia score. | |
Functions | |
| std::unique_ptr< InteropFence > | score::gfx::interop::makeInteropFence (QRhi &rhi) |
Factory. Returns the right concrete impl for rhi's backend. Caller still needs to init() the returned fence. Never null — unsupported backends return a stub whose valid() is false. | |