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

[embedder api] Vulkan External Resources #144613

Open
jwinarske opened this issue Mar 5, 2024 · 4 comments
Open

[embedder api] Vulkan External Resources #144613

jwinarske opened this issue Mar 5, 2024 · 4 comments
Labels
c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter e: embedder Users of the Embedder API engine flutter/engine repository. See also e: labels. P3 Issues that are less important to the Flutter project team-engine Owned by Engine team triaged-engine Triaged by Engine team

Comments

@jwinarske
Copy link

Use case

Per discussion on Discord - Use case gaps in order to switch to external embedder Vulkan backend

Vulkan external VkImage Support

  1. GL interop. Same or different process. Source could be anything that inherently requires GL/GLES/EGL.
  2. GStreamer pipeline output. Pipeline creates Vulkan objects directly via vulkanupload pipeline stage. Same or different process. Example pipeline which exposes VkImage to CPU:
    https://gist.github.com/jwinarske/dda0f7154a0bf34c3e7b6606907ad0f7
  3. Present render target (VkImage) from (Unity, Filament, etc).
  4. libcamera - source format is determined by the Camera sensor, and has to be determined at runtime.

External processes would have an array of VkImages available to present.

Proposal

The proposal is to adopt the OpenGL external Texture pattern for Vulkan. This would allow re-use of the TextureWidget.

GL Texture API:

FlutterEngineRegisterExternalTexture
FlutterEngineUnregisterExternalTexture
FlutterEngineMarkExternalTextureFrameAvailable

TextureFrameCallback would need to be updated to include VkImageInfo which describes the backing VkImage. Skia GrVkImageInfo is used to construct a GrBackendTexture.

@darshankawar darshankawar added in triage Presently being triaged by the triage team c: new feature Nothing broken; request for a new capability engine flutter/engine repository. See also e: labels. e: embedder Users of the Embedder API c: proposal A detailed proposal for a change to Flutter team-engine Owned by Engine team and removed in triage Presently being triaged by the triage team labels Mar 6, 2024
@jonahwilliams jonahwilliams added the P3 Issues that are less important to the Flutter project label Mar 12, 2024
@jonahwilliams
Copy link
Member

@jwinarske is this something you are intending to work on yourself that you would like guidance on, or is this a feature request for the engine team?

@perkele1989
Copy link

This is something I'll likely need for day job in near future. Curious about progress on this, and if there's any way I could contribute.

@jonahwilliams
Copy link
Member

The flutter engine/impeller teams have no plans to work on this in the near future. If someone contributed a working implementation (with tests) I think we could accept it?

@perkele1989
Copy link

Thank you for responding. may look into it going forward. for now leaning to do a CPU roundtrip and see if its performant enough. Seems like most of the work/time investment would involve setting up a development environment. The actual codebase seems very ready for it already to accept external Vulkan VkImages/VkImageViews via something like VK_KHR_external_memory, the same way it can do so from Java.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter e: embedder Users of the Embedder API engine flutter/engine repository. See also e: labels. P3 Issues that are less important to the Flutter project team-engine Owned by Engine team triaged-engine Triaged by Engine team
Projects
None yet
Development

No branches or pull requests

4 participants