This feature requires the p5.webgpu.js addon.
This API is experimental
Its behavior may change in a future version of 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.
Examples
Syntax
push(element)
Parameters
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!