Skip to content

Complete emsdk/WebGPU toolchain hardening foundation - #459

Merged
ford442 merged 1 commit into
mainfrom
cursor/emsdk-webgpu-hardening-623a
Jul 26, 2026
Merged

Complete emsdk/WebGPU toolchain hardening foundation#459
ford442 merged 1 commit into
mainfrom
cursor/emsdk-webgpu-hardening-623a

Conversation

@ford442

@ford442 ford442 commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Summary

Most of the toolchain + device-policy foundation from the 2026-07-22 audit landed in #457. This PR closes the remaining gap: TETRIS_CPP_WEBGPU=auto no longer attempts the removed legacy -s USE_WEBGPU=1 flag when .emsdk-version is ≥ 5.0, so a clean npm run cpp:release on the pinned emsdk links emdawnwebgpu without a wasted failed link.

Also adds a buildCanvasConfiguration unit test and aligns cpp/README.md with the actual auto port order on the pinned toolchain.

Acceptance checklist

  • .emsdk-version is 5.0.7 (matches CI cache key + cpp/README.md)
  • auto prefers emdawnwebgpu; on pinned 5.x, legacy is skipped intentionally (logged)
  • build-info.json emits wasmBytes/jsBytes; cpp-renderer.yml CI asserts both
  • requestGpuAdapterAndDevice has requiredLimits, centralized buildCanvasConfiguration, GameSettings.gpuPower wiring — covered by tests/gpu-context.test.ts
  • "type": "module" in package.json — ESLint runs clean

Changes in this PR

  • scripts/build-cpp.mjs: shouldSkipLegacyWebGpu() — when pin major ≥ 5, auto['EMDAWN', 'NONE'] with an explanatory log line
  • tests/build-cpp.test.ts: assert skip logic + jsBytes contract
  • tests/gpu-context.test.ts: buildCanvasConfiguration premultiplied-alpha test
  • cpp/README.md: document auto behavior on pinned 5.x

Not in scope (deferred)

  • C++ WGPUPresentMode_Mailbox experiment for high-end — still Fifo + premultiplied; can follow once shader parity work resumes
  • Replacing emdawn with Rust wgpu (research already decided against)

Test plan

  • npm test (213 tests)
  • npm run lint (no MODULE_TYPELESS_PACKAGE_JSON warning)
  • npm run cpp:release on emsdk 5.0.7 → webGpuBackendId: "emdawn" with no legacy attempt (CI cpp-renderer.yml)
Open in Web Open in Cursor 

When .emsdk-version is >= 5.0, TETRIS_CPP_WEBGPU=auto now links
emdawnwebgpu → Canvas2D only — the removed -s USE_WEBGPU=1 flag is no
longer attempted, with an intentional log line explaining the skip.

Also add buildCanvasConfiguration unit tests and align cpp/README.md
with the actual auto port order on the pinned toolchain.

Co-authored-by: Noah Cohn <noahc42@gmail.com>
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@ford442, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 55 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4598624f-8324-4a27-8f50-74a777122d06

📥 Commits

Reviewing files that changed from the base of the PR and between 6c8ee77 and f3fa65c.

📒 Files selected for processing (4)
  • cpp/README.md
  • scripts/build-cpp.mjs
  • tests/build-cpp.test.ts
  • tests/gpu-context.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/emsdk-webgpu-hardening-623a

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ford442
ford442 marked this pull request as ready for review July 26, 2026 14:42
@ford442
ford442 merged commit d7c2ef9 into main Jul 26, 2026
5 checks passed
@ford442
ford442 deleted the cursor/emsdk-webgpu-hardening-623a branch July 26, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants