summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-08-22 19:10:26 +0200
committerGitHub <noreply@github.com>2023-08-22 19:10:26 +0200
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
yuzu-bc4ad5e62d6d9a8e81a56ce70b33dd3e8ae7bd5d.tar.gz
yuzu-bc4ad5e62d6d9a8e81a56ce70b33dd3e8ae7bd5d.tar.bz2
yuzu-bc4ad5e62d6d9a8e81a56ce70b33dd3e8ae7bd5d.tar.lz
yuzu-bc4ad5e62d6d9a8e81a56ce70b33dd3e8ae7bd5d.tar.xz
yuzu-bc4ad5e62d6d9a8e81a56ce70b33dd3e8ae7bd5d.tar.zst
yuzu-bc4ad5e62d6d9a8e81a56ce70b33dd3e8ae7bd5d.zip
Diffstat (limited to '')
-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 {
bool enable_validation) {
std::vector<const char*> extensions;
extensions.reserve(6);
-#ifdef __APPLE__
- extensions.push_back(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME);
-#endif
switch (window_type) {
case Core::Frontend::WindowSystemType::Headless:
break;
@@ -74,6 +71,11 @@ namespace {
if (window_type != Core::Frontend::WindowSystemType::Headless) {
extensions.push_back(VK_KHR_SURFACE_EXTENSION_NAME);
}
+#ifdef __APPLE__
+ if (AreExtensionsSupported(dld, std::array{VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME})) {
+ extensions.push_back(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME);
+ }
+#endif
if (enable_validation) {
const bool debug_utils =
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(
#else
auto library = std::make_shared<Common::DynamicLibrary>();
#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);
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)
target_sources(yuzu PRIVATE ${MACOSX_ICON})
set_target_properties(yuzu PROPERTIES MACOSX_BUNDLE TRUE)
set_target_properties(yuzu PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
+
+ if (NOT USE_SYSTEM_MOLTENVK)
+ set(MOLTENVK_PLATFORM "macOS")
+ set(MOLTENVK_VERSION "v1.2.5")
+ download_moltenvk_external(${MOLTENVK_PLATFORM} ${MOLTENVK_VERSION})
+ endif()
+ find_library(MOLTENVK_LIBRARY MoltenVK REQUIRED)
+ message(STATUS "Using MoltenVK at ${MOLTENVK_LIBRARY}.")
+ set_source_files_properties(${MOLTENVK_LIBRARY} PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks
+ XCODE_FILE_ATTRIBUTES "CodeSignOnCopy")
+ target_sources(yuzu PRIVATE ${MOLTENVK_LIBRARY})
+
elseif(WIN32)
# compile as a win32 gui application instead of a console application
if (QT_VERSION VERSION_GREATER_EQUAL 6)