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

[Impeller] libImpeller: Add support for Metal and Vulkan rendering. #56906

Closed
wants to merge 5 commits into from

Conversation

chinmaygarde
Copy link
Member

@chinmaygarde chinmaygarde commented Dec 2, 2024

  • Adds context creation and WSI routines for Metal and Vulkan.
  • Enables all tests for the Metal, Vulkan, and OpenGLES backends.
  • Separate standalone examples for Metal, Vulkan, and OpenGLES have been created. These will be packaged with the SDK.
    • Disallows the use of OpenGL ES on macOS.
  • All new public methods are documented.
  • The SDK version number has been bumped.
  • Some incorrect nullability annotations were patched.
  • Tests harness is overhauled to reuse the same underlying context as the playgrounds.
  • The C++ public header has been updated.

Fixes flutter/flutter#159512

@chinmaygarde chinmaygarde added the Work in progress (WIP) Not ready (yet) for review! label Dec 2, 2024
@chinmaygarde

This comment was marked as outdated.

@chinmaygarde

This comment was marked as outdated.

* Adds context creation and WSI routines for Metal and Vulkan.
* Enables all tests for the Metal, Vulkan, and OpenGLES backends.
* Separate standalone examples for Metal, Vulkan, and OpenGLES have been created. These will be packaged with the SDK.
  * Disallows the use of OpenGL ES on macOS.
* All new public methods are documented.
* The SDK version number has been bumped.
* Some incorrect nullability annotations were patched.
* Tests harness is overhauled to reuse the same underlying context as the playgrounds.

Fixes flutter/flutter#159512
@chinmaygarde
Copy link
Member Author

Ok, all done. All backends should be enabled, tested, documented, and have examples. I am sure more complicated WSI could be supported (like non vk_surface_khr swapchains) but we can add support for that as it becomes necessary.

impeller::ContextVK::Settings impeller_settings;
impeller_settings.shader_libraries_data = CreateShaderLibraryMappings();
impeller_settings.cache_directory = fml::paths::GetCachesDirectory();
impeller_settings.enable_validation = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be reading from the settings?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice spot. This gave me so much trouble since reading from the settings was what I was doing initially. But we set setting to this to true here. This causes the system global proc. table to be initialized twice. And, depending on whether the second instance enabled or disables validations, proc. entries are zeroed out. So teardown of say the debug printers in the second context to be torn down won't find the proc. table entry for the deleter. And cause a crash.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, but you mentioned settings. While I was using switches (that the settings are inferred from). Perhaps I could steal the underlying contexts settings directly. Momentido.

Copy link
Contributor

@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.

LGTM

@flutter-dashboard
Copy link

This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.

@zanderso
Copy link
Member

zanderso commented Jan 6, 2025

This will need to be ported over to flutter/flutter.

@chinmaygarde
Copy link
Member Author

xref flutter/flutter#161547

@chinmaygarde chinmaygarde deleted the morebackends branch January 13, 2025 21:05
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Feb 12, 2025
…161547)

* Adds context creation and WSI routines for Metal and Vulkan.
* Enables all tests for the Metal, Vulkan, and OpenGLES backends.
* Separate standalone examples for Metal, Vulkan, and OpenGLES have been
created. These will be packaged with the SDK.
  * Disallows the use of OpenGL ES on macOS.
* All new public methods are documented.
* The SDK version number has been bumped.
* Some incorrect nullability annotations were patched.
* Tests harness is overhauled to reuse the same underlying context as
the playgrounds.
* The C++ public header has been updated.

Fixes #159512
Ports flutter/engine#56906
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Impeller] libImpeller: Wire up Metal and Vulkan backends.
3 participants