enable macos surface

This commit is contained in:
lizzie 2025-11-27 01:26:28 +00:00
parent 7fb9d74a18
commit 61b131ed4e
3 changed files with 6 additions and 4 deletions

View File

@ -32,6 +32,9 @@
#ifndef VK_KHR_MAINTENANCE_9_EXTENSION_NAME
#define VK_KHR_MAINTENANCE_9_EXTENSION_NAME "VK_KHR_maintenance9"
#endif
#ifndef VK_MVK_MACOS_SURFACE_EXTENSION_NAME
#define VK_MVK_MACOS_SURFACE_EXTENSION_NAME "VK_MVK_macos_surface"
#endif
// Sanitize macros
#undef CreateEvent

View File

@ -48,6 +48,8 @@ namespace {
#elif defined(__APPLE__)
case Core::Frontend::WindowSystemType::Cocoa:
extensions.push_back(VK_EXT_METAL_SURFACE_EXTENSION_NAME);
extensions.push_back(VK_MVK_MACOS_SURFACE_EXTENSION_NAME);
//extensions.push_back(VK_MVK_MOLTENVK_EXTENSION_NAME);
break;
#elif defined(__ANDROID__)
case Core::Frontend::WindowSystemType::Android:

View File

@ -40,8 +40,7 @@ vk::SurfaceKHR CreateSurface(
};
const auto vkCreateMetalSurfaceEXT = reinterpret_cast<PFN_vkCreateMetalSurfaceEXT>(dld.vkGetInstanceProcAddr(*instance, "vkCreateMetalSurfaceEXT"));
if (!vkCreateMetalSurfaceEXT || vkCreateMetalSurfaceEXT(*instance, &metal_ci, nullptr, &unsafe_surface) != VK_SUCCESS) {
// TODO: Way to fallback? - where's my vulkan headers
#if 0
// TODO: Way to fallback? - where's my vulkan headers
// Attempt to make a macOS surface instead then...
// This is the deprecated VkMacOSSurfaceCreateInfoMVK(3) version; but should work if the above failed
// https://registry.khronos.org/vulkan/specs/latest/man/html/VkMacOSSurfaceCreateInfoMVK.html
@ -56,9 +55,7 @@ vk::SurfaceKHR CreateSurface(
LOG_ERROR(Render_Vulkan, "Failed to initialize Metal/macOS surface");
throw vk::Exception(VK_ERROR_INITIALIZATION_FAILED);
}
#endif
LOG_ERROR(Render_Vulkan, "Failed to initialize Metal/macOS surface");
throw vk::Exception(VK_ERROR_INITIALIZATION_FAILED);
}
}
#elif defined(__ANDROID__)