|
7 | 7 |
|
8 | 8 | // See https://github.com/KhronosGroup/Vulkan-Hpp?tab=readme-ov-file#extensions--per-device-function-pointers- |
9 | 9 | #define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1 |
| 10 | +// We use VULKAN_HPP_DEFAULT_DISPATCHER, but not VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE |
| 11 | +// to avoid conflicts with applications or other libraries who might use it. |
| 12 | +namespace vk::detail { class DispatchLoaderDynamic; } |
| 13 | +vk::detail::DispatchLoaderDynamic & ggml_vk_default_dispatcher(); |
| 14 | +#define VULKAN_HPP_DEFAULT_DISPATCHER ggml_vk_default_dispatcher() |
10 | 15 |
|
11 | 16 | #include <vulkan/vulkan.hpp> |
12 | 17 |
|
13 | | -// See https://github.com/KhronosGroup/Vulkan-Hpp?tab=readme-ov-file#extensions--per-device-function-pointers- |
14 | | -VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE |
15 | | - |
16 | 18 | #include <algorithm> |
17 | 19 | #include <cmath> |
18 | 20 | #include <iomanip> |
@@ -4508,14 +4510,20 @@ static bool ggml_vk_instance_portability_enumeration_ext_available(const std::ve |
4508 | 4510 | static bool ggml_vk_instance_debug_utils_ext_available(const std::vector<vk::ExtensionProperties> & instance_extensions); |
4509 | 4511 | static bool ggml_vk_device_is_supported(const vk::PhysicalDevice & vkdev); |
4510 | 4512 |
|
| 4513 | +static vk::detail::DispatchLoaderDynamic ggml_vk_default_dispatcher_instance; |
| 4514 | + |
| 4515 | +vk::detail::DispatchLoaderDynamic & ggml_vk_default_dispatcher() { |
| 4516 | + return ggml_vk_default_dispatcher_instance; |
| 4517 | +} |
| 4518 | + |
4511 | 4519 | static void ggml_vk_instance_init() { |
4512 | 4520 | if (vk_instance_initialized) { |
4513 | 4521 | return; |
4514 | 4522 | } |
4515 | 4523 | VK_LOG_DEBUG("ggml_vk_instance_init()"); |
4516 | 4524 |
|
4517 | 4525 | // See https://github.com/KhronosGroup/Vulkan-Hpp?tab=readme-ov-file#extensions--per-device-function-pointers- |
4518 | | - VULKAN_HPP_DEFAULT_DISPATCHER.init(vkGetInstanceProcAddr); |
| 4526 | + ggml_vk_default_dispatcher_instance.init(vkGetInstanceProcAddr); |
4519 | 4527 |
|
4520 | 4528 | uint32_t api_version = vk::enumerateInstanceVersion(); |
4521 | 4529 |
|
|
0 commit comments