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

Conversation

@jonahwilliams
Copy link
Contributor

@jonahwilliams jonahwilliams commented Dec 6, 2023

From local testing across both flutter galleries, wonderous, some other test apps, the only time this code successfully culls is during the stretch overscroll (and we cull 1 or so entries). The cost of this culling is approximately 20% of entity rendering time, and about 5% of overall raster time.

image

@jonahwilliams jonahwilliams marked this pull request as ready for review December 6, 2023 16:31
@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 #48717 at sha 6603682

@jonahwilliams
Copy link
Contributor Author

Test failure is interesting, might need to also render in the case where clip coverage is empty:

TEST_P(AiksTest, CanRenderWithContiguousClipRestores) {
Canvas canvas;
// Cover the whole canvas with red.
canvas.DrawPaint({.color = Color::Red()});
canvas.Save();
// Append two clips, the second resulting in empty coverage.
canvas.ClipPath(
PathBuilder{}.AddRect(Rect::MakeXYWH(100, 100, 100, 100)).TakePath());
canvas.ClipPath(
PathBuilder{}.AddRect(Rect::MakeXYWH(300, 300, 100, 100)).TakePath());
// Restore to no clips.
canvas.Restore();
// Replace the whole canvas with green.
canvas.DrawPaint({.color = Color::Green()});
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
}

@gaaclarke
Copy link
Member

From local testing across both flutter galleries, wonderous, some other test apps, the only time this code successfully culls is during the stretch overscroll (and we cull 1 or so entries).

Why only in that case? Is the framework performing its own culling? Or are display lists doing it?

if (!clip_coverage.has_value()) {
return false;
}
#ifdef IMPELLER_CONTENT_CULLING
Copy link
Member

Choose a reason for hiding this comment

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

Do we have a planned end-of-line for this flag? If we decide we don't want ShouldRender, we should just rip it out. It's going to atrophy otherwise.

Copy link
Member

@bdero bdero Dec 6, 2023

Choose a reason for hiding this comment

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

We're going to turn this on in impeller-cmake for now (which isn't yet located in the engine repo) since AAOS isn't using DisplayList and this is the only frustum culling mechanism in Impeller.

@jonahwilliams
Copy link
Contributor Author

The display list does culling during recording, so we are currently attempting to cull twice

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.

LGTM

Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

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

Do we have test coverage for the logic that we are now putting behind the a build compile flag? I don't want that to atrophy. We need to add one or make sure we have existing ones we are happy with.

@jonahwilliams
Copy link
Contributor Author

Since this is ifdef'd out at the Entity level, the content level testing for culling is still valid:

https://github.com/flutter/engine/blob/main/impeller/entity/entity_unittests.cc#L1576-L1630

Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

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

lgtm! i just wanted to make sure we didn't accidentally break this while some people are using it but it is turned off by default, thanks.

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 6, 2023
@auto-submit auto-submit bot merged commit 2dbc5d2 into flutter:main Dec 6, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 6, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 6, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 6, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 6, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 6, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 6, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 6, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 6, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 7, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 7, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Dec 7, 2023
…139716)

flutter/engine@347f506...82de334

2023-12-07 [email protected] Revert "Replace use of Fontmgr::RefDefault with explicit creation calls" (flutter/engine#48755)
2023-12-07 [email protected] Roll Skia from 2abb01e18ab3 to 8ebf43ba1c09 (1 revision) (flutter/engine#48761)
2023-12-07 [email protected] Roll Dart SDK from dbfe4e3f867e to be8a95b6717d (1 revision) (flutter/engine#48757)
2023-12-06 [email protected] Remove obsolete properties. (flutter/engine#48753)
2023-12-06 [email protected] Roll Skia from 7ff0103760d0 to 2abb01e18ab3 (1 revision) (flutter/engine#48751)
2023-12-06 [email protected] Roll Skia from 570103e08087 to 7ff0103760d0 (1 revision) (flutter/engine#48748)
2023-12-06 [email protected] Roll Skia from 326bdc97ac40 to 570103e08087 (1 revision) (flutter/engine#48746)
2023-12-06 [email protected] Roll Dart SDK from 6eb13603c212 to dbfe4e3f867e (1 revision) (flutter/engine#48745)
2023-12-06 [email protected] [Impeller] Store Buffer/Texture bindings in vector instead of map. (flutter/engine#48719)
2023-12-06 [email protected] Roll Skia from 33cba437bf70 to 326bdc97ac40 (2 revisions) (flutter/engine#48743)
2023-12-06 [email protected] [Impeller] Provide the clear color to an advanced blend if it was optimized out (flutter/engine#48646)
2023-12-06 [email protected] [Windows] Set swap interval on raster thread after startup (flutter/engine#47787)
2023-12-06 [email protected] Roll Skia from 384d14063dc1 to 33cba437bf70 (3 revisions) (flutter/engine#48740)
2023-12-06 [email protected] [Windows] Refactor the GLES proc table (flutter/engine#48688)
2023-12-06 [email protected] Replace use of Fontmgr::RefDefault with explicit creation calls (flutter/engine#48571)
2023-12-06 [email protected] [Impeller] disable entity culling by default. (flutter/engine#48717)
2023-12-06 [email protected] Roll Skia from 23e1cb20a6b5 to 384d14063dc1 (1 revision) (flutter/engine#48738)

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
zanderso pushed a commit to zanderso/engine that referenced this pull request Dec 18, 2023
From local testing across both flutter galleries, wonderous, some other test apps, the only time this code successfully culls is during the stretch overscroll (and we cull 1 or so entries). The cost of this culling is approximately 20% of entity rendering time, and about 5% of overall raster time.

![image](https://github.com/flutter/engine/assets/8975114/ef85629c-48a8-457f-8385-0c8136404571)
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

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants