参考 index

index

This feature requires the p5.webgpu.js addon.
此 API 是实验性的

其行为可能在 p5.js 的未来版本中发生变化。

Information about the current iteration of a compute shader.

Use it inside a buildComputeShader() function to write a loop that runs in parallel on the GPU.

index is a three-component vector with the current index across all dimensions passed to compute(). For example, use index.x to get the index when looping in one dimension.


相关参考