Repository navigation
[web] Isolate SkwasmRenderer.pictureToImageSurface from rasterizer offscreenSurface - #192770
Closed
harryterkelsen wants to merge 4 commits into
Closed
harryterkelsen wants to merge 4 commits into
harryterkelsen wants to merge 4 commits into
Conversation
…ce for issue-182476-skwasm
|
This pull request targets the Please change the base branch of this pull request to |
bdero
pushed a commit
to bdero/flutter_scene
that referenced
this pull request
Sep 19, 2026
On the web, a glTF texture went browser decode -> ui.Image -> Image.toByteData -> CPU mip chain -> texSubImage2D per level. That read-back runs on the framework's renderer, which on skwasm clips images above 5760² (flutter/flutter#182476) and races with frame rendering (flutter/flutter#192770), and the whole path blocks the main thread. createImageBitmap + texSubImage2D + generateMipmap never leaves the backend's WebGL context. Normal maps keep the CPU chain. Other backends return null and decode through dart:ui as before. Node.fromGlbBytes gains maxTextureSize, honoured on every backend.
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.
Description
In Skwasm,
SkwasmRenderer.pictureToImageSurfacedirectly aliased(rasterizer as OffscreenCanvasRasterizer).offscreenSurface. When asynchronousPicture.toImage()ortoByteData()calls ran concurrently with active view rendering (renderScene), viewport dimensions and rendering contexts contended, causing image exports to be corrupted or stomped by window dimensions.This PR decouples
pictureToImageSurfaceinSkwasmRendererto a dedicatedSurfacecreated viarasterizer.createPictureToImageSurface(), restoring architectural parity withCanvasKitRenderer. It also adds unit and adversarial lifecycle stress tests verifying isolation and reset semantics.Fixes part of #182476
Pre-launch Checklist
///).