这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Impeller] Use Vulkan by default #40809

Merged
merged 6 commits into from
Mar 31, 2023
Merged

[Impeller] Use Vulkan by default #40809

merged 6 commits into from
Mar 31, 2023

Conversation

dnfield
Copy link
Contributor

@dnfield dnfield commented Mar 30, 2023

Adds a flag --impeller-force-gl to allow us to force the GLES backend to be used for testing purposes. Wired up in the tool in flutter/flutter#123828.

Attempts to create the Vulkan backend first (unless flag requesting GL is true). If the context can't be created, then creates the GLES backend instead. Updates the logging statements about using impeller to specify whether it's GL or Vulkan.

I've renamed AndroidRenderingApi::kOpenGLES to AndroidRenderingApi::kGPU because it's confusing to have it referred to that way for Vulkan. Also renamed AndroidContextGLImpeller to AndroidContextImpeller - although that class is not really used at this point.

Fixes flutter/flutter#116801

Copy link
Member

@chinmaygarde chinmaygarde left a comment

Choose a reason for hiding this comment

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

Some nits but all minor. LGTM. Thanks!

@@ -266,6 +266,11 @@ DEF_SWITCH(EnableVulkanValidation,
"Enable loading Vulkan validation layers. The layers must be "
"available to the application and loadable. On non-Vulkan backends, "
"this flag does nothing.")
DEF_SWITCH(ImpellerUseGL,
"impeller-use-gl",
Copy link
Member

Choose a reason for hiding this comment

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

--impeller-force-gl makes it a teeny bit clearer IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

DEF_SWITCH(ImpellerUseGL,
"impeller-use-gl",
"Force Impeller to use the GL backend, if available. If Impeller is "
"not enabled or it does not support a GL backend for the target "
Copy link
Member

Choose a reason for hiding this comment

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

Nit: commas in help text.

@@ -56,6 +56,9 @@ AndroidSurfaceVulkanImpeller::AndroidSurfaceVulkanImpeller(
CreateImpellerContext(proc_table_, workers_, enable_vulkan_validation);
is_valid_ =
proc_table_->HasAcquiredMandatoryProcAddresses() && impeller_context_;
if (is_valid_) {
FML_LOG(ERROR) << "Using the Impeller Vulkan rendering backend.";
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps just an info log. Not really an error that we end up using Vulkan.

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 matches the behavior on the GL side, and I assume it was done this way because info logs by default do not show up from flutter run.

@@ -13,7 +13,7 @@ namespace flutter {

enum class AndroidRenderingAPI {
kSoftware,
kOpenGLES,
kGPU,
Copy link
Member

Choose a reason for hiding this comment

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

👍🏽

if (vk_surface->IsValid()) {
return vk_surface;
}
}
Copy link
Member

Choose a reason for hiding this comment

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

An info log here saying we are falling back to GL would be good.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's a log later saying we're using ht eGL backend in this path.

@@ -75,10 +75,9 @@ static std::shared_ptr<impeller::Context> CreateImpellerContext(
FML_LOG(ERROR) << "Could not add reactor worker.";
return nullptr;
}
FML_LOG(ERROR) << "Using the Impeller rendering backend.";
FML_LOG(ERROR) << "Using the Impeller GL rendering backend.";
Copy link
Member

Choose a reason for hiding this comment

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

I guess the same comment about this being an info log.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(At some point this shoul dbecome an info log but let's handle that in a separate patch)

@dnfield dnfield self-assigned this Mar 30, 2023
@dnfield dnfield added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 30, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Mar 30, 2023

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

  • The status or check suite Linux Host Engine has failed. Please fix the issues identified (or deflake) before re-applying this label.

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

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

Changes reported for pull request #40809 at sha f34e877

@zanderso
Copy link
Member

@gaaclarke What's your interpretation of the flagged skia gold diff? Since this PR probably only affected Android/Vulkan, I'm wondering if it means that the test might be flaky?

@auto-submit auto-submit bot merged commit a6421ed into flutter:main Mar 31, 2023
@dnfield
Copy link
Contributor Author

dnfield commented Mar 31, 2023

I asked in the impeller chat, I think thi particular one is flaky. It's related to text rendering and probably has some difference depending on whehter it's running on an Intel or Arm mac.

@dnfield dnfield deleted the vulkan branch March 31, 2023 05:24
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 31, 2023
chinmaygarde added a commit to chinmaygarde/flutter that referenced this pull request Mar 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 platform-android will affect goldens
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[Impeller] Devise a client rendering API selection and fallback mechanism.
3 participants