User9123
User9123

Reputation: 45

Find physical device associated with primary monitor

With multi-monitor setups and OpenGL/Direct3D 11, Windows selects the device that the primary monitor is connected to. I'm trying to emulate this behavior with Vulkan. How can I figure out which physical device returned by vkEnumeratePhysicalDevices is the primary monitor connected to?

Upvotes: 0

Views: 317

Answers (1)

krOoze
krOoze

Reputation: 13306

Generally speaking you should not care.

Create in platform-specific ways the Platform Window on whatever monitor you want. Create VkSurface from the Platform Window. Check support with vkGetPhysicalDeviceSurfaceSupportKHR (resp. pick VkPhysicalDevice and Queue Family that has the support). And be content with that — you can now draw to the window (until told otherwise by the Vulkan).

But you can abuse that, creating a window on primary monitor and asking if it is supported by any Queue Family of the Physical Device. If so then the Physical Device is connected or is otherwisely capable to present on the primary monitor.

Upvotes: 1

Related Questions