SDL_Vulkan_GetInstanceExtensions() returns VK_KHR_xlib_surface instead of VK_KHR_wayland_surface

Is there a way to get SDL to prefer wayland over x11? Running echo $XDG_SESSION_TYPE returns wayland so I was expecting the wayland extension to be returned. Thanks for any insight!

I ran into a similar issue when running SDL_Vulkan_CreateSurface(window, instance, NULL, &surface)

Error:
VK_KHR_xlib_surface extension is not enabled in the Vulkan instance.

I finally started learning Vulkan the other day and I was hoping to use SDL3 as windowing and event management.
Since Wayland and X11 are both installed on my system, perhaps I can just switch to the X11 desktop as a quick fix.
I’m curious if anyone has a simple fix for this issue? Is it something in the SDL_Hints section?
I’ll do some digging and report back if I find anything.
[For context, I built and reinstalled SDL3 from github today to make sure I have the latest version, XUbuntu base with Gnome as the daily desktop environment, and with the vulkan development libs installed]

So, yes there is a hint to specify Wayland: SDL_SetHint(SDL_HINT_VIDEO_DRIVER, "wayland");
Make sure to set the hint before SDL_Init();

Unfortunately, I’m now getting this error message:

VK_KHR_wayland_surface extension is not enabled in the Vulkan instance

(Note it is now a wayland surface)

Solution:
Looking further into my own error, it looks like I was supposed to enable the extension by requesting it before creating the vulkan instance. So my error is not actually an SDL issue, but rather an issue of me likely missing a step in whatever Vulkan tutorial I was following.

At this point I’m going to not enable the wayland video driver in my own project since the xWayland route should run on both systems. (Basically xWayland is a compatibility layer that runs X11 programs in a Wayland environment, and SDL defaults to using it). This will be an issue on the day that Wayland decides to fully divorce itself from X11, but until then I appreciate the small reduction in complexity of my code.