Expand description
Experimental zero-copy GPU interop for xgpui: show frames from a GPU engine you own in xgpui windows, the way an engine presents to a swapchain. See the GPU interop guide.
The engine keeps its own device, queue and thread. An [EngineSurface] owns
a fixed ring of shareable slots:
acquire()a writable slot, or getAcquireError::WouldBlockwhen every slot is still in use (bounded backpressure).- Render into the slot on the engine’s GPU and submit a signal of a sync point after that work.
present(slot, sync)publishes the slot. It is never written again until every retained scene that sampled it is gone and the compositor’s GPU sampling has completed; then it returns to the ring.
The host composites the latest presented slot as ordinary custom content, after a GPU-side wait on the sync point. Nothing is copied through the CPU.
Contract: call present only after the engine has submitted the work that
signals the sync point. A sync point whose signal is never submitted can
stall composition.
Implemented: macOS (IOSurface slots, MTLSharedEvent sync); with feature
wgpu, Linux (opaque-fd Vulkan memory, timeline semaphore) and Windows
(shared NT-handle D3D12 textures and fence, opened by the D3D11
compositor). The compositor waits for each frame on the GPU.
The engine must run on the compositor’s GPU; otherwise the surface reports
Unsupported. On a machine with two GPUs, nothing yet helps an engine pick
the right one (issue #253).
Structs§
- Heavy
Engine - Configuration for heavy-engine mode.
- Heavy
Status - Snapshot of a target’s heavy-engine state.
- Surface
Desc - Fixed properties of a surface’s slots.
- Surface
Stats - Counters for diagnostics and pressure tests.
- Unsupported
- Returned when the platform or configuration cannot support a surface.
Enums§
- Acquire
Error - Why
acquirereturned no slot. - Surface
Format - Pixel storage and color interpretation of every slot in a surface.
- Transport
- How engine output reaches the compositor.