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

Reland: [Impeller] Use downsample shader for blur instead of mip levels. #54149

Merged
merged 2 commits into from
Jul 30, 2024

Conversation

gaaclarke
Copy link
Member

@gaaclarke gaaclarke commented Jul 26, 2024

relands #53760
reverted in #54148

The fix for this was found with the help of Jonah.

Part of a series of gaussian blur changes:

  1. Revert "[Impeller] Use downsample shader for blur instead of mip levels. (#53760)" #54148
  2. [impeller] adds test for catching shimmer in gaussian blur #54116
  3. [Impeller] makes the gaussian down sample scalar fixed by adjusting the downsample padding #54150
  4. Reland: [Impeller] Use downsample shader for blur instead of mip levels. #54149

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.

if (pass_args.effective_scalar.x <= 0.125f) {
if (pass_args.effective_scalar.x <= 0.0625f) {
edge = 7.0;
ratio = 1.0f / 64.0f;
Copy link
Member

Choose a reason for hiding this comment

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

probably a better way of doing it...

Copy link
Member

@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

gaaclarke added a commit that referenced this pull request Jul 26, 2024
…ls. (#53760)" (#54148)

This is reverted since it introduces shimmering when the downsample
scalar goes to 1/16th. It was reverted instead of fixed to allow the
test that should have blocked this to land in the meantime.

reverts #53760
fixed and relanded in #54149

Part of a series of gaussian blur changes:
1) #54148
1) #54116
1) #54150
1) #54149

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] 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.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.

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

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
@gaaclarke gaaclarke force-pushed the reland-downsample-sahder branch from 47404e1 to 96cae3b Compare July 26, 2024 21:55
gaaclarke added a commit that referenced this pull request Jul 26, 2024
fixes flutter/flutter#152195

Part of a series of gaussian blur changes:
1) #54148
1) #54116
1) #54150
1) #54149

Note: this test won't pass until
#54148 lands.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] 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.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.

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

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
@gaaclarke gaaclarke force-pushed the reland-downsample-sahder branch from 96cae3b to ee9b90d Compare July 26, 2024 22:09
@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 26, 2024
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 26, 2024
Copy link
Contributor

auto-submit bot commented Jul 26, 2024

auto label is removed for flutter/engine/54149, due to - The status or check suite Mac mac_host_engine has failed. Please fix the issues identified (or deflake) before re-applying this label.

@gaaclarke
Copy link
Member Author

This PR is counting on #54150 to get it below the 1.0 threshold. That PR however creates some artifacts at the edges of 1D blurs. I'll look to see if we can fix that otherwise we can look into other options.

@jonahwilliams
Copy link
Member

Does this still visually look wrong even if the threshold is above 1?

@gaaclarke
Copy link
Member Author

Does this still visually look wrong even if the threshold is above 1?

Looking into it. The test passes for me locally and only should have affected sigma ranges that are not in the test. So something weird is going on.

@gaaclarke
Copy link
Member Author

I just forgot to push my fix for the 1d blur and rebase. I think we are good.

@gaaclarke gaaclarke force-pushed the reland-downsample-sahder branch 2 times, most recently from d0403fb to 633a4d9 Compare July 30, 2024 15:29
auto-submit bot pushed a commit that referenced this pull request Jul 30, 2024
…he downsample padding (#54150)

This removes jitter in the gaussian blur.

Previous version of the shimmer test show this drops the average RMSE 30%.

testing:
  - positive change shown in average RMSE in ShimmerTest
  - existing golden tests

Part of a series of gaussian blur changes:
1) #54148
1) #54116
1) #54150
1) #54149

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
@gaaclarke
Copy link
Member Author

Or more accurately, once #54150 lands this will pass.

jonahwilliams and others added 2 commits July 30, 2024 08:43
…tter#53760)

Fixes flutter/flutter#150973

On a Pixel 7 pro, this speeds up the repeated blur macrobenchmark by 20ms (~65 -> ~45). The mip computation for backdrop filters is especially wasteful, as most of the contents are unused. RIght now, we also need to continually re-generate mips every time we do a texture flip, even if there is only a single blur. This is because the mip level is a property of the texture, which gets reused in the entity pass backdrop.
@gaaclarke gaaclarke force-pushed the reland-downsample-sahder branch from 633a4d9 to 014c577 Compare July 30, 2024 15:44
@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 30, 2024
@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 #54149 at sha 014c577

@auto-submit auto-submit bot merged commit 41e4b39 into flutter:main Jul 30, 2024
34 checks passed
@gaaclarke
Copy link
Member Author

This PR coops old tests but maintains an old branch in the code for when mipmaps are used. I verified that the following tests still exercise that old branch. We might want something more apropos though to make sure that we don't get rid of testing that branch.

Play/AiksTest.BlurredRectangleWithShader/Metal
Play/AiksTest.MaskBlurVariantTestSolidTranslucentWithFilters/Metal
Play/AiksTest.MaskBlurVariantTestInnerTranslucentWithBlurImageFilter/Metal
Play/AiksTest.MaskBlurVariantTestOuterOpaqueWithBlurImageFilter/Metal
Play/AiksTest.GaussianBlurSolidColorTinyMipMap/Metal
Play/AiksTest.GaussianBlurBackdropTinyMipMap/Metal
Play/AiksTest.CanRenderEmojiTextFrameWithBlur/Metal
Play/DlGoldenTest.TextBlurMaskFilterDisrespectCTM/Metal
Play/DlGoldenTest.GaussianVsRRectBlurScaled/Metal
Play/DlGoldenTest.GaussianVsRRectBlurScaledRotated/Metal
Play/DlGoldenTest.FastVsGeneralGaussianMaskBlur/Metal

engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 30, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 30, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jul 30, 2024
…152573)

flutter/engine@31bb9f9...a6c5ff2

2024-07-30 [email protected] Roll Skia from a4d59988bde0 to c1fcf8e5a55c (1 revision) (flutter/engine#54220)
2024-07-30 [email protected] Reland: [Impeller] Use downsample shader for blur instead of mip levels. (flutter/engine#54149)
2024-07-30 [email protected] Roll Skia from 2cb7f5443a48 to a4d59988bde0 (1 revision) (flutter/engine#54218)
2024-07-30 [email protected] [Impeller] makes the gaussian down sample scalar fixed by adjusting the downsample padding (flutter/engine#54150)
2024-07-30 [email protected] Roll Dart SDK from ad4d2e8b2c65 to 14b51d32e3a6 (1 revision) (flutter/engine#54216)

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
TytaniumDev pushed a commit to TytaniumDev/flutter that referenced this pull request Aug 7, 2024
…lutter#152573)

flutter/engine@31bb9f9...a6c5ff2

2024-07-30 [email protected] Roll Skia from a4d59988bde0 to c1fcf8e5a55c (1 revision) (flutter/engine#54220)
2024-07-30 [email protected] Reland: [Impeller] Use downsample shader for blur instead of mip levels. (flutter/engine#54149)
2024-07-30 [email protected] Roll Skia from 2cb7f5443a48 to a4d59988bde0 (1 revision) (flutter/engine#54218)
2024-07-30 [email protected] [Impeller] makes the gaussian down sample scalar fixed by adjusting the downsample padding (flutter/engine#54150)
2024-07-30 [email protected] Roll Dart SDK from ad4d2e8b2c65 to 14b51d32e3a6 (1 revision) (flutter/engine#54216)

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
Buchimi pushed a commit to Buchimi/flutter that referenced this pull request Sep 2, 2024
…lutter#152573)

flutter/engine@31bb9f9...a6c5ff2

2024-07-30 [email protected] Roll Skia from a4d59988bde0 to c1fcf8e5a55c (1 revision) (flutter/engine#54220)
2024-07-30 [email protected] Reland: [Impeller] Use downsample shader for blur instead of mip levels. (flutter/engine#54149)
2024-07-30 [email protected] Roll Skia from 2cb7f5443a48 to a4d59988bde0 (1 revision) (flutter/engine#54218)
2024-07-30 [email protected] [Impeller] makes the gaussian down sample scalar fixed by adjusting the downsample padding (flutter/engine#54150)
2024-07-30 [email protected] Roll Dart SDK from ad4d2e8b2c65 to 14b51d32e3a6 (1 revision) (flutter/engine#54216)

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.

2 participants