OpenGL & Vulkan windowsSDL 3.2
SDL_Vulkan_GetInstanceExtensions
Lists the Vulkan instance extensions needed to show images in an SDL window on this system.
Signature
char const * const * SDL_Vulkan_GetInstanceExtensions(Uint32 *count);
How it works
Vulkan itself knows nothing about windows. Presenting needs platform extensions (VK_KHR_surface plus VK_KHR_win32_surface, or the X11, Wayland, Metal… one). SDL tells you which; pass them to vkCreateInstance, adding any others you want such as VK_EXT_debug_utils.
Call it after creating a window with SDL_WINDOW_VULKAN (or after SDL_Vulkan_LoadLibrary).
Parameters
countUint32 *
Receives the number of names.
Return value
An array of extension names owned by SDL (do not free), or NULL on failure.
Example
example.cpp
1Uint32 n = 0;
2const char* const* sdlExts = SDL_Vulkan_GetInstanceExtensions(&n);
3std::vector<const char*> exts(sdlExts, sdlExts + n);
4exts.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
5VkInstanceCreateInfo ci{VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO};
6ci.enabledExtensionCount = Uint32(exts.size());
7ci.ppEnabledExtensionNames = exts.data();