instance stuffs

This commit is contained in:
lizzie 2025-11-28 05:50:11 +00:00
parent 629ca92420
commit 28a10ff6fc
2 changed files with 13 additions and 10 deletions

View File

@ -48,7 +48,7 @@ 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_MACOS_SURFACE_EXTENSION_NAME);
//extensions.push_back(VK_MVK_MOLTENVK_EXTENSION_NAME);
break;
#elif defined(__ANDROID__)

View File

@ -32,14 +32,15 @@ vk::SurfaceKHR CreateSurface(
}
#elif defined(__APPLE__)
if (window_info.type == Core::Frontend::WindowSystemType::Cocoa) {
// 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),
// };
// const auto vkCreateMetalSurfaceEXT = reinterpret_cast<PFN_vkCreateMetalSurfaceEXT>(dld.vkGetInstanceProcAddr(*instance, "vkCreateMetalSurfaceEXT"));
// if (!vkCreateMetalSurfaceEXT || vkCreateMetalSurfaceEXT(*instance, &metal_ci, nullptr, &unsafe_surface) != VK_SUCCESS) {
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),
};
const auto vkCreateMetalSurfaceEXT = reinterpret_cast<PFN_vkCreateMetalSurfaceEXT>(dld.vkGetInstanceProcAddr(*instance, "vkCreateMetalSurfaceEXT"));
if (!vkCreateMetalSurfaceEXT || vkCreateMetalSurfaceEXT(*instance, &metal_ci, nullptr, &unsafe_surface) != VK_SUCCESS) {
#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
@ -55,8 +56,10 @@ 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__)
if (window_info.type == Core::Frontend::WindowSystemType::Android) {