fix(🌎): avoid implicit web canvas resize - #454
Merged
wcandillon merged 2 commits intoAug 30, 2026
Merged
Conversation
Owner
|
Thanks a lot for this :) |
wcandillon
self-requested a review
August 30, 2026 09:42
wcandillon
approved these changes
Aug 30, 2026
|
🎉 This PR is included in version 0.8.5 🎉 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.
Summary
MakeWebGPUCanvasContextpathFixes #351.
Root cause
The wrapper listened to
window.resizeand changedcanvas.width/canvas.heightafter a 100 ms debounce. WebGPU canvas resizing invalidates the current texture, but renderers such as Three.js still owned depth/MSAA attachments at the previous dimensions. The next render pass therefore mixed textures of different extents and failed validation every frame.The browser regression reproduced the current issue exactly: resizing the example viewport changed the drawing buffer from 2400×1344 to 1800×744 while Three.js kept its 2400×1344 depth attachment.
Verification
mainRED: Three.js InstancedMesh emits repeated attachment-size validation warnings after a 1200×800 → 900×500 viewport resize.tsc -p packages/webgpu/tsconfig.json --noEmityarn workspace react-native-webgpu buildyarn tsc: 3/3 workspaces passgit diff --checkThe example asset hook was temporarily bypassed only for browser setup because the current web example cannot resolve its Metro asset IDs; that harness change was fully reverted and is not part of this PR.