Skip to main content

capture

Function capture 

Source
pub fn capture<T, F>(device: &Device, closure: F) -> Graph<T, F>
where F: FnMut() -> T,
Expand description

Capture closure for repeated replay (see Graph).

Runs closure twice: once to warm up (trigger autotuning and allocate every buffer, so the capture itself needs no fresh device allocation — which is illegal mid-capture), then once under capture. On a backend without graph support the warmup/capture collapses to a single run and replay just re-runs the closure.