I have this function:
static cyBool swapchainSuitable(VkPhysicalDevice device, VkSurfaceKHR surface){
//Capabilities
VkSurfaceCapabilitiesKHR capabilities;
VkResult result = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(device, surface, &capabilities);
if (result != VK_SUCCESS){
CY_LOG_FATAL("Unable to get the physical device surface capabilities");
return FALSE;
}
//more stuff...
}
The result is always VK_ERROR_SURFACE_LOST_KHR
, the Vulkan Spec defines it as
A surface is no longer available.
What does this mean? The Vulkan validation debugger does not pick up anything and the surface was created successfully. I have not destroyed the surface nor the instance and the device is a valid pointer.
This is how the Surface is created (I am not using GLFW but the Win32 API)
VkWin32SurfaceCreateInfoKHR createInfo;
createInfo.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
createInfo.pNext = NULL;
createInfo.flags = 0;
createInfo.hinstance = GetModuleHandleA(NULL);
createInfo.hwnd = (HWND) &pWindowHandle;
VkResult result = vkCreateWin32SurfaceKHR(pInstance->handle, &createInfo, NULL, &pSurface->handle);
if(result != VK_SUCCESS){
CY_LOG_FATAL("Unable to create Windows Surface");
return FALSE;
}
Again: the instance handle is valid, the HWND is also valid and the surface is created successfully since the debug validation does not show anything.
the Instance extensions I wanted:
The device extensions I wanted:
I feel I am missing something really stupid but I cannot put my finger to it.
Thanks to @Kazz in the comments who found that I was passing my Window handle the wrong way.