test(🧪): add e2e test suite for instanced draw calls - #415
Merged
Conversation
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>
|
🎉 This PR is included in version 0.6.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.