Skip to content
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

Merged
merged 5 commits into from Jun 12, 2023

Conversation

jonahwilliams
Copy link
Member

Ship it?

@flutter-dashboard
Copy link

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;
Copy link
Member Author

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.

/// 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;
Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Member

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?

Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@bdero
Copy link
Member

bdero commented Jun 7, 2023

No strong opinions about landing this flag, but this is double ultra unstable until we get the embedder unittest harness working with Impeller.

@jonahwilliams
Copy link
Member Author

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;
Copy link
Member

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?

Copy link
Member Author

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_;
Copy link
Contributor

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)

@zanderso
Copy link
Member

zanderso commented Jun 8, 2023

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 ||
Copy link
Member Author

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).";
Copy link
Member Author

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

@jonahwilliams
Copy link
Member Author

embedder.h API change reverted.

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 12, 2023
@auto-submit auto-submit bot merged commit c142c0d into flutter:main Jun 12, 2023
30 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 12, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 12, 2023
jonahwilliams pushed a commit to flutter/flutter that referenced this pull request Jun 12, 2023
…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
Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

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

Fantastic! 🚀

Copy link
Member

@zanderso zanderso left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App needs tests platform-macos
Projects
None yet
7 participants