summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-07-02 04:38:26 +0200
committerGitHub <noreply@github.com>2023-07-02 04:38:26 +0200
commitae7e9b54692741a706610cb228da9631db939771 (patch)
treea8b9813e124b39e067c179032dd7f3b215487266 /src/video_core
parentMerge pull request #10970 from Morph1984/thing (diff)
parentyuzu: Use test window with VulkanSurface to check for present modes. (diff)
downloadyuzu-ae7e9b54692741a706610cb228da9631db939771.tar
yuzu-ae7e9b54692741a706610cb228da9631db939771.tar.gz
yuzu-ae7e9b54692741a706610cb228da9631db939771.tar.bz2
yuzu-ae7e9b54692741a706610cb228da9631db939771.tar.lz
yuzu-ae7e9b54692741a706610cb228da9631db939771.tar.xz
yuzu-ae7e9b54692741a706610cb228da9631db939771.tar.zst
yuzu-ae7e9b54692741a706610cb228da9631db939771.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/vulkan_common/vulkan_instance.cpp6
-rw-r--r--src/video_core/vulkan_common/vulkan_surface.cpp17
-rw-r--r--src/video_core/vulkan_common/vulkan_wrapper.h2
3 files changed, 12 insertions, 13 deletions
diff --git a/src/video_core/vulkan_common/vulkan_instance.cpp b/src/video_core/vulkan_common/vulkan_instance.cpp
index 7624a9b32..6a294c1da 100644
--- a/src/video_core/vulkan_common/vulkan_instance.cpp
+++ b/src/video_core/vulkan_common/vulkan_instance.cpp
@@ -19,11 +19,9 @@
#include <windows.h>
// ensure include order
#include <vulkan/vulkan_win32.h>
-#elif defined(__APPLE__)
-#include <vulkan/vulkan_macos.h>
#elif defined(__ANDROID__)
#include <vulkan/vulkan_android.h>
-#else
+#elif !defined(__APPLE__)
#include <X11/Xlib.h>
#include <vulkan/vulkan_wayland.h>
#include <vulkan/vulkan_xlib.h>
@@ -68,7 +66,7 @@ namespace {
break;
#elif defined(__APPLE__)
case Core::Frontend::WindowSystemType::Cocoa:
- extensions.push_back(VK_MVK_MACOS_SURFACE_EXTENSION_NAME);
+ extensions.push_back(VK_EXT_METAL_SURFACE_EXTENSION_NAME);
break;
#elif defined(__ANDROID__)
case Core::Frontend::WindowSystemType::Android:
diff --git a/src/video_core/vulkan_common/vulkan_surface.cpp b/src/video_core/vulkan_common/vulkan_surface.cpp
index c34599365..cfea4cd7b 100644
--- a/src/video_core/vulkan_common/vulkan_surface.cpp
+++ b/src/video_core/vulkan_common/vulkan_surface.cpp
@@ -11,11 +11,9 @@
#include <windows.h>
// ensure include order
#include <vulkan/vulkan_win32.h>
-#elif defined(__APPLE__)
-#include <vulkan/vulkan_macos.h>
#elif defined(__ANDROID__)
#include <vulkan/vulkan_android.h>
-#else
+#elif !defined(__APPLE__)
#include <X11/Xlib.h>
#include <vulkan/vulkan_wayland.h>
#include <vulkan/vulkan_xlib.h>
@@ -44,12 +42,13 @@ vk::SurfaceKHR CreateSurface(
}
#elif defined(__APPLE__)
if (window_info.type == Core::Frontend::WindowSystemType::Cocoa) {
- const VkMacOSSurfaceCreateInfoMVK mvk_ci{VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK,
- nullptr, 0, window_info.render_surface};
- const auto vkCreateMacOSSurfaceMVK = reinterpret_cast<PFN_vkCreateMacOSSurfaceMVK>(
- dld.vkGetInstanceProcAddr(*instance, "vkCreateMacOSSurfaceMVK"));
- if (!vkCreateMacOSSurfaceMVK ||
- vkCreateMacOSSurfaceMVK(*instance, &mvk_ci, nullptr, &unsafe_surface) != VK_SUCCESS) {
+ const VkMetalSurfaceCreateInfoEXT macos_ci = {
+ .pLayer = static_cast<const CAMetalLayer*>(window_info.render_surface),
+ };
+ const auto vkCreateMetalSurfaceEXT = reinterpret_cast<PFN_vkCreateMetalSurfaceEXT>(
+ dld.vkGetInstanceProcAddr(*instance, "vkCreateMetalSurfaceEXT"));
+ if (!vkCreateMetalSurfaceEXT ||
+ vkCreateMetalSurfaceEXT(*instance, &macos_ci, nullptr, &unsafe_surface) != VK_SUCCESS) {
LOG_ERROR(Render_Vulkan, "Failed to initialize Metal surface");
throw vk::Exception(VK_ERROR_INITIALIZATION_FAILED);
}
diff --git a/src/video_core/vulkan_common/vulkan_wrapper.h b/src/video_core/vulkan_common/vulkan_wrapper.h
index b5e70fcd4..32bd75ad8 100644
--- a/src/video_core/vulkan_common/vulkan_wrapper.h
+++ b/src/video_core/vulkan_common/vulkan_wrapper.h
@@ -15,6 +15,8 @@
#define VK_NO_PROTOTYPES
#ifdef _WIN32
#define VK_USE_PLATFORM_WIN32_KHR
+#elif defined(__APPLE__)
+#define VK_USE_PLATFORM_METAL_EXT
#endif
#include <vulkan/vulkan.h>