This feature requires the p5.webgpu.js addon.
此 API 是实验性的
其行为可能在 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.
示例
语法
read()
参数
返回值
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!