SdlVulkanLoadLibrary
Dynamically load the Vulkan loader library.
This should be called after initializing the video driver, but before creating any Vulkan windows. If no Vulkan loader library is loaded, the default library will be loaded upon creation of the first Vulkan window.
SDL keeps a counter of how many times this function has been successfully called, so it is safe to call this function multiple times, so long as it is eventually paired with an equivalent number of calls to SdlVulkanUnloadLibrary. The APath
argument is ignored unless there is no library currently loaded, and and the library isn't actually unloaded until there have been an equivalent number of calls to SdlVulkanUnloadLibrary.
It is fairly common for Vulkan applications to link with libvulkan instead of explicitly loading it at run time. This will work with SDL provided the application links to a dynamic library and both it and SDL use the same search path.
If you specify a non-empty APath
, an application should retrieve all of the Vulkan functions it uses from the dynamic library using SdlVulkanGetVkGetInstanceProcAddr unless you can guarantee APath
points to the same vulkan loader library the application linked to.
On Apple devices, if APath
is empty, SDL will attempt to find the vkGetInstanceProcAddr
address within all the Mach-O images of the current process. This is because it is fairly common for Vulkan applications to link with libvulkan (and historically MoltenVK was provided as a static library). If it is not found, on macOS, SDL will attempt to load vulkan.framework/vulkan
, libvulkan.1.dylib
, MoltenVK.framework/MoltenVK
, and libMoltenVK.dylib
, in that order. On iOS, SDL will attempt to load libMoltenVK.dylib
. Applications using a dynamic framework or .dylib must ensure it is included in its application bundle.
On non-Apple devices, application linking with a static libvulkan is not supported. Either do not link to the Vulkan loader or link to a dynamic library version.
Definition
Unit: Neslib.Sdl3.Video
Parameters
APath
: String
: (Optional) platform dependent Vulkan loader library name or empty (default)L.
Exceptions
ESdlError
: Raised on failure.
See Also
Remarks
This routine is not thread safe.