MarkaRagnos0815
MarkaRagnos0815

Reputation: 212

vkGetPhysicalDeviceDisplayPropertiesKHR returns 0 displays always

I am working on a small example using Vulkan. On my laptop there is a special case by having two GPUs (Intel UHD + Nvidia Quadro T1000). I want to achieve the same thing as DXGI provides by enumerating all adapters and all possible outputs to make sure to select the correct screen.

What I did:

In any case vkGetPhysicalDeviceDisplayPropertiesKHR returns 0 as number of displays.

Tested on Vulkan SDK 1.3.204.1

Both behave the same by returning 0. Is there anything special to observe?

Upvotes: 1

Views: 611

Answers (1)

Karl Schultz
Karl Schultz

Reputation: 1566

This is probably happening because there is no "free" display monitor on your system for the VK_KHR_display extension to use. This extension is intended to draw to a display that is not under the control of a window or display manager.

In your case, you can plug a monitor into your laptop and configure the OS to NOT use it. Windows will automatically extend or duplicate your desktop to the external monitor, so you'll need to go into the display settings and tell it to remove that display.

This example sort of shows how to do it. The example shows off other stuff by using OpenGL to render something and then have Vulkan draw it to a VK_KHR_display display. But it is this last step that counts and there are clear instructions on how to free up a monitor on Windows.

Technically, getting a count of zero is correct in your case since there are no VK_KHR_display displays available. If you plug in a non-managed monitor, then you should see something other than zero. And all this seems reasonable for your enumeration task.

Upvotes: 3

Related Questions