Skip to content

chore: Implement WebGL native JS patching for 4GB memory support and add unit tests - #1063

Merged
jeromelaban merged 1 commit into
mainfrom
dev/jela/4gb-fix
Jun 5, 2026
Merged

jeromelaban merged 1 commit into
mainfrom
dev/jela/4gb-fix

Conversation

@jeromelaban

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings June 5, 2026 19:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a build-time backport for the emscripten GL_UNPACK_ROW_LENGTH WebGL fix into dotnet.native.*.js when an app opts into a 4GB WASM heap, and wires that patching into the existing MSBuild pipeline with unit coverage for the pure patching logic.

Changes:

  • Added a pure string-based patcher (WebGLNativeJsPatcher) that detects WebGL glue, applies two token replacements, and self-verifies both replacements landed.
  • Added an MSBuild task (PatchWebGLNativeJsForMaxMemoryTask_v0) and updated Uno.Wasm.Bootstrap.targets to apply the patch for both build and publish outputs (including deletion of stale .gz/.br siblings on publish when rewritten).
  • Added unit tests validating the patcher outcomes (applied / no glue / already patched / drifted / partial match).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/Uno.Wasm.Bootstrap/WebGLNativeJsPatcher.cs Implements the engine-free patch decision + transformation logic with drift detection.
src/Uno.Wasm.Bootstrap/PatchWebGLNativeJsForMaxMemoryTask.cs Adds an MSBuild task that applies the patch in-place and logs outcomes.
src/Uno.Wasm.Bootstrap/build/Uno.Wasm.Bootstrap.targets Wires the new task into build and publish targets; improves 4GB-flag detection and stale compressed file handling.
src/Uno.Wasm.Bootstrap.UnitTests/Given_PatchWebGLNativeJsForMaxMemoryTask.cs Adds tests covering the patcher’s behavior and idempotency.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

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