Skip to content

More WebGPU optimizations#8510

Merged
davepagurek merged 9 commits intodev-2.0from
webgpu-perf
Feb 8, 2026
Merged

More WebGPU optimizations#8510
davepagurek merged 9 commits intodev-2.0from
webgpu-perf

Conversation

@davepagurek
Copy link
Contributor

Changes:

  • Sets up caching of bind groups. In order to do this, I've removed the assumption that all struct uniforms are in group 0, which lets us cache more groups, and leave one group remaining for the stuff that changes a lot.

  • More caching for other WebGPU properties: we don't update shaders in the current draw if the shader options are the same as before.

  • Avoids re-packing the same data twice by caching the packed version

  • Optimizes drawBuffers, which is run many times per frame. Cache keys are numbers instead of strings; buffers are saved and reused instead of using a new array each time; loops are reorganized to avoid needing to use intermediate maps.

  • 4000 spheres with different colors with strokes: WebGL is 10fps, WebGPU is 14fps

  • 4000 spheres with different colors with no strokes: WebGL is 20fps, WebGPU is 19fps

  • 4000 spheres with the same color: WebGL is 29fps, WebGPU is 29fps

Test sketch: https://editor.p5js.org/davepagurek/sketches/lD-JsoCI4

PR Checklist

@davepagurek davepagurek merged commit 612a5f9 into dev-2.0 Feb 8, 2026
5 checks passed
@davepagurek davepagurek deleted the webgpu-perf branch February 8, 2026 21:22
@ksen0 ksen0 added this to the 2.2 milestone Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Completed

Development

Successfully merging this pull request may close these issues.

2 participants

Comments