Thanks to visit codestin.com
Credit goes to github.com

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

Use the frame size to cull #35973

Merged
merged 3 commits into from
Sep 7, 2022
Merged

Use the frame size to cull #35973

merged 3 commits into from
Sep 7, 2022

Conversation

dnfield
Copy link
Contributor

@dnfield dnfield commented Sep 7, 2022

Passes through the frame size parameter from Surface::AcquireFrame to SurfaceFrame. This primarily helps impeller, which no longer needs to use kGiantRect and will be able to more aggressively cull away graphical operations/geometry that fall outside of the frame's bounds.

This is part of a fix for flutter/flutter#110442. We should still do the work @bdero is proposing in #35966, but this will cover cases where clips in the DL/layer tree don't save us.

I still think we could be doing this kind of culling higher up in the stack in the framework (see flutter/flutter#111065).

dl_recorder_ = sk_make_sp<DisplayListCanvasRecorder>(kGiantRect);
FML_DCHECK(!frame_size.isEmpty());
dl_recorder_ =
sk_make_sp<DisplayListCanvasRecorder>(SkRect::Make(frame_size));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This right here is what makes the magic for impeller. This code path is used for impeller, and this will cause the SkCanvas implementation underlying the recorder here to quickReject drawing ops that fall outside of it, which will gate off a whole lot of allocations of impeller-specific geometry (e.g. not creating impeller::Path objects for SkPaths that fall entirely outside these bounds).

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!

Copy link
Contributor

@flar flar left a comment

Choose a reason for hiding this comment

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

LGTM

@dnfield dnfield added autosubmit Merge PR when tree becomes green via auto submit App and removed autosubmit Merge PR when tree becomes green via auto submit App labels Sep 7, 2022
@dnfield
Copy link
Contributor Author

dnfield commented Sep 7, 2022

I'm going to wait until I can rebase this on #35978 just to try to be extra sure I'm not using these sizes after they get moved :)

@dnfield
Copy link
Contributor Author

dnfield commented Sep 7, 2022

Actually, that patch will catch issues with this on post submit anyway.

cfontas pushed a commit to cfontas/engine that referenced this pull request Sep 14, 2022
Oleh-Sv pushed a commit to Oleh-Sv/engine that referenced this pull request Sep 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants