SDL_Vulkan_CreateSurface "VK_KHR_win32_surface" extension not enabled

Hello everyone, I’m trying to create a simple demo program to display something over Vulkan with SDL.

However for some reason SDL_Vulkan_CreateSurface() always returns SDL_FALSE with the error message “VK_KHR_win32_surface extension is not enabled in the Vulkan instance.”.

I already checked the list of extensions (retrieved from SDL_Vulkan_GetInstanceExtensions) that gets passed over to vkCreateInstance and it does indeed include “VK_KHR_win32_surface”.

I also checked the SDL source and it seems like this statement returns NULL, causing the error:

(PFN_vkCreateWin32SurfaceKHR)vkGetInstanceProcAddr((VkInstance)instance, “vkCreateWin32SurfaceKHR”);

However, executing the exact same statement in my code returns a non-NULL value, indicating that the instance should indeed have the required extension enabled.

Did anyone encounter a similar issue or has anyone got Vulkan to work under Windows with SDL? I should probably add that I’m compiling with gcc under MinGW/MSYS2.

edit: Apparently the reason why the same statement works in my code is that it uses the Vulkan-native vkGetInstanceProcAddr function instead of the one from the SDL instance.

Once I do it over the SDL instance (using SDL_Vulkan_GetVkGetInstanceProcAddr) it also fails in my code.
I’m pretty sure I did all the required steps but maybe I’m still missing something? If somebody wants to take a look at my code I’d be happy to upload it (~200 lines).

I managed to solve it, turns out it was a problem with the wrong vulkan libraries being loaded under the environment I was working in.

After adding SDL_Vulkan_LoadLibrary(“libvulkan-1.dll”) before creating the window, SDL_Vulkan_CreateSurface now returns sucessfully.