summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar liamwhite2023-08-22 13:10:26 -0400
committerGravatar GitHub2023-08-22 13:10:26 -0400
commitbc4ad5e62d6d9a8e81a56ce70b33dd3e8ae7bd5d (patch)
tree7b3354dd90ada7fabb5efa93a5f2a8c8892c6da8 /src
parentMerge pull request #11303 from lat9nq/screenshots-configurable (diff)
parentAdd macos moltenvk bundle, Add copy moltevk dylib script (diff)
downloadyuzu-bc4ad5e62d6d9a8e81a56ce70b33dd3e8ae7bd5d.tar.gz
yuzu-bc4ad5e62d6d9a8e81a56ce70b33dd3e8ae7bd5d.tar.xz
yuzu-bc4ad5e62d6d9a8e81a56ce70b33dd3e8ae7bd5d.zip
Merge pull request #11302 from vonchenplus/vulkan_macos
Add macos moltenvk bundle, Add copy moltevk dylib script
Diffstat (limited to 'src')
-rw-r--r--src/video_core/vulkan_common/vulkan_instance.cpp8
-rw-r--r--src/video_core/vulkan_common/vulkan_library.cpp16
-rw-r--r--src/yuzu/CMakeLists.txt12
3 files changed, 27 insertions, 9 deletions
diff --git a/src/video_core/vulkan_common/vulkan_instance.cpp b/src/video_core/vulkan_common/vulkan_instance.cpp
index 72aedb8d8..bc16145be 100644
--- a/src/video_core/vulkan_common/vulkan_instance.cpp
+++ b/src/video_core/vulkan_common/vulkan_instance.cpp
@@ -41,9 +41,6 @@ namespace {
41 bool enable_validation) { 41 bool enable_validation) {
42 std::vector<const char*> extensions; 42 std::vector<const char*> extensions;
43 extensions.reserve(6); 43 extensions.reserve(6);
44#ifdef __APPLE__
45 extensions.push_back(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME);
46#endif
47 switch (window_type) { 44 switch (window_type) {
48 case Core::Frontend::WindowSystemType::Headless: 45 case Core::Frontend::WindowSystemType::Headless:
49 break; 46 break;
@@ -74,6 +71,11 @@ namespace {
74 if (window_type != Core::Frontend::WindowSystemType::Headless) { 71 if (window_type != Core::Frontend::WindowSystemType::Headless) {
75 extensions.push_back(VK_KHR_SURFACE_EXTENSION_NAME); 72 extensions.push_back(VK_KHR_SURFACE_EXTENSION_NAME);
76 } 73 }
74#ifdef __APPLE__
75 if (AreExtensionsSupported(dld, std::array{VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME})) {
76 extensions.push_back(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME);
77 }
78#endif
77 if (enable_validation) { 79 if (enable_validation) {
78 const bool debug_utils = 80 const bool debug_utils =
79 AreExtensionsSupported(dld, std::array{VK_EXT_DEBUG_UTILS_EXTENSION_NAME}); 81 AreExtensionsSupported(dld, std::array{VK_EXT_DEBUG_UTILS_EXTENSION_NAME});
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<Common::DynamicLibrary> OpenLibrary(
19#else 19#else
20 auto library = std::make_shared<Common::DynamicLibrary>(); 20 auto library = std::make_shared<Common::DynamicLibrary>();
21#ifdef __APPLE__ 21#ifdef __APPLE__
22 const auto libvulkan_filename =
23 Common::FS::GetBundleDirectory() / "Contents/Frameworks/libvulkan.1.dylib";
24 const auto libmoltenvk_filename =
25 Common::FS::GetBundleDirectory() / "Contents/Frameworks/libMoltenVK.dylib";
26 const char* library_paths[] = {std::getenv("LIBVULKAN_PATH"), libvulkan_filename.c_str(),
27 libmoltenvk_filename.c_str()};
22 // Check if a path to a specific Vulkan library has been specified. 28 // Check if a path to a specific Vulkan library has been specified.
23 char* const libvulkan_env = std::getenv("LIBVULKAN_PATH"); 29 for (const auto& library_path : library_paths) {
24 if (!libvulkan_env || !library->Open(libvulkan_env)) { 30 if (library_path && library->Open(library_path)) {
25 // Use the libvulkan.dylib from the application bundle. 31 break;
26 const auto filename = 32 }
27 Common::FS::GetBundleDirectory() / "Contents/Frameworks/libvulkan.dylib";
28 void(library->Open(Common::FS::PathToUTF8String(filename).c_str()));
29 } 33 }
30#else 34#else
31 std::string filename = Common::DynamicLibrary::GetVersionedFilename("vulkan", 1); 35 std::string filename = Common::DynamicLibrary::GetVersionedFilename("vulkan", 1);
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt
index 2e4da696c..8f86a1553 100644
--- a/src/yuzu/CMakeLists.txt
+++ b/src/yuzu/CMakeLists.txt
@@ -313,6 +313,18 @@ if (APPLE)
313 target_sources(yuzu PRIVATE ${MACOSX_ICON}) 313 target_sources(yuzu PRIVATE ${MACOSX_ICON})
314 set_target_properties(yuzu PROPERTIES MACOSX_BUNDLE TRUE) 314 set_target_properties(yuzu PROPERTIES MACOSX_BUNDLE TRUE)
315 set_target_properties(yuzu PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist) 315 set_target_properties(yuzu PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
316
317 if (NOT USE_SYSTEM_MOLTENVK)
318 set(MOLTENVK_PLATFORM "macOS")
319 set(MOLTENVK_VERSION "v1.2.5")
320 download_moltenvk_external(${MOLTENVK_PLATFORM} ${MOLTENVK_VERSION})
321 endif()
322 find_library(MOLTENVK_LIBRARY MoltenVK REQUIRED)
323 message(STATUS "Using MoltenVK at ${MOLTENVK_LIBRARY}.")
324 set_source_files_properties(${MOLTENVK_LIBRARY} PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks
325 XCODE_FILE_ATTRIBUTES "CodeSignOnCopy")
326 target_sources(yuzu PRIVATE ${MOLTENVK_LIBRARY})
327
316elseif(WIN32) 328elseif(WIN32)
317 # compile as a win32 gui application instead of a console application 329 # compile as a win32 gui application instead of a console application
318 if (QT_VERSION VERSION_GREATER_EQUAL 6) 330 if (QT_VERSION VERSION_GREATER_EQUAL 6)