Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@gaaclarke
Copy link
Member

@gaaclarke gaaclarke commented Jun 25, 2024

This should be no functional change, just makes the case of clipped backdrop filters take up less memory.

fixes: flutter/flutter#150713

test coverage:

  • the framework's "backdrop filter" test
  • GaussianBlurAnimatedBackdrop

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@gaaclarke
Copy link
Member Author

This doesn't have a huge impact on FPS, but it does on memory usage.

before

after

@gaaclarke
Copy link
Member Author

gaaclarke commented Jun 25, 2024

Also worth noting: this isn't good to land yet because it introduces shimmering in animation. I think we may be able to eliminate that by adding padding to make sure that when downsampling we end up with integer size. That would require us to modify the source_expanded_coverage_hint in CalculateDownsamplePassArgs.

@jonahwilliams
Copy link
Contributor

This is using about a quarter of the memory as ToT

ToT

image

Patched

image

@gaaclarke
Copy link
Member Author

This breaks image filters currently. I gotta go back and see what happened there.

@gaaclarke
Copy link
Member Author

I fixed the image filter by adding a branch for handling backdrop image filters differently, keeping the old math for image filters since they are already cropped.

There are quite a few blur changes from the pixel alignment changes which are fine. Here are the ones that look broken. I think this has to do with matrix not being correct yet for the backdrop filter flow and the blur styles not taking the new math into account:
Screenshot 2024-06-26 at 10 46 48 AM
Screenshot 2024-06-26 at 10 47 38 AM
Screenshot 2024-06-26 at 10 48 03 AM
Screenshot 2024-06-26 at 10 48 17 AM

@gaaclarke gaaclarke marked this pull request as ready for review June 26, 2024 19:55
@gaaclarke gaaclarke requested review from bdero and jonahwilliams June 26, 2024 20:07
#include "impeller/renderer/render_pass.h"
#include "impeller/renderer/vertex_buffer_builder.h"

#pragma GCC diagnostic ignored "-Wunused-function"
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove

Copy link
Member Author

Choose a reason for hiding this comment

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

done

ISize source_size = ISize(aligned_coverage_hint.GetSize().width,
aligned_coverage_hint.GetSize().height);
Vector2 downsampled_size = source_size * downsample_scalar;
Scalar int_part;
Copy link
Contributor

Choose a reason for hiding this comment

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

You can also add [[maybe_unused]]

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 think I did that in the past and the compiler for fuchsia or windows didn't care =T

Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

LGTM!!!!!!!!

@flutter-dashboard
Copy link

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

Changes reported for pull request #53562 at sha e6d3ffe

Copy link
Member

@bdero bdero left a comment

Choose a reason for hiding this comment

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

The restrictions on applying the coverage hint LGTM!

// coverage hint that fits inside of the snapshots coverage that means the
// coverage hint was ignored so we will trim out the area we are interested
// in the down-sample pass. This usually means we have a backdrop image
// filter.
Copy link
Member

Choose a reason for hiding this comment

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

Ah, the described behavior happens whenever there's a Texture filter input, right? Makes sense that we need to do some extra work to apply the coverage hint for backdrop filters here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, the described behavior happens whenever there's a Texture filter input, right?

Yep, exactly.

@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 26, 2024
@auto-submit auto-submit bot merged commit 7f81e71 into flutter:main Jun 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 26, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jun 27, 2024
…150888)

flutter/engine@1d5e3cc...a9194f0

2024-06-26 [email protected] Roll Skia from 173ee0af82c9 to 55ada83438cd (3 revisions) (flutter/engine#53596)
2024-06-26 [email protected] Return a null image from ImageExternalTextureGL::CreateEGLImage if an EGL display is not available (flutter/engine#53594)
2024-06-26 [email protected] [Impeller] blur - cropped the downsample pass for backdrop filters (flutter/engine#53562)
2024-06-26 [email protected] Roll Skia from 0a979d9f3606 to 173ee0af82c9 (2 revisions) (flutter/engine#53593)
2024-06-26 [email protected] Remove otherwise unused third_party/web_dependencies. (flutter/engine#53588)
2024-06-26 [email protected] Copy `flutter/flutter/docs/engine` to `flutter/engine/docs` as-is (no changes) (flutter/engine#53595)
2024-06-26 [email protected] Roll Dart SDK from 38bb74f63829 to c01f907d34d8 (5 revisions) (flutter/engine#53585)

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 [email protected],[email protected],[email protected] 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
@gaaclarke
Copy link
Member Author

Hmm, there was no change in our benchmark: https://flutter-flutter-perf.skia.org/e/?keys=X6db42c30be541ffea6a232432d0e198b

That's odd since we see something completely different in local testing.

@jonahwilliams
Copy link
Contributor

That metric does not measure GPU memory FYI

@gaaclarke
Copy link
Member Author

That metric does not measure GPU memory FYI

My local testing is showing 1/2 (500MB->250MB) memory size and 1/5 gpu (250MB->50MB) memory above. So I would expect some change.

@jonahwilliams
Copy link
Contributor

Its only capturing some portion of the overall heal though, Is your first number Host + GPU memory? I wouldn't but too much stock in it, we have the local numbers that are easily reproducible.

@jonahwilliams
Copy link
Contributor

*heap

@jonahwilliams
Copy link
Contributor

*but -> put

Man I can't spell today

@gaaclarke
Copy link
Member Author

Ugh, yea it's just frustrating. I just verified it locally and I'll file an issue. Those probes seem bogus.

@gaaclarke
Copy link
Member Author

filed issue here: flutter/flutter#150936

@jonahwilliams
Copy link
Contributor

victorsanni pushed a commit to victorsanni/flutter that referenced this pull request Jul 8, 2024
…lutter#150888)

flutter/engine@1d5e3cc...a9194f0

2024-06-26 [email protected] Roll Skia from 173ee0af82c9 to 55ada83438cd (3 revisions) (flutter/engine#53596)
2024-06-26 [email protected] Return a null image from ImageExternalTextureGL::CreateEGLImage if an EGL display is not available (flutter/engine#53594)
2024-06-26 [email protected] [Impeller] blur - cropped the downsample pass for backdrop filters (flutter/engine#53562)
2024-06-26 [email protected] Roll Skia from 0a979d9f3606 to 173ee0af82c9 (2 revisions) (flutter/engine#53593)
2024-06-26 [email protected] Remove otherwise unused third_party/web_dependencies. (flutter/engine#53588)
2024-06-26 [email protected] Copy `flutter/flutter/docs/engine` to `flutter/engine/docs` as-is (no changes) (flutter/engine#53595)
2024-06-26 [email protected] Roll Dart SDK from 38bb74f63829 to c01f907d34d8 (5 revisions) (flutter/engine#53585)

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 [email protected],[email protected],[email protected] 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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App e: impeller will affect goldens

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Impeller] adjust size of backdrop filter snapshot in the blur downsample pass

3 participants