This feature requires the p5.webgpu.js addon.
此 API 是实验性的
其行为可能在 p5.js 的未来版本中发生变化。
Appends one element to the list. This can be called from your sketch's JavaScript or from within a compute shader. Use this to seed a list before any compute shaders run. Calling push() after a GPU compute pass that has already modified the list will produce undefined ordering.
For a float list, pass a number. For a struct list, pass a plain object whose properties match the schema.
You can also use push() from compute shaders. This approach can often be faster as no data needs to transfer from the CPU to the GPU.
示例
语法
push(element)
参数
element
Number|Object: A number for float lists, or a plain object matching the list's schema for struct lists.
Notice any errors or typos? Please let us know. Please feel free to edit src/webgpu/p5.RendererWebGPU.js and open a pull request!