This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Commit 726a137
authored
Add FlutterMetalLayer as optional alternative to CAMetalLayer (#48226)
This PR implements `FlutterMetalLayer`, a drop-in (as far as Flutter is
concerned) replacement for `CAMetalLayer`. The biggest difference is
that `FlutterMetalLayer` can present frames from background thread
within a `CATransaction`.
`FlutterMetalLayer` is disabled by default. To opt-in, add the following
item to `Info.plist`:
```xml
<key>FLTUseFlutterMetalLayer</key>
<true/>
```
The performance seems quite good, consistent 120hz on iPhone 13 Pro.
Benefits
- presenting with transaction from background thread, which, down the
line, would allow for platform views without thread merging.
- fine control over how the surface is displayed - we can display single
surface on multiple `CALayers`, each showing different part, allowing
for performant implementation of unobstructed platform views.
Drawbacks
- this not being a metal layer makes working with metal instrument tools
more awkward1 parent c5fc179 commit 726a137
File tree
8 files changed
+718
-5
lines changed- ci/licenses_golden
- impeller/renderer/backend/metal
- shell/platform/darwin/ios
- framework/Source
- testing/ios/IosUnitTests/IosUnitTests.xcodeproj
8 files changed
+718
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6626 | 6626 | | |
6627 | 6627 | | |
6628 | 6628 | | |
| 6629 | + | |
| 6630 | + | |
| 6631 | + | |
6629 | 6632 | | |
6630 | 6633 | | |
6631 | 6634 | | |
| |||
9452 | 9455 | | |
9453 | 9456 | | |
9454 | 9457 | | |
| 9458 | + | |
| 9459 | + | |
| 9460 | + | |
9455 | 9461 | | |
9456 | 9462 | | |
9457 | 9463 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
267 | | - | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
268 | 273 | | |
269 | 274 | | |
270 | 275 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
66 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
67 | 72 | | |
68 | 73 | | |
69 | 74 | | |
| |||
257 | 262 | | |
258 | 263 | | |
259 | 264 | | |
| 265 | + | |
260 | 266 | | |
261 | 267 | | |
262 | 268 | | |
| |||
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
0 commit comments