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] new blur: clamp downsample scalar to 1/16 #50262

Merged
merged 5 commits into from
Feb 2, 2024

Conversation

gaaclarke
Copy link
Member

@gaaclarke gaaclarke commented Feb 1, 2024

fixes flutter/flutter#142753

The theory here is that once you start throwing away more than 15/16th of the signal it's pretty noticable. By looking at the blur under different circumstances that seems like a reasonable limit.

There is no automated test for this. Doing so would be quite involved and would involve evaluating multiple rendered frames. There is a manual test.

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 gaaclarke changed the title Animated blur test [Impeller] new blur: clamp downsample scalar to 1/16 Feb 1, 2024
@@ -16,7 +16,7 @@ struct KernelSample {

uniform KernelSamples {
int sample_count;
KernelSample samples[32];
KernelSample samples[48];
Copy link
Member

Choose a reason for hiding this comment

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

Can we drop this down to 24 by only storing the samples from 0 to ?

I'm slightly concerned that we don't really have any tracking of the uniform size limit across our various backends.

Copy link
Member Author

@gaaclarke gaaclarke Feb 2, 2024

Choose a reason for hiding this comment

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

For the Pixel 5 the max UBO size is 64KB ( https://vulkan.gpuinfo.org/displayreport.php?id=27816#properties )
The vulkan 1.0 spec requires a minimuimum of 16384B ( https://registry.khronos.org/vulkan/specs/1.0-wsi_extensions/pdf/vkspec.pdf )

Assuming 32bit floats:
sizeof(KernelSample) = 12B
sizeof(KernelSample) * 48 = 576 bytes

I don't know if there is a definitive rule about this for opengles, but given the big gap between this an the 1.0 minimum I think we should be good.

edit: the ubo range limit is maxUniformBufferRange

Copy link
Member

Choose a reason for hiding this comment

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

sizeof(KernelSample) is 16 bytes due to padding requirements. According to https://registry.khronos.org/OpenGL/specs/es/2.0/GLSL_ES_Specification_1.00.pdf

 gl_MaxVertexUniformVectors = 128;

Which assume they mean 4 component float vectors, we're still below the limit. SGTM

Added test for reproducing blur shimmering when translating content under a blur
@gaaclarke gaaclarke marked this pull request as ready for review February 2, 2024 23:32
@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 #50262 at sha bbc31b1

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 gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 2, 2024
@auto-submit auto-submit bot merged commit 7c7631b into flutter:main Feb 2, 2024
30 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 3, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Feb 3, 2024
…142848)

flutter/engine@fee0214...23763db

2024-02-03 chinmaygarde@google.com [Impeller] Fix blown stack due to always out of date window dimensions on high-dpi devices. (flutter/engine#50307)
2024-02-02 jason-simmons@users.noreply.github.com [Impeller] In advanced blends, unpremultiply and apply src_input_alpha only if there is no foreground color (flutter/engine#50260)
2024-02-02 30870216+gaaclarke@users.noreply.github.com [Impeller] new blur: clamp downsample scalar to 1/16 (flutter/engine#50262)

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 matanl@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
gaaclarke added a commit that referenced this pull request Feb 6, 2024
…#50363)

issue: flutter/flutter#142753

After #50262 there were still some
sigmas that could show shimmering around the sigma [50, 100] range which
had a downsample amount of 1/16. This makes those ranges hang on to 1/8
for as long as possible. I'm unable to see any shimmering with
`AiksTest.GaussianBlurAnimatedBackdrop` after this PR. I've also
expanded that test so the clip region could be scaled to make sure that
there aren't sizes which cause it to reappear.

Testing: Expanded on manual testing. Since the error only manifests when
evaluating multiple frames of rendering we don't have infrastructure to
test that.

Here is the graph of `GaussianBlurFilterContents::CalculateScale` after
this change:

<img width="903" alt="Screenshot 2024-02-05 at 2 10 41 PM"
src="https://github.com/flutter/engine/assets/30870216/ac3b735a-95f0-4d7b-af12-58e1ae75278e">

## 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App e: impeller will affect goldens
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

[Impeller] New blur has shimmers when sigma > 57 and content animating under it
2 participants