google / filament

Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WebGL2

Home Page:https://google.github.io/filament/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vulkan multiple renderers

jeanlemotan opened this issue · comments

Vulkan backend doesn't support 2 or more Renderers / SwapChains

When creating 2 renderers, an assert will trigger in void VulkanDriver::createDefaultRenderTargetR(Handle<HwRenderTarget> rth, int) because the Vulkan driver stores the default render target in the context member - and assumes only one swap chain.

The defaultRenderTarget is used in the makeCurrent calls, to bind it to the swap chain buffers.
There are 2 simple solutions:

  1. Always pass the render target to the makeCurrent calls, along with the swapChain
  2. Store this default render target in the swapChain instead of the context.

Interesting, thanks for the bug report! This is something we should be able to support.

The problem with idea #2 is that the swap chain might not exist at the time that the default render target is set. We actually had an internal discussion about this on Feb 16 and we decided not to change the Driver API.

I think it's possible to fix it without changes to the Driver API, it won't be as beautiful as possible but that's okay. I'll take a look.

Note to self: this issue can be produced with our multiple_windows sample.