I am still writing something that ressembles a XR compositor; using Vulkan to be cross-platform.
I had success using VkDisplay’s and and the platform specific AcquireDisplay to connect to my headset prototype when it has only one video stream.
On windows 10, my calls to vk are :
1) vkGetPhysicalDeviceDisplayProperties2KHR // Getting the display infos, searching for the right display in the list 2) vkAcquireWinrtDisplayNV // With the display found in the list above 3) vkGetDisplayModeProperties2KHR // To get proper display mode and image extent 4) vkGetPhysicalDeviceDisplayPlaneProperties2KHR // To get planes properties, searching for the plane associated with display found at 1) 4) vkCreateDisplayPlaneSurfaceKHR // With plane, stackIndex, mode, image extent found above 5) vkCreateSwapchainKHR // with checked image count etc from the capabilities, surface from 4)
When doing this for the first video output everything succeeds and swapchain correctly presents.
However, when adding a second video output (for another eye / another headset), this means repeating all steps a second time and choosing another display, the swapchain creation 5) fails with VK_ERROR_INITIALIZATION_FAILED. All other calls succeed.
I verified that the displays are different, planes and stack indices are different. Modes and extent are similar since it is for two separated eyes stream.
If it helps, the swapchain creation error is treated as fatal in my program and makes it “std::abort”, not calling release on the displays or other VK resources. If I launch it a second time both swapchains can be created but the first stream is not presenting correctly.
If I launch a 3rd time, the list returned by vkGetPhysicalDeviceDisplayProperties2KHR is empty and I cannot find the displays anymore…
Repeating gives the same result. Restarting Windows 10 solves the problem.
How much of this boils down to a bad api usage or driver not supporting two acquired displays ?