27 #include "../../SDL_internal.h" 29 #if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_UIKIT 42 #define DEFAULT_MOLTENVK "libMoltenVK.dylib" 45 #define DEFAULT_HANDLE RTLD_DEFAULT 47 int UIKit_Vulkan_LoadLibrary(
_THIS,
const char *
path)
68 vkGetInstanceProcAddr =
70 "vkGetInstanceProcAddr");
73 if (vkGetInstanceProcAddr) {
78 path = DEFAULT_MOLTENVK;
87 vkGetInstanceProcAddr =
90 "vkGetInstanceProcAddr");
93 if (!vkGetInstanceProcAddr) {
94 SDL_SetError(
"Failed to find %s in either executable or %s: %s",
95 "vkGetInstanceProcAddr",
97 (
const char *) dlerror());
107 SDL_SetError(
"No vkEnumerateInstanceExtensionProperties found.");
111 extensions = SDL_Vulkan_CreateInstanceExtensionsList(
120 for (
Uint32 i = 0;
i < extensionCount;
i++) {
123 }
else if (
SDL_strcmp(VK_MVK_IOS_SURFACE_EXTENSION_NAME, extensions[
i].extensionName) == 0) {
130 if (!hasSurfaceExtension) {
131 SDL_SetError(
"Installed MoltenVK/Vulkan doesn't implement the " 134 }
else if (!hasIOSSurfaceExtension) {
135 SDL_SetError(
"Installed MoltenVK/Vulkan doesn't implement the " 136 VK_MVK_IOS_SURFACE_EXTENSION_NAME
"extension");
147 void UIKit_Vulkan_UnloadLibrary(
_THIS)
162 static const char *
const extensionsForUIKit[] = {
170 return SDL_Vulkan_GetInstanceExtensions_Helper(
182 PFN_vkCreateIOSSurfaceMVK vkCreateIOSSurfaceMVK =
184 (VkInstance)instance,
185 "vkCreateIOSSurfaceMVK");
186 VkIOSSurfaceCreateInfoMVK createInfo = {};
194 if (!vkCreateIOSSurfaceMVK) {
196 " extension is not enabled in the Vulkan instance.");
201 createInfo.pNext =
NULL;
202 createInfo.flags = 0;
203 createInfo.pView = (__bridge
void *)UIKit_Mtl_AddMetalView(window);
204 result = vkCreateIOSSurfaceMVK(instance, &createInfo,
208 SDL_Vulkan_GetResultString(result));
217 UIKit_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
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
PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties
The type used to identify a window.
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr
#define SDL_arraysize(array)
GLsizei const GLchar *const * path
void * SDL_LoadFunction(void *handle, const char *name)
VkResult(VKAPI_PTR * PFN_vkEnumerateInstanceExtensionProperties)(const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties)