This feature requires the p5.webgpu.js addon.
This API is experimental
Its behavior may change in a future version of p5.js.
Creates a p5.StorageBuffer, which is a block of data that shaders can read from, and compute shaders can also write to. This is only available in WebGPU mode.
To read or write the data inside a shader, use uniformStorage(). To update its contents from JavaScript, call .update() on the result with new data.
Pass an array of objects to store a list of items, each with named properties. The properties can be numbers, arrays of numbers, vectors created with createVector(), or colors created with color(). Inside the shader, each item is accessed by index, and its properties are available by name.
You can also store a plain list of numbers by passing an array of numbers. Inside the shader, each number is accessed by index directly. To create an empty list to be filled in by a compute shader, pass a count instead.
Examples
Syntax
createStorage(dataOrCount)