Skip to content

compute.readback

Summary

compute.readback is the compute service's shared staging ring for asynchronous GPU-to-CPU copies. Use typed reads for results you want to keep, or a snapshot callback to consume bytes while a staging buffer is mapped.

Syntax

readonly Compute.readback: ReadbackRing
const values = await wgpu.compute.readback.readF32(storage, 0, 2);

Available APIs

Notes

GPU copies use a source with COPY_SRC usage on the compute device. Submit commands that produce the values before invoking a read. The readback copy follows them on the queue. Leave the shared ring alive while the compute service is in use and let the service destroy it during teardown. Create a separate ring for caller-managed staging.

See Also