mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Introduces a mechanism to allow backdrop filters to 1) share backdrop inputs and 2) fuse filter applications for faster blurs. This is a proposed solution to https://github.com/flutter/flutter/issues/131568 Implemented: * Developer can specify a "backdrop id" which indicates that a backdrop layer should share the input texture and potentially cached filter for a layer. * Removes second save layer for each backdrop filter * Removes save layer trace event for backdrop filter * Can fuse backdrop filters if there is more than one identical filter TBD: * Adjust heruristic to avoid applying bdf filter to entire screen Suggestions: applying a bdf should be a distinct operation from a save layer in the DL builder/dispatcher. The saveLayer implmenentation in the impeller dispatcher is super convoluted because it needs to handle both. ### Video Video starts with normal bdf then I hot reload to specify that the bdfs share inputs/filters. This is running on a pixel 8 pro Change to the macrobenchmark app is just: ```dart Widget build(BuildContext context) { Widget addBlur(Widget child, bool shouldBlur) { if (shouldBlur) { return ClipRect( child: BackdropFilter( filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5), backdropId: 1, // Added ID child: child, ), ); } else { return child; } } ``` https://github.com/user-attachments/assets/22707f97-5825-43f1-91b4-1a02a43437f5 Requires framework changes in https://github.com/jonahwilliams/flutter/pull/new/backdrop_id
Flow
Flow is a simple compositor based on Skia that the Flutter engine uses to cache recorded paint commands and pixels generated from those recordings. Flow runs on the raster thread and uploads information to Skia.