cocoa: untested vulkan code
Some checks failed
pyrite-dev/milsko/pipeline/head There was a failure building this commit

This commit is contained in:
IoI_xD 2026-04-14 20:03:59 -07:00
commit 065b0d824c
4 changed files with 43 additions and 0 deletions

View file

@ -26,6 +26,9 @@
#ifdef USE_WAYLAND
#include <vulkan/vulkan_wayland.h>
#endif
#ifdef USE_COCOA
#include <vulkan/vulkan_metal.h>
#endif
#ifdef HAS_VK_ENUM_STRING_HELPER
#include <vulkan/vk_enum_string_helper.h>
@ -167,6 +170,8 @@ static void destroy(MwWidget handle) {
static void* vulkan_lib_load() {
#ifdef _WIN32
return MwDynamicOpen("vulkan-1.dll");
#elif defined(__APPLE__)
return MwDynamicOpen("libvulkan.dylib");
#else
return MwDynamicOpen("libvulkan.so");
#endif
@ -230,6 +235,11 @@ static int vulkan_instance_setup(MwWidget handle, vulkan_t* o) {
MwWaylandAlwaysRender = MwTRUE;
}
#endif
#ifdef USE_WAYLAND
if(handle->lowlevel->common.type == MwLLBackendCocoa) {
arrput(enabledExtensions, VK_EXT_METAL_SURFACE_EXTENSION_NAME);
}
#endif
/* passing null gives us all the extensions provided by the current vulkan implementation */
VK_CMD(_vkEnumerateInstanceExtensionProperties(NULL, &extension_count, NULL));
@ -338,6 +348,16 @@ static int vulkan_surface_setup(MwWidget handle, vulkan_t* o) {
};
VK_CMD(_vkCreateWaylandSurfaceKHR(o->vkInstance, &createInfo, NULL, &o->vkSurface));
}
#endif
#ifdef USE_COCOA
if(handle->lowlevel->common.type == MwLLBackendCocoa) {
VkMetalSurfaceCreateInfoEXT MwCocoaGetMetalSurfaceCreateInfo(MwWidget handle);
VkMetalSurfaceCreateInfoEXT inf = MwCocoaGetMetalSurfaceCreateInfo(handle);
LOAD_VK_FUNCTION(vkCreateMetalSurfaceEXT);
VK_CMD(_vkCreateMetalSurfaceEXT(o->vkInstance, &inf, NULL, &o->vkSurface));
}
#endif
return 0;
}