-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
From #33079:
Based on guidance from the Skia team, the Metal backend is ready for integration into Flutter. This is a meta-bug listing the various tasks that need to be undertaken for the switch to be completed.
The Skia Metal backend is currently only available on iOS versions 11.0 and above. It is unlikely that the minimum supported version will be lowered all the way down to 8.0 (the current minimum supported by Flutter). The recommended approach is to compile both the OpenGL and Metal backends in the iOS engine and use runtime checks to only use the Metal backend on versions 11.0 and above. OpenGL will still be used on older iOS versions till support for the same persists.
Tasks
Tracked on this project board but the major ones are:
- Add the
enable-metalGN flag to existing builds of the iOS engine and re-baseline benchmarks that measure binary size. Binary sizes are expected to regress by around 220 Kbytes uncompressed. - Enable the Metal backend on iOS versions 11.0 and above.
- Add an
enable-metalshell flag that allows overriding the rendering backend to use without needing version checks. Duplicate all existing benchmarks to run the same with the Metal backend in addition to the OpenGL backend. - Ensure plugins that that provide pixel buffers to to the engine for inline composition have the appropriate compatibility flags set.
- Ensure platform views are wired up.
References:
- Notice of OpenGL deprecation on iOS: https://developer.apple.com/ios/whats-new/
- Notice of OpenGL deprecation on Mac: https://developer.apple.com/macos/whats-new/
- Related Flutter issues: ☂️ Switch to Metal for macOS shell #32569, Flutter should use Metal instead of OpenGL on iOS #18208
This is really a Skia bug, but tracking it here since we've gotten a flood of questions about this after Apple's announcement this week of deprecating OpenGL.
My understanding is Skia has an experimental Metal backend, but it would take some work to bring it to production ready.
Skia also already has a Vulkan backend which Flutter uses on Fuchsia, and has historically used on some Android phones (and could use again if there was demand -- it was recently disabled due to lack of demand).
Another advantage of moving to Metal sooner rather than later is that I'm told that Apple's GL drivers appear to be less maintained than they used to be, and Flutter/Skia have seen a resulting up-tick in Apple-specific GL bugs.