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

Vulkan multiple renderers #5291

Closed
jeanlemotan opened this issue Mar 8, 2022 · 2 comments · Fixed by #5304
Closed

Vulkan multiple renderers #5291

jeanlemotan opened this issue Mar 8, 2022 · 2 comments · Fixed by #5304
Assignees
Labels
vulkan Issues with the Vulkan backend

Comments

@jeanlemotan
Copy link
Contributor

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.
@romainguy romainguy added the vulkan Issues with the Vulkan backend label Mar 8, 2022
@prideout
Copy link
Contributor

prideout commented Mar 8, 2022

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

@prideout
Copy link
Contributor

prideout commented Mar 9, 2022

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.

prideout added a commit that referenced this issue Mar 9, 2022
pixelflinger added a commit that referenced this issue Mar 10, 2022
we didn't need one per Renderer, and doing so created complexity in the
backends.

fixes #5291
pixelflinger added a commit that referenced this issue Mar 10, 2022
we didn't need one per Renderer, and doing so created complexity in the
backends.

fixes #5291
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vulkan Issues with the Vulkan backend
Projects
None yet
3 participants