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

[Impeller] Reland DlAiksCanvas #45232

Merged
merged 6 commits into from
Aug 31, 2023
Merged

[Impeller] Reland DlAiksCanvas #45232

merged 6 commits into from
Aug 31, 2023

Conversation

dnfield
Copy link
Contributor

@dnfield dnfield commented Aug 29, 2023

Relands #45131

Fixes flutter/flutter#132416

Differences from last time:

  • Some minor merge conflict fixes
  • Use the RTree to get the bounds instead of recalculating the bounds
  • Make the iOS platform view controller implementation use the impeller-aware slices instead of the display list ones. This has been fixed for Android and the desktop embedding, but I missed iOS. The unit tests weren't actually running before I branched for my PR, @zanderso fixed them up separately and this resulted in catching the failures on post submit last time.

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.

Lets get this moving!

@dnfield dnfield added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 29, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 29, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Aug 29, 2023

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

@dnfield
Copy link
Contributor Author

dnfield commented Aug 29, 2023

Failures are due to a missing compensating change after merging, will fix...

@dnfield dnfield added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 29, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 29, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Aug 29, 2023

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

@dnfield dnfield added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 30, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 30, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Aug 30, 2023

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

// There is no opacity peepholing to do here because Impeller handles that
// in the Entities, and this layer will never participate in raster caching.
FML_DCHECK(!frame->raster_cache);
set_paint_bounds(bounds_);
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing the offset here. Notice that DLLayer translates the bounds_ field.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What's a test case I could use for this?

Copy link
Contributor

@flar flar Aug 31, 2023

Choose a reason for hiding this comment

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

We might not have one.

aiks layer under an offset layer

A clip or partial repaint would have to be involved as well. Bad bounds in a layer don't immediately cause a problem, but they can trigger mistakes in culling during partial repaint and layer culling


FML_DCHECK(!context.raster_cache);

SkScalar opacity = context.state_stack.outstanding_opacity();
Copy link
Contributor

Choose a reason for hiding this comment

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

You never set the flags to indicate that you could render your contents with opacity, so the state stack will do a protective saveLayer around you instead and this value will always be 1.0.

If AiksCanvas.DrawImpellerPicture can distribute opacity, then you will need to set the appropriate flag in Preroll to be able to do this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It can't

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(but we could certainly update that later, or see about using the new split you created to handle that right?)

std::make_shared<impeller::DlAiksCanvas>(SkRect::Make(frame_size));
canvas_ = aiks_canvas_.get();
#else
FML_DCHECK(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

The flag is kind of misnamed now. It really means "we're rendering in Impeller mode, so do the Impeller thing". It was named after the (former) solution rather than the trigger that caused it...


DlAiksCanvas::~DlAiksCanvas() = default;

static Paint::Style ToStyle(flutter::DlDrawStyle style) {
Copy link
Contributor

Choose a reason for hiding this comment

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

For many of these, if they are enum classes with the same ordering then you can get away with a cast like dl_sk_conversions.h - though that class has unit tests to verify that the conversions produce the right values so that we'll catch if there is ever a mismatch in the enum values.


// |flutter::DlCanvas|
void DlAiksCanvas::ClipRRect(const SkRRect& rrect, ClipOp clip_op, bool is_aa) {
if (rrect.isSimple()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Simple allows different radx and rady. When it says "equal radii" it means all 4 corners are equal, not that the horizontal and vertical radii are the same.

Also, it has an isRect() that could be trapped and converted into a ClipRect()

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 was copy pasted from dl_dispatcher

Copy link
Contributor

Choose a reason for hiding this comment

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

// |flutter::DlCanvas|
void DlAiksCanvas::DrawRRect(const SkRRect& rrect,
const flutter::DlPaint& paint) {
if (rrect.isSimple()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

isSimple != horizontal and vertical radii are the same.

if (!picture) {
return;
}
FML_DCHECK(opacity == 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Might want to DCHECK this in aiks_layer as well.

@dnfield dnfield added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 30, 2023
@auto-submit auto-submit bot merged commit 3b75e3d into flutter:main Aug 31, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 31, 2023
jonahwilliams pushed a commit to flutter/flutter that referenced this pull request Aug 31, 2023
…133724)

flutter/engine@73e8636...3b75e3d

2023-08-31 [email protected] [Impeller] Reland DlAiksCanvas
(flutter/engine#45232)
2023-08-31 [email protected] Add a
build_bucket_golden_scraper tool. (flutter/engine#45243)

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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
zanderso added a commit to zanderso/engine that referenced this pull request Aug 31, 2023
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 platform-android platform-ios
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[Impeller] Re-land "DlCanvas implementation wrapping Aiks canvas"
4 participants