mirror of
https://github.com/glfw/glfw.git
synced 2026-01-11 23:33:16 +01:00
Add glfwInitVulkanLoader
This removes the GLFW_VULKAN_STATIC CMake option and the _GLFW_VULKAN_STATIC configuration macro and replaces them with the glfwInitVulkanLoader function, allowing a single library binary to provide both behaviors. This is based on the design from PR #1374 by @pmuetschard. Closes #1374 Closes #1890
This commit is contained in:
@@ -2224,6 +2224,54 @@ GLFWAPI void glfwInitHint(int hint, int value);
|
||||
*/
|
||||
GLFWAPI void glfwInitAllocator(const GLFWallocator* allocator);
|
||||
|
||||
#if defined(VK_VERSION_1_0)
|
||||
|
||||
/*! @brief Sets the desired Vulkan `vkGetInstanceProcAddr` function.
|
||||
*
|
||||
* This function sets the `vkGetInstanceProcAddr` function that GLFW will use for all
|
||||
* Vulkan related entry point queries.
|
||||
*
|
||||
* This feature is mostly useful on macOS, if your copy of the Vulkan loader is in
|
||||
* a location where GLFW cannot find it through dynamic loading, or if you are still
|
||||
* using the static library version of the loader.
|
||||
*
|
||||
* If set to `NULL`, GLFW will try to load the Vulkan loader dynamically by its standard
|
||||
* name and get this function from there. This is the default behavior.
|
||||
*
|
||||
* The standard name of the loader is `vulkan-1.dll` on Windows, `libvulkan.so.1` on
|
||||
* Linux and other Unix-like systems and `libvulkan.1.dylib` on macOS. If your code is
|
||||
* also loading it via these names then you probably don't need to use this function.
|
||||
*
|
||||
* The function address you set is never reset by GLFW, but it only takes effect during
|
||||
* initialization. Once GLFW has been initialized, any updates will be ignored until the
|
||||
* library is terminated and initialized again.
|
||||
*
|
||||
* @param[in] loader The address of the function to use, or `NULL`.
|
||||
*
|
||||
* @par Loader function signature
|
||||
* @code
|
||||
* PFN_vkVoidFunction vkGetInstanceProcAddr(VkInstance instance, const char* name)
|
||||
* @endcode
|
||||
* For more information about this function, see the
|
||||
* [Vulkan Registry](https://www.khronos.org/registry/vulkan/).
|
||||
*
|
||||
* @errors None.
|
||||
*
|
||||
* @remark This function may be called before @ref glfwInit.
|
||||
*
|
||||
* @thread_safety This function must only be called from the main thread.
|
||||
*
|
||||
* @sa @ref vulkan_loader
|
||||
* @sa @ref glfwInit
|
||||
*
|
||||
* @since Added in version 3.4.
|
||||
*
|
||||
* @ingroup init
|
||||
*/
|
||||
GLFWAPI void glfwInitVulkanLoader(PFN_vkGetInstanceProcAddr loader);
|
||||
|
||||
#endif /*VK_VERSION_1_0*/
|
||||
|
||||
/*! @brief Retrieves the version of the GLFW library.
|
||||
*
|
||||
* This function retrieves the major, minor and revision numbers of the GLFW
|
||||
|
||||
Reference in New Issue
Block a user