Vulkan returns false for windows surface

vkGetPhysicalDeviceSurfaceSupportKHR returns false for a windows based surface - board didn’t allow the title because the words are too long.

I have a working Vulkan platform working with GLFW and it’s solid, but lacks a GUI framework.

I’m trying to integrate it into WxWidgets, changing from WxWidgets to another GUI is not a viable answer for this use case.

I’m using this example code (from Overview - Vulkan Tutorial), with a valid HWND

VkWin32SurfaceCreateInfoKHR createInfo{};
createInfo.hwnd = myHWND; // instead of glfwGetWin32Window(window);
createInfo.hinstance = GetModuleHandle(nullptr);

The tutorial states that " The glfwCreateWindowSurface function performs exactly this operation with a different implementation for each platform."

When I use glfwCreateWindowSurface vkGetPhysicalDeviceSurfaceSupportKHR returns true for all queues.

When I use the example code, supposedly identical, on an HWND created by WxWidgets, it returns false.

The two are not identical. I’m currently digging through all the source code for Vulkan and GLFW to find what the difference is.

Is this behavior correct?

Can I skip this test as a work around?

Is there another workaround?

But it didn’t do it with your HWND. GLFW did it with an HWND that GLFW created internally for the explicit purpose of being used with Vulkan.

Did you create your HWND in a way that would allow it to be used with a Vulkan surface?

Obviously not, because WxWidgets creates the window/HWND as a black box.

This is the primary issue of connecting Vulkan with WxWidgets, because they create the window I need to use.

The updated questions are,

Is it possible to make WxWidgets create a compatible window? Since WxW is provided as source, it should be possible to change it - but that could be a large job.

Is there a work around if it can’t?

I’ve read something about telling WxWidgets to use GLFW as it’s windowing system, but I’ve only seen comments that such a thing exists and no explanation as to how to enable it.

Follow up.

There are many questions about doing this on the WxWidget forums, many hints it can be done - but no posted solutions.

The problem was both obvious, subtle and stupid.
The following extensions are both required, and I had read that.


However, in the example I was using they used “VK_KHR_surface” instead of its macro - VK_KHR_SURFACE_EXTENSION_NAME. I had attempted to use VK_KHR_surface (unquoted) for the macro, searched for a macro of that name, could not find one and incorrectly assumed it was deprecated. So I removed it.

Thanks to Jim Orcheson’s GitHub - jimorc/wxVulkanTutorial, it clarified the problem and vkCreateWin32SurfaceKHR now creates a surface which is usable by Vulkan.