27 #include "../../SDL_internal.h" 29 #if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_COCOA 42 #define DEFAULT_MOLTENVK "libMoltenVK.dylib" 44 #define DEFAULT_HANDLE RTLD_DEFAULT 46 int Cocoa_Vulkan_LoadLibrary(
_THIS,
const char *
path)
67 vkGetInstanceProcAddr =
69 "vkGetInstanceProcAddr");
72 if (vkGetInstanceProcAddr) {
77 path = DEFAULT_MOLTENVK;
90 if (!vkGetInstanceProcAddr) {
91 SDL_SetError(
"Failed to find %s in either executable or %s: %s",
92 "vkGetInstanceProcAddr",
94 (
const char *) dlerror());
105 extensions = SDL_Vulkan_CreateInstanceExtensionsList(
112 for (
Uint32 i = 0;
i < extensionCount;
i++) {
115 }
else if (
SDL_strcmp(VK_MVK_MACOS_SURFACE_EXTENSION_NAME, extensions[
i].extensionName) == 0) {
116 hasMacOSSurfaceExtension =
SDL_TRUE;
120 if (!hasSurfaceExtension) {
121 SDL_SetError(
"Installed MoltenVK/Vulkan doesn't implement the " 124 }
else if (!hasMacOSSurfaceExtension) {
125 SDL_SetError(
"Installed MoltenVK/Vulkan doesn't implement the " 126 VK_MVK_MACOS_SURFACE_EXTENSION_NAME
"extension");
137 void Cocoa_Vulkan_UnloadLibrary(
_THIS)
152 static const char *
const extensionsForCocoa[] = {
159 return SDL_Vulkan_GetInstanceExtensions_Helper(
171 PFN_vkCreateMacOSSurfaceMVK vkCreateMacOSSurfaceMVK =
173 (VkInstance)instance,
174 "vkCreateMacOSSurfaceMVK");
175 VkMacOSSurfaceCreateInfoMVK createInfo = {};
183 if (!vkCreateMacOSSurfaceMVK) {
185 " extension is not enabled in the Vulkan instance.");
189 createInfo.pNext =
NULL;
190 createInfo.flags = 0;
191 createInfo.pView = Cocoa_Mtl_AddMetalView(window);
192 result = vkCreateMacOSSurfaceMVK(instance, &createInfo,
196 SDL_Vulkan_GetResultString(result));
204 Cocoa_Mtl_GetDrawableSize(window, w, h);
#define VK_KHR_SURFACE_EXTENSION_NAME
struct SDL_VideoDevice::@35 vulkan_config
GLuint GLuint GLsizei count
GLfloat GLfloat GLfloat GLfloat h
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char *pName)
PFN_vkVoidFunction(VKAPI_PTR * PFN_vkGetInstanceProcAddr)(VkInstance instance, const char *pName)
static SDL_VideoDevice * _this
void * vkGetInstanceProcAddr
GLubyte GLubyte GLubyte GLubyte w
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
EGLSurface EGLNativeWindowType * window
The type used to identify a window.
#define SDL_arraysize(array)
GLsizei const GLchar *const * path
void * SDL_LoadFunction(void *handle, const char *name)
void * vkEnumerateInstanceExtensionProperties
VkResult(VKAPI_PTR * PFN_vkEnumerateInstanceExtensionProperties)(const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties)