Repository navigation
[web] retain GL/Gr context on window resize - #38576
auto-submit[bot] merged 11 commits into
Conversation
|
mostly LGTM but we should probably touch this class up now that we should be a one-to-one relationship between Surface and HTML Canvas (whereas before one Surface could have many HTML canvases over its lifetime) so things like |
|
It also seems like we can keep using the same CkSurface as long as the canvas size didn't change |
|
@hterkelsen this is (mostly) updated now. It seems like we do need to create new CkSurfaces whenever the size of the underlying canvas changes, so we can still have multiple CkSurfaces. If we can fix the lookup of the GlParameters on surface creation this will be significantly faster too |
|
Looks like we do need to recreate the surface, filled flutter/flutter#117934 as a follow up |
|
Thanks! |
* b9a7234 [web] retain GL/Gr context on window resize (flutter-team-archive/engine#38576) * fd43606 Add SpringAnimation.js from React Native (flutter-team-archive/engine#38750) * 53bd4bb Roll Skia from b8c0a78a2378 to e1f3980272f3 (24 revisions) (flutter-team-archive/engine#38758)
…8289) * b9a7234 [web] retain GL/Gr context on window resize (flutter-team-archive/engine#38576) * fd43606 Add SpringAnimation.js from React Native (flutter-team-archive/engine#38750) * 53bd4bb Roll Skia from b8c0a78a2378 to e1f3980272f3 (24 revisions) (flutter-team-archive/engine#38758)




The current implementation of the canvaskit renderer abandons the current gl context and creates a new one when resizing the window. This is an expensive operation, and causes the loss of all GPU backed textures associated with the previous context. At least part of the issue in flutter/flutter#117786 is due to using a separate context, which I think is due partially to needing to deal with this on resize.
I don't think this should be necessary, its fairly straightforward to resize a canvas using webgl/webgl2 (see https://webgl2fundamentals.org/webgl/lessons/webgl-resizing-the-canvas.html ). If we're missing APIs in Skia/Canvaskit then we should get those added instead of working around the problem.
Fixes flutter/flutter#117803