This feature requires the p5.webgpu.js addon.
This API is experimental
Its behavior may change in a future version of p5.js.
Reads data from a storage buffer back into JavaScript.
Copies data from the GPU to the CPU using a temporary buffer, so it must be awaited. Returns a Float32Array for number buffers, or an array of plain objects for struct buffers.
Note: This is a GPU -> CPU read, so calling it often (like every frame) can be slow.
Examples
Syntax
read()
Parameters
Returns
Promise<Float32Array|Object[]>:
Notice any errors or typos? Please let us know. Please feel free to edit src/webgpu/p5.RendererWebGPU.js and open a pull request!