Expand description
Generic Send/Sync shim for parallel per-pass command recording, shared by all
three backend executors ({metal,directx,vulkan}/graph_exec.rs). Each backend
fans its non-composite render-graph passes onto worker threads; every worker
records into its own command buffer/list and reaches the immutable subset of
the backend context it needs through a ParallelCtxRef.
The backend context types are not Send/Sync in Rust’s type system: they hold
COM smart pointers, objc2 protocol objects, RefCells, and the like. The
graphics APIs nonetheless permit shared, read-only access to device-derived
resources from many threads. A backend adopts that claim for its own context
type with a single unsafe impl ParallelEncodeCtx, where it documents the
audit of every interior-mutable field reachable during encode. The Send/Sync
impls on ParallelCtxRef below are then keyed off that marker, so the unsafe
reasoning lives in one auditable place per backend instead of being repeated
on three structurally identical wrapper types.
Structs§
- Parallel
CtxRef - A handle to a
&'a Tborrow that is Send + Sync whenT: ParallelEncodeCtx. Worker closures use it to reach the immutable subset of the backend context they need while recording commands into their own command buffer/list.
Traits§
- Parallel
Encode Ctx - Marker for a backend context that may be shared, read-only, across the parallel-encode worker fan-out.