[][src]Function sdl2_sys::SDL_Vulkan_LoadLibrary

pub unsafe extern "C" fn SDL_Vulkan_LoadLibrary(path: *const c_char) -> c_int

\brief Dynamically load a Vulkan loader library.

\param [in] path The platform dependent Vulkan loader library name, or \c NULL.

\return \c 0 on success, or \c -1 if the library couldn't be loaded.

If \a path is NULL SDL will use the value of the environment variable \c 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.

\note It is fairly common for Vulkan applications to link with \a 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.

\note If you specify a non-NULL \c path, an application should retrieve all of the Vulkan functions it uses from the dynamic library using \c SDL_Vulkan_GetVkGetInstanceProcAddr() unless you can guarantee \c path points to the same vulkan loader library the application linked to.

\note On Apple devices, if \a 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 \c vulkan.framework/vulkan, \c libvulkan.1.dylib, followed by \c libvulkan.dylib, in that order. On iOS SDL will attempt to load \c libvulkan.dylib only. Applications using a dynamic framework or .dylib must ensure it is included in its application bundle.

\note 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.

\note This function will fail if there are no working Vulkan drivers installed.

\sa SDL_Vulkan_GetVkGetInstanceProcAddr() \sa SDL_Vulkan_UnloadLibrary()