How to handle multi-GPU with multi-monitors

Hi All,

I have the situation where I have 2 different GPUs (not device groupable) in a machine and a monitor plugged into each.
When I get VkSurface for a Window it says I have Present capable queues from each device. And if I create a logical device for physical device A, I seem to be getting images from physical device B’s monitor. Which implied the image is being copied from device A to B.

Is this correct? Is this meant to happen? And will this happen on all OSes? (I am using Windows 10 at present)

How can I make or control using both devices A and B to render just the parts of the Window that is over their part of the desktop. So there is no copying between the device?
I do not seem to be able to find any value that even tells me of the VkSurface extent over a particular device.

Thanks

You probably can’t. At least, not on Windows.

After all, you don’t own that window. Windows owns that window; you’re merely being allowed to use it within the restrictions the OS decides upon. If a window gets partially placed on multiple screens serviced by separate GPUs, it is the job of the OS to make that actually work the way the user intends, not user-land code.

Even if Vulkan had an API that would allow you to interfere in that process (which it doesn’t), that API could only be employed if Windows lets you. And it’s rather unlikely that they would. It’s much easier for the presentation process to invoke the copy than for the OS to have to potentially split the building of presentable images among multiple separate GPUs. It’s also much easier for the user to code for, since they don’t have to do anything special in these cases.

Presentation is something the user has minimal control over. It’s just something you have to deal with.

Thanks for the reply.

For efficiency, it would be nice to ask if it is efficient to use device X to render VkSurface Y. So in my case the device with the bulk of the window on would be detectable and I could switch between rendering devices. I am trying to architect for a desktop application that is rendering many 3D views and could be made faster by using my example case and not slowed down by it.

Vulkan is agnostic to knowing about monitors.

IIRC in Windows API you can query the monitor connected to given GPU. And you can query the monitor given HWND is at. And in Vulkan you can query which GPU is which VkPhysicalDevice, so it might be theoretically implementable.

The efficiency in practice is doubtful. There is still the Compositor between you and the monitor, and it may need to copy anyway.

“Vulkan is agnostic to knowing about monitors.”

Thanks is not strictly true, there is the VK_KHR_display extension. Which allow for Display per PhyicalDevice enumeration. But I have not seen it on a Windows platform yet. I know it is intended for non-windowing systems. But all the information is there.