Render 1,000 draw calls with a GPURenderBundle
The scene has 1,000 shapes: triangles, squares, and hexagons. Each shape is a separate
draw() call. The page records all 1,000 calls into a render bundle once, then
replays them every frame with one renderPass.executeBundles() call.
- Move and recolor writes new positions and colors into the uniform buffer the bundle already uses. The bundle is reused, not re-recorded.
- Change shapes changes which shape each object draws, which changes the recorded draw calls, so the bundle is recorded again.
Without WebGPU, or if GPU setup fails, the page renders the same scene with WebGL 2. WebGL 2 has no render bundles, so JavaScript issues all 1,000 draw calls again on every frame. Compare the JavaScript time per frame below. If WebGL 2 isn't available either, the page draws the shapes once into a cached 2D canvas layer, without animation.
To see the fallbacks, add ?fallback=webgl2 or ?fallback=2d to the URL.
Initializing…