diff --git a/CMakeLists.txt b/CMakeLists.txt index dac3b19ab..30a048278 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -901,11 +901,11 @@ endif() if (APPLE) if (ENABLE_QT_GUI) # Include MoltenVK in the app bundle, along with an ICD file so it can be found by the system Vulkan loader if used for loading layers. - target_sources(shadps4 PRIVATE externals/MoltenVK/MoltenVK_icd.json) - set_source_files_properties(externals/MoltenVK/MoltenVK_icd.json - PROPERTIES MACOSX_PACKAGE_LOCATION Resources/vulkan/icd.d) - add_custom_command(TARGET shadps4 POST_BUILD - COMMAND cmake -E copy $ $/Contents/Frameworks/libMoltenVK.dylib) + set(MVK_DYLIB ${CMAKE_CURRENT_BINARY_DIR}/externals/MoltenVK/libMoltenVK.dylib) + set(MVK_ICD ${CMAKE_CURRENT_SOURCE_DIR}/externals/MoltenVK/MoltenVK_icd.json) + target_sources(shadps4 PRIVATE ${MVK_DYLIB} ${MVK_ICD}) + set_source_files_properties(${MVK_DYLIB} PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks) + set_source_files_properties(${MVK_ICD} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/vulkan/icd.d) set_property(TARGET shadps4 APPEND PROPERTY BUILD_RPATH "@executable_path/../Frameworks") else() # For non-bundled SDL build, just do a normal library link. diff --git a/src/video_core/renderer_vulkan/vk_platform.cpp b/src/video_core/renderer_vulkan/vk_platform.cpp index dbdabe0d9..ab61af6a4 100644 --- a/src/video_core/renderer_vulkan/vk_platform.cpp +++ b/src/video_core/renderer_vulkan/vk_platform.cpp @@ -137,6 +137,7 @@ std::vector GetInstanceExtensions(Frontend::WindowSystemType window // Add the windowing system specific extension std::vector extensions; extensions.reserve(7); + extensions.push_back(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME); switch (window_type) { case Frontend::WindowSystemType::Headless: @@ -347,6 +348,17 @@ vk::UniqueInstance CreateInstance(Frontend::WindowSystemType window_type, bool e .valueCount = 1, .pValues = &enable_force_barriers, }, +#ifdef __APPLE__ + // MoltenVK debug mode turns on additional device loss error details, so + // use the crash diagnostic setting as an indicator of whether to turn it on. + vk::LayerSettingEXT{ + .pLayerName = "MoltenVK", + .pSettingName = "MVK_CONFIG_DEBUG", + .type = vk::LayerSettingTypeEXT::eBool32, + .valueCount = 1, + .pValues = &enable_crash_diagnostic, + } +#endif }; vk::StructureChain instance_ci_chain = {