Repository navigation
Makes backdrop groups operate on the union. - #191838
Conversation
There was a problem hiding this comment.
Code Review
This pull request optimizes backdrop filter rendering in Impeller by tracking the coverage union of grouped backdrop filters sharing a backdrop ID and using it as a coverage limit during snapshot rendering, preventing unnecessary full-canvas texture allocations. Feedback recommends addressing an edge case where completely clipped-out filters could lead to unbounded rendering, and suggests refactoring duplicate clipping logic in FirstPassDispatcher into a shared helper method.
| auto new_cull_rect = cull_rect_state.back().Intersection(global_rect); | ||
| cull_rect_state.back() = new_cull_rect.value_or(Rect::MakeLTRB(0, 0, 0, 0)); |
There was a problem hiding this comment.
This can also be simplified with IntersectionOrEmpty
| std::shared_ptr<flutter::DlImageFilter> shared_backdrop = | ||
| backdrop->shared(); | ||
| Rect layer_coverage = cull_rect_state_.back(); | ||
| if (!bounds.IsEmpty() && !bounds.IsMaximum()) { |
There was a problem hiding this comment.
Is this IsEmpty check correct? If an empty bounds is passed in it's ignored here, but should it end up setting layer_coverage = empty instead?
From
, it seems we get an empty bounds by default if no bounds is passed in. If we want to distinguish this case, we could check whetheroptions.fBoundsFromCaller is set.
There was a problem hiding this comment.
Yea, I think this is correct. It's kind of gnarly but we don't have the semantic information here to decide if empty means everything or nothing. fBoundsFromCaller isn't sufficient. It's best to keep empty meaning everything for consistency. I'd hope empty save layers would be filtered out at a higher level anyway.
There was a problem hiding this comment.
Okay, I went back and looked at this. When considering FirstPassDispatcher on it's own we don't have the semantic information. When we consider how it's actually used we can figure it out with fBoundsFromCaller like bluk suggested. This looks better when asserting things from a unit test perspective. Sorry it took a minute to address, this PR was in some cursed CI state.
|
autosubmit label was removed for flutter/flutter/191838, because - The status or check suite Mac_arm64_verify_binaries has failed. Please fix the issues identified (or deflake) before re-applying this label. |
|
autosubmit label was removed for flutter/flutter/191838, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label. |
|
Oops. I added that unit test to address benson's feedback then backed out of the change and instead relied on the higher level catching it. Let me take one more look at it, because written in those terms it looks really wrong. |
| if (options.bounds_from_caller()) { | ||
| if (!bounds.IsMaximum()) { | ||
| layer_coverage = | ||
| layer_coverage.IntersectionOrEmpty(bounds.TransformBounds(matrix_)); | ||
| } | ||
| } else { | ||
| if (!bounds.IsEmpty() && !bounds.IsMaximum()) { | ||
| layer_coverage = | ||
| layer_coverage.IntersectionOrEmpty(bounds.TransformBounds(matrix_)); | ||
| } |
There was a problem hiding this comment.
Maybe simplify to something like:
if (!bounds.IsMaximum() && (!bounds.IsEmpty() || options.bounds_from_caller())) {
layer_coverage =
layer_coverage.IntersectionOrEmpty(bounds.TransformBounds(matrix_));
}| cull_rect_state_.back() = Rect::MakeMaximum(); | ||
| } else { | ||
| } else if (options.bounds_from_caller() || | ||
| (!bounds.IsEmpty() && !bounds.IsMaximum())) { |
There was a problem hiding this comment.
Should this check match the
!bounds.IsMaximum() && (!bounds.IsEmpty() || options.bounds_from_caller())
check above for layer_coverage?
Right now they are different for the bounds_from_caller() && bounds.IsMaximum() case. The above check won't pass, but this check will pass (and it will try to transform a maximum bounds, which I don't think we want to do).
There was a problem hiding this comment.
Yea, I saw that but had a hard time thinking about what would cause an actual problem and the tests passed. I've fixed this and added a unit test for it. I'm not sure if these inputs are ever used but better safe than sorry.
| cull_rect_state_.push_back(cull_rect_state_.back()); | ||
| } | ||
|
|
||
| void FirstPassDispatcher::saveLayer(const DlRect& bounds, |
There was a problem hiding this comment.
Non-blocking suggestion: The sheer amount of sequential and nested if/else blocks makes it hard to follow what this function does. Can this be simplified or broken up? It could be broken up into separate functions, and/or just with line breaks and comments describing what each portion of the code is doing. I think this would be a big help to anyone trying to read this code in the future.
There was a problem hiding this comment.
I pulled out a helper function. I think that clears things up a bit.
There was a problem hiding this comment.
Thanks! This plus the other simplifications in a8705cc helps a lot for readability
|
autosubmit label was removed for flutter/flutter/191838, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label. |
|
autosubmit label was removed for flutter/flutter/191838, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label. |
|
Hmm still getting some non-sequitur failures |
|
#192196 has landed, lets give this another go |
…12760) Manual roll Flutter from 70797e15325e to 5a6cfa7f3d26 (52 revisions) Manual roll requested by [email protected] flutter/flutter@70797e1...5a6cfa7 2026-09-04 [email protected] [tool] Migrate ScreenshotCommand to modular dependency injection (flutter/flutter#190767) 2026-09-04 [email protected] Roll Skia from 8fce167bdded to 93ac1e630d1d (3 revisions) (flutter/flutter#192306) 2026-09-04 [email protected] Add iOS Universal Link integration test (Simulator) (flutter/flutter#191443) 2026-09-04 [email protected] [AGP 9.1.0 Migration #5] Delete getLegacyAndroidExtension and migrate NDK fallback to public DSL (flutter/flutter#192116) 2026-09-04 [email protected] Reland "[tool_tests] Remove bringup from Windows tool_tests_commands_2_2" (#191732) (flutter/flutter#191802) 2026-09-04 [email protected] [flutter_tools] Fix unhandled DebugAdapterException on early process termination (flutter/flutter#192294) 2026-09-04 [email protected] Roll Packages from f9b3954 to 9af9c60 (4 revisions) (flutter/flutter#192292) 2026-09-04 [email protected] Roll Skia from 2e3f7e07eee6 to 8fce167bdded (5 revisions) (flutter/flutter#192283) 2026-09-04 [email protected] Roll Fuchsia Linux SDK from GTZNkoIR_WegRPWgL... to FgDQeF6jb1dVRVh3K... (flutter/flutter#192276) 2026-09-04 [email protected] Roll Skia from b6b00df360e5 to 2e3f7e07eee6 (2 revisions) (flutter/flutter#192275) 2026-09-04 [email protected] [iOS] TextField should support typing accented words with external keyboard (flutter/flutter#191062) 2026-09-04 [email protected] Roll Skia from 1f68c0b16f17 to b6b00df360e5 (7 revisions) (flutter/flutter#192269) 2026-09-04 [email protected] [flutter_tools] add typed enum and defaulted option descriptors (flutter/flutter#191760) 2026-09-04 [email protected] Roll Dart SDK from c2edc382a4f8 to 5501d02b583d (1 revision) (flutter/flutter#192263) 2026-09-04 [email protected] [Linux] Use fences to synchronize frames between OpenGL contexts (flutter/flutter#192098) 2026-09-03 [email protected] Defer semantics geometry updates for blocked branches (flutter/flutter#192146) 2026-09-03 [email protected] Roll Skia from 8d3e197531c6 to 1f68c0b16f17 (8 revisions) (flutter/flutter#192244) 2026-09-03 [email protected] Fix DeleteSurrounding splitting UTF-16 surrogate pairs (flutter/flutter#190514) 2026-09-03 [email protected] Remove no-shuffle from progress indicator test (flutter/flutter#186655) 2026-09-03 [email protected] [material] Remove unused parameters from constructors of generic test class (flutter/flutter#191764) 2026-09-03 [email protected] Handle linear and radial gradients in UberSDF (re-implement after fix) (flutter/flutter#192124) 2026-09-03 [email protected] Roll Dart SDK from fcbfb64f42a1 to c2edc382a4f8 (2 revisions) (flutter/flutter#192240) 2026-09-03 [email protected] Fix parsing of --enable-hcpp-and-surface-control switch and add --no-enable-hcpp tests (flutter/flutter#192202) 2026-09-03 [email protected] Fix issue where shapes rendered with gradient+blur+rotation end up incorrectly cut off (flutter/flutter#192136) 2026-09-03 [email protected] Fix sibling nodes crash under MergeSemantics (flutter/flutter#191587) 2026-09-03 [email protected] Makes backdrop groups operate on the union. (flutter/flutter#191838) 2026-09-03 [email protected] Roll Skia from 008936396810 to 8d3e197531c6 (1 revision) (flutter/flutter#192236) 2026-09-03 [email protected] [docs] Remove superseded AI rules for Flutter (flutter/flutter#192185) 2026-09-03 [email protected] Collect analytics about SwiftPM errors and warnings (flutter/flutter#191746) 2026-09-03 [email protected] Roll Packages from 18fe786 to f9b3954 (7 revisions) (flutter/flutter#192235) 2026-09-03 [email protected] [Linux] Remove frame sharing between OpenGL contexts (flutter/flutter#192150) 2026-09-03 [email protected] Roll Dart SDK from cf79067a1e44 to fcbfb64f42a1 (1 revision) (flutter/flutter#192228) 2026-09-03 [email protected] Roll Skia from 731fe9af4c0b to 008936396810 (3 revisions) (flutter/flutter#192225) 2026-09-03 [email protected] Roll Dart SDK from 700ab60bfe53 to cf79067a1e44 (2 revisions) (flutter/flutter#192219) 2026-09-03 [email protected] Roll Skia from 823f82e18177 to 731fe9af4c0b (5 revisions) (flutter/flutter#192217) 2026-09-03 [email protected] Fixes OverlayPortal semantics bounds corruption (flutter/flutter#192139) 2026-09-03 [email protected] Roll Fuchsia Linux SDK from idslm9FikVLy2K_A-... to GTZNkoIR_WegRPWgL... (flutter/flutter#192215) 2026-09-03 [email protected] Roll Fuchsia Test Scripts from u_fSMsPU22VvUsvSo... to VObjlh3xw2P9sEbC_... (flutter/flutter#192212) 2026-09-03 [email protected] Roll Skia from ae22da2e8308 to 823f82e18177 (13 revisions) (flutter/flutter#192209) 2026-09-02 [email protected] Expose skipTraversal in FocusableActionDetector (flutter/flutter#191308) 2026-09-02 [email protected] Add `IsProgram` mock method to `MockGLESImpl`, use it in `BufferBindingsGLESTest` (flutter/flutter#192196) 2026-09-02 [email protected] Fix nested scroll view fling crash (flutter/flutter#191130) 2026-09-02 [email protected] Fix TabBarView/PageView edge auto-scroll during mouse text selection (flutter/flutter#189544) 2026-09-02 [email protected] Bypass gamma correction when alpha >= 1.0 (flutter/flutter#192193) ...
…lutter#12760) Manual roll Flutter from 70797e15325e to 5a6cfa7f3d26 (52 revisions) Manual roll requested by [email protected] flutter/flutter@70797e1...5a6cfa7 2026-09-04 [email protected] [tool] Migrate ScreenshotCommand to modular dependency injection (flutter/flutter#190767) 2026-09-04 [email protected] Roll Skia from 8fce167bdded to 93ac1e630d1d (3 revisions) (flutter/flutter#192306) 2026-09-04 [email protected] Add iOS Universal Link integration test (Simulator) (flutter/flutter#191443) 2026-09-04 [email protected] [AGP 9.1.0 Migration flutter#5] Delete getLegacyAndroidExtension and migrate NDK fallback to public DSL (flutter/flutter#192116) 2026-09-04 [email protected] Reland "[tool_tests] Remove bringup from Windows tool_tests_commands_2_2" (#191732) (flutter/flutter#191802) 2026-09-04 [email protected] [flutter_tools] Fix unhandled DebugAdapterException on early process termination (flutter/flutter#192294) 2026-09-04 [email protected] Roll Packages from f9b3954 to 9af9c60 (4 revisions) (flutter/flutter#192292) 2026-09-04 [email protected] Roll Skia from 2e3f7e07eee6 to 8fce167bdded (5 revisions) (flutter/flutter#192283) 2026-09-04 [email protected] Roll Fuchsia Linux SDK from GTZNkoIR_WegRPWgL... to FgDQeF6jb1dVRVh3K... (flutter/flutter#192276) 2026-09-04 [email protected] Roll Skia from b6b00df360e5 to 2e3f7e07eee6 (2 revisions) (flutter/flutter#192275) 2026-09-04 [email protected] [iOS] TextField should support typing accented words with external keyboard (flutter/flutter#191062) 2026-09-04 [email protected] Roll Skia from 1f68c0b16f17 to b6b00df360e5 (7 revisions) (flutter/flutter#192269) 2026-09-04 [email protected] [flutter_tools] add typed enum and defaulted option descriptors (flutter/flutter#191760) 2026-09-04 [email protected] Roll Dart SDK from c2edc382a4f8 to 5501d02b583d (1 revision) (flutter/flutter#192263) 2026-09-04 [email protected] [Linux] Use fences to synchronize frames between OpenGL contexts (flutter/flutter#192098) 2026-09-03 [email protected] Defer semantics geometry updates for blocked branches (flutter/flutter#192146) 2026-09-03 [email protected] Roll Skia from 8d3e197531c6 to 1f68c0b16f17 (8 revisions) (flutter/flutter#192244) 2026-09-03 [email protected] Fix DeleteSurrounding splitting UTF-16 surrogate pairs (flutter/flutter#190514) 2026-09-03 [email protected] Remove no-shuffle from progress indicator test (flutter/flutter#186655) 2026-09-03 [email protected] [material] Remove unused parameters from constructors of generic test class (flutter/flutter#191764) 2026-09-03 [email protected] Handle linear and radial gradients in UberSDF (re-implement after fix) (flutter/flutter#192124) 2026-09-03 [email protected] Roll Dart SDK from fcbfb64f42a1 to c2edc382a4f8 (2 revisions) (flutter/flutter#192240) 2026-09-03 [email protected] Fix parsing of --enable-hcpp-and-surface-control switch and add --no-enable-hcpp tests (flutter/flutter#192202) 2026-09-03 [email protected] Fix issue where shapes rendered with gradient+blur+rotation end up incorrectly cut off (flutter/flutter#192136) 2026-09-03 [email protected] Fix sibling nodes crash under MergeSemantics (flutter/flutter#191587) 2026-09-03 [email protected] Makes backdrop groups operate on the union. (flutter/flutter#191838) 2026-09-03 [email protected] Roll Skia from 008936396810 to 8d3e197531c6 (1 revision) (flutter/flutter#192236) 2026-09-03 [email protected] [docs] Remove superseded AI rules for Flutter (flutter/flutter#192185) 2026-09-03 [email protected] Collect analytics about SwiftPM errors and warnings (flutter/flutter#191746) 2026-09-03 [email protected] Roll Packages from 18fe786 to f9b3954 (7 revisions) (flutter/flutter#192235) 2026-09-03 [email protected] [Linux] Remove frame sharing between OpenGL contexts (flutter/flutter#192150) 2026-09-03 [email protected] Roll Dart SDK from cf79067a1e44 to fcbfb64f42a1 (1 revision) (flutter/flutter#192228) 2026-09-03 [email protected] Roll Skia from 731fe9af4c0b to 008936396810 (3 revisions) (flutter/flutter#192225) 2026-09-03 [email protected] Roll Dart SDK from 700ab60bfe53 to cf79067a1e44 (2 revisions) (flutter/flutter#192219) 2026-09-03 [email protected] Roll Skia from 823f82e18177 to 731fe9af4c0b (5 revisions) (flutter/flutter#192217) 2026-09-03 [email protected] Fixes OverlayPortal semantics bounds corruption (flutter/flutter#192139) 2026-09-03 [email protected] Roll Fuchsia Linux SDK from idslm9FikVLy2K_A-... to GTZNkoIR_WegRPWgL... (flutter/flutter#192215) 2026-09-03 [email protected] Roll Fuchsia Test Scripts from u_fSMsPU22VvUsvSo... to VObjlh3xw2P9sEbC_... (flutter/flutter#192212) 2026-09-03 [email protected] Roll Skia from ae22da2e8308 to 823f82e18177 (13 revisions) (flutter/flutter#192209) 2026-09-02 [email protected] Expose skipTraversal in FocusableActionDetector (flutter/flutter#191308) 2026-09-02 [email protected] Add `IsProgram` mock method to `MockGLESImpl`, use it in `BufferBindingsGLESTest` (flutter/flutter#192196) 2026-09-02 [email protected] Fix nested scroll view fling crash (flutter/flutter#191130) 2026-09-02 [email protected] Fix TabBarView/PageView edge auto-scroll during mouse text selection (flutter/flutter#189544) 2026-09-02 [email protected] Bypass gamma correction when alpha >= 1.0 (flutter/flutter#192193) ...
…lutter#12760) Manual roll Flutter from 70797e15325e to 5a6cfa7f3d26 (52 revisions) Manual roll requested by [email protected] flutter/flutter@70797e1...5a6cfa7 2026-09-04 [email protected] [tool] Migrate ScreenshotCommand to modular dependency injection (flutter/flutter#190767) 2026-09-04 [email protected] Roll Skia from 8fce167bdded to 93ac1e630d1d (3 revisions) (flutter/flutter#192306) 2026-09-04 [email protected] Add iOS Universal Link integration test (Simulator) (flutter/flutter#191443) 2026-09-04 [email protected] [AGP 9.1.0 Migration flutter#5] Delete getLegacyAndroidExtension and migrate NDK fallback to public DSL (flutter/flutter#192116) 2026-09-04 [email protected] Reland "[tool_tests] Remove bringup from Windows tool_tests_commands_2_2" (#191732) (flutter/flutter#191802) 2026-09-04 [email protected] [flutter_tools] Fix unhandled DebugAdapterException on early process termination (flutter/flutter#192294) 2026-09-04 [email protected] Roll Packages from f9b3954 to 9af9c60 (4 revisions) (flutter/flutter#192292) 2026-09-04 [email protected] Roll Skia from 2e3f7e07eee6 to 8fce167bdded (5 revisions) (flutter/flutter#192283) 2026-09-04 [email protected] Roll Fuchsia Linux SDK from GTZNkoIR_WegRPWgL... to FgDQeF6jb1dVRVh3K... (flutter/flutter#192276) 2026-09-04 [email protected] Roll Skia from b6b00df360e5 to 2e3f7e07eee6 (2 revisions) (flutter/flutter#192275) 2026-09-04 [email protected] [iOS] TextField should support typing accented words with external keyboard (flutter/flutter#191062) 2026-09-04 [email protected] Roll Skia from 1f68c0b16f17 to b6b00df360e5 (7 revisions) (flutter/flutter#192269) 2026-09-04 [email protected] [flutter_tools] add typed enum and defaulted option descriptors (flutter/flutter#191760) 2026-09-04 [email protected] Roll Dart SDK from c2edc382a4f8 to 5501d02b583d (1 revision) (flutter/flutter#192263) 2026-09-04 [email protected] [Linux] Use fences to synchronize frames between OpenGL contexts (flutter/flutter#192098) 2026-09-03 [email protected] Defer semantics geometry updates for blocked branches (flutter/flutter#192146) 2026-09-03 [email protected] Roll Skia from 8d3e197531c6 to 1f68c0b16f17 (8 revisions) (flutter/flutter#192244) 2026-09-03 [email protected] Fix DeleteSurrounding splitting UTF-16 surrogate pairs (flutter/flutter#190514) 2026-09-03 [email protected] Remove no-shuffle from progress indicator test (flutter/flutter#186655) 2026-09-03 [email protected] [material] Remove unused parameters from constructors of generic test class (flutter/flutter#191764) 2026-09-03 [email protected] Handle linear and radial gradients in UberSDF (re-implement after fix) (flutter/flutter#192124) 2026-09-03 [email protected] Roll Dart SDK from fcbfb64f42a1 to c2edc382a4f8 (2 revisions) (flutter/flutter#192240) 2026-09-03 [email protected] Fix parsing of --enable-hcpp-and-surface-control switch and add --no-enable-hcpp tests (flutter/flutter#192202) 2026-09-03 [email protected] Fix issue where shapes rendered with gradient+blur+rotation end up incorrectly cut off (flutter/flutter#192136) 2026-09-03 [email protected] Fix sibling nodes crash under MergeSemantics (flutter/flutter#191587) 2026-09-03 [email protected] Makes backdrop groups operate on the union. (flutter/flutter#191838) 2026-09-03 [email protected] Roll Skia from 008936396810 to 8d3e197531c6 (1 revision) (flutter/flutter#192236) 2026-09-03 [email protected] [docs] Remove superseded AI rules for Flutter (flutter/flutter#192185) 2026-09-03 [email protected] Collect analytics about SwiftPM errors and warnings (flutter/flutter#191746) 2026-09-03 [email protected] Roll Packages from 18fe786 to f9b3954 (7 revisions) (flutter/flutter#192235) 2026-09-03 [email protected] [Linux] Remove frame sharing between OpenGL contexts (flutter/flutter#192150) 2026-09-03 [email protected] Roll Dart SDK from cf79067a1e44 to fcbfb64f42a1 (1 revision) (flutter/flutter#192228) 2026-09-03 [email protected] Roll Skia from 731fe9af4c0b to 008936396810 (3 revisions) (flutter/flutter#192225) 2026-09-03 [email protected] Roll Dart SDK from 700ab60bfe53 to cf79067a1e44 (2 revisions) (flutter/flutter#192219) 2026-09-03 [email protected] Roll Skia from 823f82e18177 to 731fe9af4c0b (5 revisions) (flutter/flutter#192217) 2026-09-03 [email protected] Fixes OverlayPortal semantics bounds corruption (flutter/flutter#192139) 2026-09-03 [email protected] Roll Fuchsia Linux SDK from idslm9FikVLy2K_A-... to GTZNkoIR_WegRPWgL... (flutter/flutter#192215) 2026-09-03 [email protected] Roll Fuchsia Test Scripts from u_fSMsPU22VvUsvSo... to VObjlh3xw2P9sEbC_... (flutter/flutter#192212) 2026-09-03 [email protected] Roll Skia from ae22da2e8308 to 823f82e18177 (13 revisions) (flutter/flutter#192209) 2026-09-02 [email protected] Expose skipTraversal in FocusableActionDetector (flutter/flutter#191308) 2026-09-02 [email protected] Add `IsProgram` mock method to `MockGLESImpl`, use it in `BufferBindingsGLESTest` (flutter/flutter#192196) 2026-09-02 [email protected] Fix nested scroll view fling crash (flutter/flutter#191130) 2026-09-02 [email protected] Fix TabBarView/PageView edge auto-scroll during mouse text selection (flutter/flutter#189544) 2026-09-02 [email protected] Bypass gamma correction when alpha >= 1.0 (flutter/flutter#192193) ...
fixes #157110
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.