Vulkan
Vulkan copied to clipboard
Multiple Windows (SwapChain) sample?
Would be possible to add multiple swap chain example ( for desktop ) platforms?
Thank you
Nothing planned. But having multiple windows with multiple swap chains is pretty straightforward. Just create a surface for each window (passing e.g. the HWND and HINSTANCE on Windows) and use that for the swap chains.
So the confusing part is that it seems that RenderPasses and therefore GraphicsPipelines are dependent on the Surface's format. So do you create these objects per window (super annoying for sharing materials) or do you hope the render passes are going to be compatible (meaning the surface format is always the same) and create a 'dummy' window+surface during initialization and use it's format?
Without doing this, the physical device selection can't verify with vkGetPhysicalDeviceSurfaceCapabilitiesKHR that the surface will be compatible. Then for each real window, you would need to create a surface for it and verify that its format/caps matched. I would think that they would normally be the same as the initial dummy window.
@SaschaWillems @Ziflin Curious if you have any after-the-fact comment/suggestion on the problem you @Ziflin described? I'm also trying to implement multiple viewport and wondering what assumption I can make about matching surface format.
@ocornut I never found a great example, but I just ended up going with the same (annoying) setup as I mentioned and during initialization I create a temporary window and create a surface from that that I keep around. Then during 'actual' window creation, I create a new surface for that window and verify that it has a surface format (GetPhysicalDeviceSurfaceFormatsKhr) that has a matching format and colorspace as the initialization surface.
I'm not sure why this isn't addressed better somewhere...
On a related but slightly different situation, do you have an example for driving one surface over multiple devices with monitors on each? I have been looking but seem to have missed the ability to tell if the a surface is completely not on one of the devices, so can save not rendering to it.
Even just a hint to the correct API struct or func would be greatly appreciated.
Thanks.
@ocornut and @Ziflin curious if any of you ever found a better way to go about this than creating a dummy window?