Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Impeller] Turn off Aiks bounds tracking for filtered SaveLayers. #49076

Merged
merged 1 commit into from
Dec 15, 2023

Conversation

bdero
Copy link
Member

@bdero bdero commented Dec 15, 2023

Resolves flutter/flutter#139294.

We use this bounds rect for querying the DisplayList rtree when culling. But when sub-DisplayLists are being dispatched, the DisplayList's rtree is local and doesn't incorporate parent layer filters. So sub-DisplayLists are getting culled as if no filters are being applied.

Technically our local bounds tracking in Aiks is actually correct here, but this is a quick fix to alleviate the problem. I don't know what the best longterm solution for this is.

@flar
Copy link
Contributor

flar commented Dec 15, 2023

Here is similar code in the DisplayListBuilder for reference:

// We use |resetCullRect| here because we will be accumulating bounds of

if (!accumulator()->restore(

Copy link
Contributor

@flar flar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Safe, but we should look at some more optimum solutions at some point.

// applied.
// See also: https://github.com/flutter/flutter/issues/139294
if (paint.image_filter) {
transform_stack_.back().cull_rect = std::nullopt;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another technique could be to run the current cull_rect through the filter to get a reverse bounds, as in:

/// @brief Determines the coverage of source pixels that will be needed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another optimization would be to see if the filter modifies location at all. The ColorFilterImageFilter would not need to clear the cull_rect, for instance.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's quite enough. In order to produce a correct cull rect, wouldn't we need to pass each new clip's bounds through the chain of all parent filters? Also, it would need to be forward bounds, not reverse, since the cull rect needs to expand for kernel filters.

Am I missing something?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bdero bdero merged commit ca329dd into flutter:main Dec 15, 2023
26 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 15, 2023
fluttermirroringbot pushed a commit to flutter/flutter that referenced this pull request Dec 16, 2023
…140255)

flutter/engine@6e3a048...ca329dd

2023-12-15 bdero@google.com [Impeller] Turn off Aiks bounds tracking for filtered SaveLayers. (flutter/engine#49076)
2023-12-15 skia-flutter-autoroll@skia.org Roll Skia from cf84bab13da3 to 191943f9c43e (1 revision) (flutter/engine#49105)
2023-12-15 skia-flutter-autoroll@skia.org Roll Dart SDK from e6528d1b7997 to d66f9c854db7 (1 revision) (flutter/engine#49104)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC jsimmons@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
bdero added a commit to bdero/flutter-engine that referenced this pull request Dec 18, 2023
…utter#49076)

We use this bounds rect for querying the DisplayList rtree when culling.
But when sub-DisplayLists are being dispatched, the DisplayList's rtree
is local and doesn't incorporate parent layer filters. So
sub-DisplayLists are getting culled as if no filters are being applied.

Technically our local bounds tracking in Aiks is actually correct here,
but this is a quick fix to alleviate the problem. I don't know what the
best longterm solution for this is.

(cherry picked from commit ca329dd)
bdero added a commit to bdero/flutter-engine that referenced this pull request Dec 18, 2023
…utter#49076)

We use this bounds rect for querying the DisplayList rtree when culling.
But when sub-DisplayLists are being dispatched, the DisplayList's rtree
is local and doesn't incorporate parent layer filters. So
sub-DisplayLists are getting culled as if no filters are being applied.

Technically our local bounds tracking in Aiks is actually correct here,
but this is a quick fix to alleviate the problem. I don't know what the
best longterm solution for this is.

(cherry picked from commit ca329dd)
bryanoltman added a commit to shorebirdtech/engine that referenced this pull request Jan 2, 2024
* [CP] Fix _availability_version_check for iOS 11 and 12 (flutter#48926)

CP of flutter@5587d26 into 3.16 for flutter/flutter#138711.

* [CP] [Impeller] Turn off Aiks bounds tracking for filtered SaveLayers. (flutter#49198)

Cherry-pick for flutter#49076.

For issue: flutter/flutter#139294

* [CP] Fix for AnimatedOpacity affects blended color overlay render (flutter#49190)

This PR cherry-picks the following two commits:

flutter@2dbc5d2
flutter@0b0fab8

to address flutter/flutter#139571

* [cherrypick-stable]Skip unexpected events in MultiPlatformViewBackgroundForegroundScenar… (flutter#49247)

�io (flutter#48456)

Fixes flutter/flutter#138193.

Was first attempted to fix in flutter#48096, but that was not reliable since it's all asynchronous. 

-------------------------------------------

cherry pick to fix mac unopt failures on stable branch: 
https://flutter-dashboard.appspot.com/#/build?repo=engine&branch=flutter-3.16-candidate.0

---------

Co-authored-by: Zachary Anderson <zanderso@users.noreply.github.com>
Co-authored-by: Brandon DeRosier <bdero@google.com>
Co-authored-by: Xilai Zhang <xilaizhang@google.com>
DenisovAV pushed a commit to DenisovAV/flutter-tvos-engine that referenced this pull request May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[Impeller] ImageFiltered flickers when widget is rendered on top
2 participants