Repository navigation
[web] Recreate canvas and context on CkOffscreenSurface resize to fix WebGL clipping - #192769
Conversation
|
This pull request targets the Please change the base branch of this pull request to |
…kOffscreenSurface
…OffscreenSurface on buffer clamp
There was a problem hiding this comment.
Code Review
This pull request refactors canvas resizing in CkSurface by introducing a _resizeCanvas method, with a specialized implementation in CkOffscreenSurface to handle WebGL drawing buffer clamping for large dimensions by recreating the WebGL context. It also adds corresponding unit and stress tests. The review feedback suggests optimizing the resource disposal order when releasing the old canvas, using the local newCanvas variable to prevent potential race conditions, and checking WebGL texture size limits in tests to avoid flakiness on restricted CI hardware.
…d context loss on surface resize
…bGL contexts on offscreen resize
…low, clamped bitmap capture, and post-swap context loss
Read GL_MAX_TEXTURE_SIZE through a named WebGLContext getter, reuse the base in-place resize for the software path, restore the recorded device pixel ratio along with the size when a resize fails, and document why the clamp and teardown order matter. In the tests, sample single pixels instead of reading back whole large surfaces and drop the onscreen ping-pong check, which exercised unchanged code.
…uested After replacing a clamped canvas, check the drawing buffer of the new WebGL context as well. If it still cannot hold the requested size, move the surface to a fresh canvas at its previous size and throw an UnsupportedError instead of silently rendering clipped output.
…e fallback for fresh drawing buffer check
…ter a rejected drawing buffer
|
autosubmit label was removed for flutter/flutter/192769, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
flutter/flutter@d463821...fffd8c2 2026-11-10 [email protected] Roll Fuchsia Test Scripts from 8QcsP_SmbsT09VgUs... to PXc5D7S_q6sIYpfFJ... (flutter/flutter#196273) 2026-11-10 [email protected] [web] Accept the capped letter spacing line shift in kitchensink (flutter/flutter#196148) 2026-11-10 [email protected] Fix Vulkan MSAA diagonal seam in FramebufferBlend (flutter/flutter#196197) 2026-11-10 [email protected] Read back images on the raster thread on OpenGLES (flutter/flutter#195927) 2026-11-10 [email protected] [web] Unify ui.Paint across CanvasKit and Skwasm (flutter/flutter#196071) 2026-11-10 [email protected] Roll Fuchsia Test Scripts from p3N3B-Kchh1bthB6n... to 8QcsP_SmbsT09VgUs... (flutter/flutter#196249) 2026-11-09 [email protected] [Impeller] Reland clipped BackdropFilter square corners fix (flutter/flutter#195716) 2026-11-09 [email protected] [web] Recreate canvas and context on CkOffscreenSurface resize to fix WebGL clipping (flutter/flutter#192769) 2026-11-09 [email protected] Roll Dart SDK from ee0f66fa0ad2 to a2baae273bb2 (1 revision) (flutter/flutter#196245) 2026-11-09 [email protected] Add Mac web_tool_tests_1_2 and _2_2 in bringup (flutter/flutter#196241) 2026-11-09 [email protected] Roll pub packages (flutter/flutter#196246) 2026-11-09 [email protected] Increase number of 'Windows tool_integration_tests' subshards (flutter/flutter#196243) 2026-11-09 [email protected] Roll Fuchsia Test Scripts from Jo-ZgQSNDuPsjlZ4s... to p3N3B-Kchh1bthB6n... (flutter/flutter#196238) 2026-11-09 [email protected] Skip UIScene pre-migration test cases on Xcode 27 (flutter/flutter#194755) 2026-11-09 [email protected] [flutter_tools] Share Analytics.isBot and make isRunningOnBot sync (flutter/flutter#194744) 2026-11-09 [email protected] [flutter_tools] Retry chromedriver startup when its port is taken (flutter/flutter#196150) 2026-11-09 [email protected] Remove unused vulkan_provider.cc (flutter/flutter#195513) 2026-11-09 [email protected] Roll Dart SDK from 3b174b7217fe to ee0f66fa0ad2 (13 revisions) (flutter/flutter#196217) 2026-11-09 [email protected] Goma is dead, long live RBE! (Take 2) (flutter/flutter#196212) 2026-11-09 [email protected] Split DevTools customer tests into its own customer_testing_devtools shard (flutter/flutter#195871) 2026-11-09 [email protected] Split mac_host_{debug,profile,release}_arm64_tests into one step per type (flutter/flutter#196031) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Description
Fixes part of #182476
When exporting large images via
Picture.toImage(), Chrome may silently clamp the physical WebGL drawing buffer during in-place canvas resizing, leaving pixels outside the clamped area unbacked and producing transparent strips.This PR updates
CkOffscreenSurfaceto detect when the drawing buffer is clamped on resize and acquire a fresh offscreen canvas to allocate the buffer cleanly upfront. If the requested size exceeds what the browser/GPU can support even after recreation, anUnsupportedErroris thrown rather than silently returning clipped pixels.Pre-launch Checklist
///).