Closed janis8008 closed 1 month ago
It's a function you need to declare locally (and not use the one from the headers) and then load it. Other than that I have no idea, as I have never used that function. The reason it works with the Khronos samples, is that these use the volk meta loader, which I don't use.
It's a function you need to declare locally (and not use the one from the headers) and then load it. Other than that I have no idea, as I have never used that function. The reason it works with the Khronos samples, is that these use the volk meta loader, which I don't use.
Thanks for the suggestion, previously I had enabled the instance extension in device extension and misread error message, maybe next code snippet will help others when they have a problem with direct mode. I suspect linux build also required display acquisition for example to work.
typedef VkResult(*PFN_vkAcquireWinrtDisplayNV)(VkPhysicalDevice physicalDevice, VkDisplayKHR display);
PFN_vkAcquireWinrtDisplayNV vkAcquireWinrtDisplayNV = (PFN_vkAcquireWinrtDisplayNV)vkGetInstanceProcAddr(instance, "vkAcquireWinrtDisplayNV");
if (vkAcquireWinrtDisplayNV == nullptr) {
vks::tools::exitFatal("Failed to load vkAcquireWinrtDisplayNV!", VkResult::VK_ERROR_UNKNOWN);
}
VkDisplayKHR directModeDisplay = NULL;
VkDisplayModePropertiesKHR directModeDisplayProperties;
uint32_t propertyCnt = 0;
vkGetPhysicalDeviceDisplayPropertiesKHR(physicalDevice, &propertyCnt, NULL);
VkDisplayPropertiesKHR props;
vkGetPhysicalDeviceDisplayPropertiesKHR(physicalDevice, &propertyCnt, &props);
directModeDisplay = props.display;
VkResult result = vkAcquireWinrtDisplayNV(physicalDevice, directModeDisplay);
if (result != VK_SUCCESS || directModeDisplay == VK_NULL_HANDLE)
{
// Handle error or no display found
vks::tools::exitFatal("Failed to get WinRT display, result: ", VkResult::VK_ERROR_UNKNOWN);
}
Note that I have selected a GPU that has a KHR display available.
I have made some modifications to the code to allow direct-to-display rendering on Windows and the only thing holding me back is the build fails with the linking of
vkAcquireWinrtDisplayNV
. I tried multiple extensions and function linking usingvkGetInstanceProcAddr
but nothing has helped so far.P.S. These modifications work on https://github.com/KhronosGroup/Vulkan-Samples samples (triangle sample).