Function fermium::vulkan::SDL_Vulkan_LoadLibrary [−][src]
pub unsafe extern "C" fn SDL_Vulkan_LoadLibrary(path: *const c_char) -> c_int
Dynamically load a Vulkan loader library.
- [in]
path
The platform dependent Vulkan loader library name, orNULL
.
Returns: 0
on success, or -1
if the library couldn’t be loaded.
If path
is NULL
, SDL will use the value of the environment variable
SDL_VULKAN_LIBRARY
, if set, otherwise it loads the default 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.
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-NULL path
, an application should retrieve all
of the Vulkan functions it uses from the dynamic library using
SDL_Vulkan_GetVkGetInstanceProcAddr
unless you can guarantee
path
points to the same vulkan loader library the application
linked to.
On Apple devices, if path
is NULL, 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 then, on macOS, SDL
will attempt to load vulkan.framework/vulkan
, libvulkan.1.dylib
,
followed by libvulkan.dylib
, in that order.
On iOS SDL will attempt to load libvulkan.dylib
only. 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.
This function will fail if there are no working Vulkan drivers installed.
See Also: SDL_Vulkan_GetVkGetInstanceProcAddr
,
SDL_Vulkan_UnloadLibrary