mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-10-27 18:02:16 +00:00
@@ -32,14 +32,32 @@ vk::SurfaceKHR CreateSurface(
|
|||||||
}
|
}
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
if (window_info.type == Core::Frontend::WindowSystemType::Cocoa) {
|
if (window_info.type == Core::Frontend::WindowSystemType::Cocoa) {
|
||||||
const VkMetalSurfaceCreateInfoEXT macos_ci = {
|
const VkMetalSurfaceCreateInfoEXT metal_ci = {
|
||||||
|
.sType = VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT,
|
||||||
|
.pNext = nullptr,
|
||||||
|
.flags = 0,
|
||||||
.pLayer = static_cast<const CAMetalLayer*>(window_info.render_surface),
|
.pLayer = static_cast<const CAMetalLayer*>(window_info.render_surface),
|
||||||
};
|
};
|
||||||
const auto vkCreateMetalSurfaceEXT = reinterpret_cast<PFN_vkCreateMetalSurfaceEXT>(
|
const auto vkCreateMetalSurfaceEXT = reinterpret_cast<PFN_vkCreateMetalSurfaceEXT>(dld.vkGetInstanceProcAddr(*instance, "vkCreateMetalSurfaceEXT"));
|
||||||
dld.vkGetInstanceProcAddr(*instance, "vkCreateMetalSurfaceEXT"));
|
if (!vkCreateMetalSurfaceEXT || vkCreateMetalSurfaceEXT(*instance, &metal_ci, nullptr, &unsafe_surface) != VK_SUCCESS) {
|
||||||
if (!vkCreateMetalSurfaceEXT ||
|
// TODO: Way to fallback? - where's my vulkan headers
|
||||||
vkCreateMetalSurfaceEXT(*instance, &macos_ci, nullptr, &unsafe_surface) != VK_SUCCESS) {
|
#if 0
|
||||||
LOG_ERROR(Render_Vulkan, "Failed to initialize Metal surface");
|
// 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
|
||||||
|
const VkMacOSSurfaceCreateInfoMVK macos_legacy_ci = {
|
||||||
|
.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK,
|
||||||
|
.pNext = nullptr,
|
||||||
|
.flags = 0,
|
||||||
|
.pView = static_cast<const void*>(window_info.render_surface),
|
||||||
|
};
|
||||||
|
const auto vkCreateMacOSSurfaceMVK = reinterpret_cast<PFN_vkCreateMacOSSurfaceMVK>(dld.vkGetInstanceProcAddr(*instance, "vkCreateMacOSSurfaceMVK"));
|
||||||
|
if (!vkCreateMacOSSurfaceMVK || vkCreateMacOSSurfaceMVK(*instance, &macos_legacy_ci, nullptr, &unsafe_surface) != VK_SUCCESS) {
|
||||||
|
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);
|
throw vk::Exception(VK_ERROR_INITIALIZATION_FAILED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user