google / filament

Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WebGL2
https://google.github.io/filament/
Apache License 2.0
17.77k stars 1.88k forks source link

Sharing Vulkan memory object #4535

Open jwinarske opened 3 years ago

jwinarske commented 3 years ago

Is your feature request related to a problem? Please describe. I need to render to a GL Texture external to Filament, while using Vulkan backend.

Describe the solution you'd like Have RenderTarget share Vulkan memory object, so external to Filament I can implement GL interop code. As the GL memory object needs to be created from a Vulkan memory object.

Describe alternatives you've considered Modified Filament to run on Linux EGL/GLESv2 (1.5/3.2) backend. Hitting issue where Wayland does not support pbuffer. Was asked by @pixelflinger if Vulkan was an option.

OS and backend Linux + Vulkan backend

Useful Vulkan/GL interop patterns documented here: https://eleni.mutantstargoat.com/hikiko/vk-gl-interop-2/ https://eleni.mutantstargoat.com/hikiko/vk-gl-interop-3/

jwinarske commented 3 years ago

Any thoughts?

pixelflinger commented 3 years ago

No, no thoughts yet.

jwinarske commented 3 years ago

I started implementing Vulkan support in the Flutter Engine embedder. I can factor it such that SKIA optionally renders to a RenderTarget (vkImage or other) which Filament could then use; similar to how Imgui is rendered in samples - Flutter (2D) replacing the "Imgui layer".

jwinarske commented 3 years ago

/go/embedder-vulkan-support has been merged into main.

jwinarske commented 3 years ago

Starting PR this week: flutter.dev/go/embedder-vulkan-support

prideout commented 2 years ago

This is interesting, we have sharing mechanisms in place for Android but not other platforms. This bug is a few months old but I'll assume it's still something we need to work on.

chakflying commented 1 year ago

Hi. Recently ArCore was updated to support Vulkan by exposing a hardware buffer, which the app is supposed to bind to a VkImage. I guess this is still not possible because of this issue?

jwinarske commented 1 year ago

You can implement a new backend for your use case. Just need to maintain your fork

poweifeng commented 1 year ago

We recently introduced an API to provide the backend with a client-produced swapchain. I think it might address what you want to do. Please file a feature request there are gaps. Thanks.