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] allowing enabling Impeller on macOS. #42639
[Impeller] allowing enabling Impeller on macOS. #42639
Conversation
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
@@ -62,6 +62,9 @@ class EmbedderSurfaceMetalImpeller final : public EmbedderSurface, | |||
// |GPUSurfaceMetalDelegate| | |||
bool PresentTexture(GPUMTLTextureInfo texture) const override; | |||
|
|||
// |EmbedderSurface| | |||
std::shared_ptr<impeller::Context> CreateImpellerContext() const override; |
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.
Need to override this so we get a context for image decoding.
shell/platform/embedder/embedder.h
Outdated
/// If true, the Impeller rendering backend will be enabled. It is the callers | ||
/// responsibility to verify that Impeller supports the currently selected | ||
/// backend. | ||
bool enable_impeller; |
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.
TBD what sort of promise we want to make with this flag.
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.
I thought the idea was to loudly crash if someone asks for impeller and it can't work. Ideally also stop things in the tooling if they ask for it on an unsupported platform.
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.
That is how things already work.
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.
I missed this on initial review. I don't think we should add this flag because it will inevitably become outdated. Perhaps just allow it to be enabled through command_line_argv
?
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.
I agree with @bdero. This is a flag that will only be valid in the interim during the transition. Piping it through the command line args makes more sense to me. We will also be able to flip the default at our convenience.
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.
Done
No strong opinions about landing this flag, but this is double ultra unstable until we get the embedder unittest harness working with Impeller. |
Yeah we can wait to talk about this one a bit. Though we can keep it a bit more stable by enabling a CI machine with a simple unit test |
@@ -491,6 +491,7 @@ - (BOOL)runWithEntrypoint:(NSString*)entrypoint { | |||
|
|||
FlutterProjectArgs flutterArguments = {}; | |||
flutterArguments.struct_size = sizeof(FlutterProjectArgs); | |||
flutterArguments.enable_impeller = _project.enableImpeller; |
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.
Should we set enable_impeller
to false
explicitly on Windows and Linux?
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.
I don't think it matters. We'll keep the default false until we have all backends wired up and tested
@@ -75,6 +75,10 @@ | |||
return surface; | |||
} | |||
|
|||
std::shared_ptr<impeller::Context> EmbedderSurfaceMetalImpeller::CreateImpellerContext() const { | |||
return context_; |
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.
(this is fine because it's set up in the ctor)
From PR triage: This will wait for any feedback from @chinmaygarde when he is back from OOO. |
@@ -481,6 +481,13 @@ - (BOOL)runWithEntrypoint:(NSString*)entrypoint { | |||
// The first argument of argv is required to be the executable name. | |||
std::vector<const char*> argv = {[self.executableName UTF8String]}; | |||
std::vector<std::string> switches = self.switches; | |||
|
|||
// Enable Impeller only if specifically asked for from the project or cmdline arguments. | |||
if (_project.enableImpeller || |
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.
Moved to only using switches
@@ -49,6 +49,7 @@ | |||
std::make_shared<fml::SyncSwitch>(false), // is_gpu_disabled_sync_switch | |||
"Impeller Library" // library_label | |||
); | |||
FML_LOG(ERROR) << "Using the Impeller rendering backend (Metal)."; |
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.
Added an error log here to match the other backends
embedder.h API change reverted. |
…128738) flutter/engine@12def73...1714d73 2023-06-12 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from FreETK3TrhkNzCCL-... to J-zU9HGYXYU5UWJO9... (flutter/engine#42784) 2023-06-12 jonahwilliams@google.com [Impeller] allowing enabling Impeller on macOS. (flutter/engine#42639) Also rolling transitive DEPS: fuchsia/sdk/core/mac-amd64 from FreETK3TrhkN to J-zU9HGYXYU5 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 jacksongardner@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://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
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.
Fantastic! 🚀
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.
LGTM
Ship it?