use older macOS surface
This commit is contained in:
@@ -10,7 +10,8 @@
|
||||
#ifdef _WIN32
|
||||
#define VK_USE_PLATFORM_WIN32_KHR
|
||||
#elif defined(__APPLE__)
|
||||
#define VK_USE_PLATFORM_METAL_EXT
|
||||
//#define VK_USE_PLATFORM_METAL_EXT
|
||||
#define VK_USE_PLATFORM_MACOS_MVK
|
||||
#elif defined(__ANDROID__)
|
||||
#define VK_USE_PLATFORM_ANDROID_KHR
|
||||
#elif defined(__HAIKU__)
|
||||
@@ -22,6 +23,9 @@
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
#ifndef VK_EXT_METAL_SURFACE_EXTENSION_NAME
|
||||
# define VK_EXT_METAL_SURFACE_EXTENSION_NAME "VK_EXT_metal_surface"
|
||||
#endif
|
||||
#ifndef VK_MVK_MACOS_SURFACE_EXTENSION_NAME
|
||||
# define VK_MVK_MACOS_SURFACE_EXTENSION_NAME "VK_MVK_macos_surface"
|
||||
#endif
|
||||
|
||||
@@ -32,14 +32,14 @@ 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) {
|
||||
// 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
|
||||
@@ -56,7 +56,7 @@ vk::SurfaceKHR CreateSurface(
|
||||
throw vk::Exception(VK_ERROR_INITIALIZATION_FAILED);
|
||||
}
|
||||
LOG_ERROR(Render_Vulkan, "Failed to initialize Metal/macOS surface");
|
||||
}
|
||||
// }
|
||||
}
|
||||
#elif defined(__ANDROID__)
|
||||
if (window_info.type == Core::Frontend::WindowSystemType::Android) {
|
||||
|
||||
Reference in New Issue
Block a user