diff options
| author | Diesel <dev.diesel@proton.me> | 2026-11-21 22:44:07 +0100 |
|---|---|---|
| committer | Diesel <dev.diesel@proton.me> | 2026-11-21 22:44:07 +0100 |
| commit | 5c1a1fbb6bf6f609eb4e61baa4961ce382743a4e (patch) | |
| tree | ac8ad90058b97ab241fdc65edae3d4628d20ee1e /runtime/test/vulkan_loader.h | |
| parent | c45309e29f21c1d5b75678db0e2dc2dd11cff25b (diff) | |
| parent | 4e390e0871d7265e629b51aca8ff99a15a6a6845 (diff) | |
Merge main to include the compute Y/Z harness test fix
Diffstat (limited to 'runtime/test/vulkan_loader.h')
| -rw-r--r-- | runtime/test/vulkan_loader.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/runtime/test/vulkan_loader.h b/runtime/test/vulkan_loader.h index 43a54d242..a1a461ef0 100644 --- a/runtime/test/vulkan_loader.h +++ b/runtime/test/vulkan_loader.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | // Loads the Vulkan loader at run time: vulkan-1.dll on Windows, libvulkan.so.1 elsewhere. No import library. | 1 | // Loads the Vulkan loader at run time: vulkan-1.dll on Windows, MoltenVK on macOS, libvulkan.so.1 elsewhere. No import library. |
| 2 | #pragma once | 2 | #pragma once |
| 3 | 3 | ||
| 4 | #ifndef VK_NO_PROTOTYPES | 4 | #ifndef VK_NO_PROTOTYPES |
| @@ -20,6 +20,15 @@ inline PFN_vkGetInstanceProcAddr load_vulkan() { | |||
| 20 | constexpr auto library_name = "vulkan-1.dll"; | 20 | constexpr auto library_name = "vulkan-1.dll"; |
| 21 | static const auto library = LoadLibraryA(library_name); | 21 | static const auto library = LoadLibraryA(library_name); |
| 22 | const auto entry = library ? GetProcAddress(library, "vkGetInstanceProcAddr") : nullptr; | 22 | const auto entry = library ? GetProcAddress(library, "vkGetInstanceProcAddr") : nullptr; |
| 23 | #elif defined(__APPLE__) | ||
| 24 | // MoltenVK directly: through the loader it is a portability driver, which every vkCreateInstance here would | ||
| 25 | // have to opt into. The Vulkan SDK installs it in /usr/local/lib (a default search path), Homebrew does not. | ||
| 26 | constexpr auto library_name = "libMoltenVK.dylib"; | ||
| 27 | static const auto library = [] { | ||
| 28 | auto handle = dlopen(library_name, RTLD_NOW | RTLD_LOCAL); | ||
| 29 | return handle ? handle : dlopen("/opt/homebrew/lib/libMoltenVK.dylib", RTLD_NOW | RTLD_LOCAL); | ||
| 30 | }(); | ||
| 31 | const auto entry = library ? dlsym(library, "vkGetInstanceProcAddr") : nullptr; | ||
| 23 | #else | 32 | #else |
| 24 | constexpr auto library_name = "libvulkan.so.1"; | 33 | constexpr auto library_name = "libvulkan.so.1"; |
| 25 | static const auto library = dlopen(library_name, RTLD_NOW | RTLD_LOCAL); | 34 | static const auto library = dlopen(library_name, RTLD_NOW | RTLD_LOCAL); |