Skip to main content

wait_readback_map

Function wait_readback_map 

Source
pub fn wait_readback_map(
    device: &Device,
    submission: SubmissionIndex,
    _map_rx: &Receiver<Result<(), BufferAsyncError>>,
    _total_bytes: usize,
)
Expand description

Block until the submission that produced the readback has finished and its buffer-map callback has fired, then return.

A single submission-index Wait replaces the old 64–256 poll(Poll) busy-spin followed by a full Wait. Each Poll maintain pass costs tens of microseconds on Metal, so the spin alone added ~3 ms of pure CPU overhead per run — the dominant cost for small graphs (an MNIST CNN forward dropped from ~3.4 ms to sub-millisecond). wgpu invokes the buffer-map callback as part of the poll, so the mapped range is ready when this returns.