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] Add FilterContents::GetSourceCoverage to enable filtered saveLayer clipping. #47183

Merged
merged 9 commits into from
Oct 27, 2023

Conversation

flar
Copy link
Contributor

@flar flar commented Oct 20, 2023

The new method allows a caller to ask for the coverage of the input pixels required to produce an output that spans a given area. This allows the code to clip a saveLayer that has an image filter applied to it.

@flutter-dashboard

This comment was marked as outdated.

@flar flar marked this pull request as draft October 20, 2023 23:47
@flar flar added the Work in progress (WIP) Not ready (yet) for review! label Oct 20, 2023
@chinmaygarde chinmaygarde changed the title Add FilterContents::GetSourceCoverage to enable filtered saveLayer clipping [Impeller] Add FilterContents::GetSourceCoverage to enable filtered saveLayer clipping. Oct 21, 2023
@bdero
Copy link
Member

bdero commented Oct 23, 2023

Sorry for the delay! Doing a lot of catchup today. At a glance this looks really great and I'm not spotting anything unexpected...

Would you mind adding a quick golden to aiks_unittests.cc that reproduces the broken case?

@flar flar force-pushed the impeller-filter-source-coverage branch from daf7d97 to 8fe2eca Compare October 24, 2023 00:17
@flar
Copy link
Contributor Author

flar commented Oct 24, 2023

One step closer, the culling of the saveLayer is fixed, but it now paints too much of the layer it creates to the screen. The layer size was expanded to collect source pixels for the filter, but the output needs to be clipped back to the SaveLayer bounds (if it had any).

Also, the test case clearly shows that the DrawPaint inside of the SaveLayer is not rendering to the whole texture.

@flar flar force-pushed the impeller-filter-source-coverage branch from 8fe2eca to ae669cd Compare October 24, 2023 22:00
@flar flar marked this pull request as ready for review October 25, 2023 19:42
@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 #47183 at sha 83a72a6

@flar
Copy link
Contributor Author

flar commented Oct 25, 2023

I seem to have gone down a route with the new method to pass along the Matrix being used, but that matrix is already installed in the filter being traversed earlier in the GetSubpassCoverage method. I could...

  • Remove the installation of the Matrix when the filter is produced at the top of the method since it causes a deep rewrite of the filter tree and is redundant with the current method signature of GetSourceCoverage.
  • Remove the Matrix argument from GetSourceCoverage since it is already installed in the filter chain.
  • ???

I lean towards methods that carry along the data they need rather than modifying the objects to contain all of the data and having to update that frequently as it is removes temporary state from the objects, but it looks like the design of Impeller is including some of this state in the objects here and there. Not sure how to untangle this particular case.

@flar
Copy link
Contributor Author

flar commented Oct 25, 2023

And I still need to look into those golden failures.

@flutter-dashboard
Copy link

Golden file changes are available for triage from new commit, Click here to view.

Changes reported for pull request #47183 at sha 384d7ca

@flar
Copy link
Contributor Author

flar commented Oct 25, 2023

I'm suddenly concerned about the new optional functions that I added to rect.h.

There seems to be some disagreement about what a nullopt means for the coverage code. Sometimes it means "there is no restriction" and sometimes it means "there is no content" which are opposite interpretations. As a result, the interpretation these methods place on what a nullopt argument means might conflict with a given piece of code.

I think we need to untangle that and come up with a single interpretation of nullopt for a rectangle. It should perhaps be "NaN", as in "there is no answer to your question", which can happen in a couple of places - but it should never equal "empty bounds" or "infinite bounds" - we have empty rectangles and (broken) infinite rectangles to handle those cases.

@flar flar force-pushed the impeller-filter-source-coverage branch from 384d7ca to c705e6a Compare October 25, 2023 23:23
@flutter-dashboard
Copy link

Golden file changes are available for triage from new commit, Click here to view.

Changes reported for pull request #47183 at sha c705e6a

@bdero
Copy link
Member

bdero commented Oct 26, 2023

Yeah I 100% agree w.r.t. the coverage conventions, added a bug around this suggesting a convention: flutter/flutter#137306

@flar flar added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 27, 2023
@auto-submit auto-submit bot merged commit 786202e into flutter:main Oct 27, 2023
27 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 27, 2023
fluttermirroringbot pushed a commit to flutter/flutter that referenced this pull request Oct 27, 2023
…sions) (#137422)

Manual roll requested by zra@google.com

flutter/engine@bedc49e...71e1a04

2023-10-27 98614782+auto-submit[bot]@users.noreply.github.com Reverts
"Manual roll Dart SDK from 360370ff93b0 to 18678a3eddb7 (9 revisions)"
(flutter/engine#47380)
2023-10-27 skia-flutter-autoroll@skia.org Roll Skia from 0122c0e18d26 to
fe9959acc5e0 (1 revision) (flutter/engine#47379)
2023-10-27 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from
1ngqKBnmTtmFM6aBD... to fw9lcUvz8S07_zaAj... (flutter/engine#47377)
2023-10-27 skia-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from
37VxdxlPfdkek7mwC... to gPQSfYJVLOgXjxQce... (flutter/engine#47375)
2023-10-27 skia-flutter-autoroll@skia.org Roll Skia from 22f5419438c4 to
0122c0e18d26 (1 revision) (flutter/engine#47373)
2023-10-27 skia-flutter-autoroll@skia.org Roll Skia from 5262cbff56b1 to
22f5419438c4 (1 revision) (flutter/engine#47372)
2023-10-27 skia-flutter-autoroll@skia.org Roll Skia from fe61b3467547 to
5262cbff56b1 (1 revision) (flutter/engine#47371)
2023-10-27 skia-flutter-autoroll@skia.org Roll Skia from fbdd7d97b26e to
fe61b3467547 (1 revision) (flutter/engine#47370)
2023-10-27 skia-flutter-autoroll@skia.org Roll Skia from 2246f3473053 to
fbdd7d97b26e (2 revisions) (flutter/engine#47369)
2023-10-27 skia-flutter-autoroll@skia.org Roll Skia from ec4c6b3a6690 to
2246f3473053 (1 revision) (flutter/engine#47366)
2023-10-27 flar@google.com [Impeller] Add
FilterContents::GetSourceCoverage to enable filtered saveLayer clipping.
(flutter/engine#47183)
2023-10-27 skia-flutter-autoroll@skia.org Roll Skia from bc8ca57868d2 to
ec4c6b3a6690 (1 revision) (flutter/engine#47365)
2023-10-27 john@johnmccutchan.com Don't re-initialize the default
RenderSurface when returning from hybrid composition mode
(flutter/engine#47358)
2023-10-27 skia-flutter-autoroll@skia.org Manual roll Dart SDK from
360370ff93b0 to 18678a3eddb7 (9 revisions) (flutter/engine#47357)
2023-10-26 skia-flutter-autoroll@skia.org Roll Skia from 93a0ad4d7ca6 to
bc8ca57868d2 (2 revisions) (flutter/engine#47359)
2023-10-26 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from
YSn00b0Trsu2vdhIq... to 1ngqKBnmTtmFM6aBD... (flutter/engine#47363)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from 37VxdxlPfdke to gPQSfYJVLOgX
  fuchsia/sdk/core/mac-amd64 from YSn00b0Trsu2 to fw9lcUvz8S07

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 aaclarke@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
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 27, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Oct 27, 2023
…137429)

flutter/engine@bedc49e...a198ad4

2023-10-27 jonahwilliams@google.com [Impeller] Add present wait latch. (flutter/engine#47311)
2023-10-27 zanderso@users.noreply.github.com Move rapidjson to flutter/third_party (flutter/engine#47354)
2023-10-27 jason-simmons@users.noreply.github.com [Impeller] Enable GLES MSAA only if the multisampled_render_to_texture2 extension is available (flutter/engine#47364)
2023-10-27 jason-simmons@users.noreply.github.com [Impeller] Fix leak of framebuffers used in GLES MSAA rendering (flutter/engine#47362)
2023-10-27 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Manual roll Dart SDK from 360370ff93b0 to 18678a3eddb7 (9 revisions)" (flutter/engine#47380)
2023-10-27 skia-flutter-autoroll@skia.org Roll Skia from 0122c0e18d26 to fe9959acc5e0 (1 revision) (flutter/engine#47379)
2023-10-27 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from 1ngqKBnmTtmFM6aBD... to fw9lcUvz8S07_zaAj... (flutter/engine#47377)
2023-10-27 skia-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 37VxdxlPfdkek7mwC... to gPQSfYJVLOgXjxQce... (flutter/engine#47375)
2023-10-27 skia-flutter-autoroll@skia.org Roll Skia from 22f5419438c4 to 0122c0e18d26 (1 revision) (flutter/engine#47373)
2023-10-27 skia-flutter-autoroll@skia.org Roll Skia from 5262cbff56b1 to 22f5419438c4 (1 revision) (flutter/engine#47372)
2023-10-27 skia-flutter-autoroll@skia.org Roll Skia from fe61b3467547 to 5262cbff56b1 (1 revision) (flutter/engine#47371)
2023-10-27 skia-flutter-autoroll@skia.org Roll Skia from fbdd7d97b26e to fe61b3467547 (1 revision) (flutter/engine#47370)
2023-10-27 skia-flutter-autoroll@skia.org Roll Skia from 2246f3473053 to fbdd7d97b26e (2 revisions) (flutter/engine#47369)
2023-10-27 skia-flutter-autoroll@skia.org Roll Skia from ec4c6b3a6690 to 2246f3473053 (1 revision) (flutter/engine#47366)
2023-10-27 flar@google.com [Impeller] Add FilterContents::GetSourceCoverage to enable filtered saveLayer clipping. (flutter/engine#47183)
2023-10-27 skia-flutter-autoroll@skia.org Roll Skia from bc8ca57868d2 to ec4c6b3a6690 (1 revision) (flutter/engine#47365)
2023-10-27 john@johnmccutchan.com Don't re-initialize the default RenderSurface when returning from hybrid composition mode (flutter/engine#47358)
2023-10-27 skia-flutter-autoroll@skia.org Manual roll Dart SDK from 360370ff93b0 to 18678a3eddb7 (9 revisions) (flutter/engine#47357)
2023-10-26 skia-flutter-autoroll@skia.org Roll Skia from 93a0ad4d7ca6 to bc8ca57868d2 (2 revisions) (flutter/engine#47359)
2023-10-26 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from YSn00b0Trsu2vdhIq... to 1ngqKBnmTtmFM6aBD... (flutter/engine#47363)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from 37VxdxlPfdke to gPQSfYJVLOgX
  fuchsia/sdk/core/mac-amd64 from YSn00b0Trsu2 to fw9lcUvz8S07

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 aaclarke@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
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
Archived in project
2 participants