Skip to content

test(🧪): add e2e test suite for instanced draw calls - #415

Merged
wcandillon merged 7 commits into
mainfrom
claude/webgpu-draw-instanced-tests-qge112
Jul 15, 2026
Merged

test(🧪): add e2e test suite for instanced draw calls#415
wcandillon merged 7 commits into
mainfrom
claude/webgpu-draw-instanced-tests-qge112

Conversation

@wcandillon

Copy link
Copy Markdown
Owner

Covers draw() with an instance count, non-zero firstInstance, drawIndexed() with an instance count, a stepMode: "instance" vertex buffer, and drawIndirect() (which must match the equivalent direct draw). Complements the existing instancing coverage in Cube.spec.ts (Instanced cubes) and ABuffer.spec.ts.

claude and others added 7 commits July 14, 2026 13:26
Covers draw() with an instance count, non-zero firstInstance,
drawIndexed() with an instance count, a stepMode: "instance" vertex
buffer, and drawIndirect() (which must match the equivalent direct
draw). Complements the existing instancing coverage in Cube.spec.ts
(Instanced cubes) and ABuffer.spec.ts.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y9izveoq62NmuW8Dh3Nk3J
Lets freshly generated reference images (checkImage writes missing
snapshots on first run) and the .test.png/-diff-test.png images from
failed comparisons be downloaded and inspected from the workflow run.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y9izveoq62NmuW8Dh3Nk3J
On the iOS Simulator a draw with a non-zero firstInstance (Metal's
baseInstance path) invalidates the whole command buffer, so the readback
comes back fully transparent — clear included — and the blank image was
silently written as the reference snapshot. Capture validation errors
around the submit and assert the readback is not all zeros before
checkImage, so the simulator failure mode shows up as a test failure
instead of a blank baseline.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y9izveoq62NmuW8Dh3Nk3J
…de (#416)

* test(🧪): run the e2e suite in-process via dawn.node with yarn test:node

Adds a NodeTestingClient that executes client.eval directly against the
webgpu npm package (Dawn's node bindings) instead of shipping the code
to a device over WebSocket or to Chrome via puppeteer. The eval function
runs in-process against the same offscreen DrawingContext the reference
client injects into Chrome, so existing specs and snapshots work
unchanged. NODE_WEBGPU=true selects the client and skips the WebSocket
test server, mirroring how REFERENCE=true works.

The dawn.node binary is loaded directly from webgpu/dist because the
package entry point is ESM-only, which jest's CommonJS transform cannot
load.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y9izveoq62NmuW8Dh3Nk3J

* test(🧪): polyfill createImageBitmap and copyExternalImageToTexture for the node client

dawn.node implements the core WebGPU API but none of the web-platform
image machinery, so decode PNGs with pngjs for createImageBitmap
(ArrayBuffer, view, Blob, or ImageData-like sources) and route the raw
RGBA bytes of ImageData-like sources through writeTexture for
copyExternalImageToTexture. This unlocks the textured demos (Cube, Blur,
RenderBundles) and the fetch-based ExternalTexture path under
yarn test:node.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y9izveoq62NmuW8Dh3Nk3J

---------

Co-authored-by: Claude <noreply@anthropic.com>
@wcandillon
wcandillon merged commit 139d50c into main Jul 15, 2026
2 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 0.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants