From 87022a4833fd693274275e1153d80d2e56fe0b11 Mon Sep 17 00:00:00 2001 From: Feng Chen Date: Thu, 17 Aug 2023 09:17:56 +0800 Subject: Add macos moltenvk bundle, Add copy moltevk dylib script --- src/video_core/vulkan_common/vulkan_library.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/video_core/vulkan_common/vulkan_library.cpp') diff --git a/src/video_core/vulkan_common/vulkan_library.cpp b/src/video_core/vulkan_common/vulkan_library.cpp index 47f6f2a03..0130f6a0d 100644 --- a/src/video_core/vulkan_common/vulkan_library.cpp +++ b/src/video_core/vulkan_common/vulkan_library.cpp @@ -19,13 +19,17 @@ std::shared_ptr OpenLibrary( #else auto library = std::make_shared(); #ifdef __APPLE__ + const auto libvulkan_filename = + Common::FS::GetBundleDirectory() / "Contents/Frameworks/libvulkan.1.dylib"; + const auto libmoltenvk_filename = + Common::FS::GetBundleDirectory() / "Contents/Frameworks/libMoltenVK.dylib"; + const char* library_paths[] = {std::getenv("LIBVULKAN_PATH"), libvulkan_filename.c_str(), + libmoltenvk_filename.c_str()}; // Check if a path to a specific Vulkan library has been specified. - char* const libvulkan_env = std::getenv("LIBVULKAN_PATH"); - if (!libvulkan_env || !library->Open(libvulkan_env)) { - // Use the libvulkan.dylib from the application bundle. - const auto filename = - Common::FS::GetBundleDirectory() / "Contents/Frameworks/libvulkan.dylib"; - void(library->Open(Common::FS::PathToUTF8String(filename).c_str())); + for (const auto& library_path : library_paths) { + if (library_path && library->Open(library_path)) { + break; + } } #else std::string filename = Common::DynamicLibrary::GetVersionedFilename("vulkan", 1); -- cgit v1.2.3