-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] DlCanvas implementation wrapping Aiks canvas #44248
Changes from 1 commit
f20fee7
d107a5d
150e5c0
468bbb3
d6de746
f64c2ef
887f134
23ebd1c
4f8f2fa
a6f26e9
371933c
4b42deb
8a9fa32
9b51312
9a3dc6c
1135df9
d34957a
3b52376
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,9 +32,13 @@ SurfaceFrame::SurfaceFrame(sk_sp<SkSurface> surface, | |
| canvas_ = &adapter_; | ||
| } else if (display_list_fallback) { | ||
| FML_DCHECK(!frame_size.isEmpty()); | ||
| #if IMPELLER_SUPPORTS_RENDERING | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should perhaps rename this flag if it really means "rendering_to_impeller" otherwise you are creating an impeller picture for a flag that is named "please create a display list"...
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is also an odd combination of tests that implies that a given call can contain either or both of a surface and/or the flag. If it's "one or the other", then delete the flag and just assume it if there is no surface. If it is both, we aren't implementing it very well. If there are cases when neither is provided - why is that? |
||
| aiks_canvas_ = | ||
| std::make_shared<impeller::DlAiksCanvas>(SkRect::Make(frame_size)); | ||
| canvas_ = aiks_canvas_.get(); | ||
| #else | ||
| FML_DCHECK(false); | ||
| #endif // IMPELLER_SUPPORTS_RENDERING | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -74,8 +78,13 @@ bool SurfaceFrame::PerformSubmit() { | |
| } | ||
|
|
||
| std::shared_ptr<const impeller::Picture> SurfaceFrame::GetImpellerPicture() { | ||
| #if IMPELLER_SUPPORTS_RENDERING | ||
| return std::make_shared<impeller::Picture>( | ||
| aiks_canvas_->EndRecordingAsPicture()); | ||
| #else | ||
| FML_DCHECK(false); | ||
| return nullptr; | ||
| #endif // IMPELLER_SUPPORTS_RENDERING | ||
| } | ||
|
|
||
| } // namespace flutter | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,13 +12,15 @@ declare_args() { | |
| flutter_runtime_mode == "debug" || flutter_runtime_mode == "profile" | ||
|
|
||
| # Whether the Metal backend is enabled. | ||
| impeller_enable_metal = is_mac || is_ios | ||
| impeller_enable_metal = (is_mac || is_ios) && target_os != "fuchsia" | ||
|
|
||
| # Whether the OpenGLES backend is enabled. | ||
| impeller_enable_opengles = is_linux || is_win || is_android | ||
| impeller_enable_opengles = | ||
| (is_linux || is_win || is_android) && target_os != "fuchsia" | ||
|
|
||
| # Whether the Vulkan backend is enabled. | ||
| impeller_enable_vulkan = is_linux || is_win || is_android | ||
| impeller_enable_vulkan = | ||
| (is_linux || is_win || is_android) && target_os != "fuchsia" | ||
|
|
||
|
Comment on lines
+15
to
24
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this necessary? I don't remember where we landed on the embedder.h issue with fuchsia
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I don't do this, there are host artifacts built for linux or mac when building Fuchsia where the target_os is Fuchsia, and enable_impeller ends up being true in places where it really shouldn't be. I'd be happy to separate this into another patch if it helps.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nah thats fine. |
||
| # Whether to use a prebuilt impellerc. | ||
| # If this is the empty string, impellerc will be built. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no override for IsReplacing. I forget the details, but sometimes a new Layer is constructed with the same ui.Picture as was used in the previous frame and so we need to check if the pictures are the same, not just the layer, otherwise we lose a lot of partial repaint reduction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. The way it is now partial repaint will not work correctly with
AiksLayer. WithDisplayListLayer(and similarlyAiksLayer) the diffing is moved one level up - toContainerLayer. TheDisplayListLayer::Diffbasically just reports the layer paint region.The reason for this is that we want to be able to detect added / removed display list layers similar to how the framework diffs element children. (See
ContainerLayer::DiffChildren).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason why picture layers are different than other layers in this regard is that picture layers don't exit in framework in a similar way other layers exist - so we don't get the old layer to link with the new layer when adding picture like we would get with a backdrop filter or a clip rect layer for example. So we relay on comparing the contents.