Cocoa: Add basic support for Vulkan via MoltenVK

This adds basic support for MoltenVK, a Vulkan implementation on top of
Metal, on macOS 10.11 and later.  It looks for MoltenVK in the process
via RTLD_DEFAULT symbol lookup if _GLFW_VULKAN_STATIC is disabled.

glfwCreateWindowSurface now creates and sets a CAMetalLayer for the
window content view, which is required for MoltenVK to function.

You must help CMake find MoltenVK for the Vulkan test to be built.

Fixes #870.
This commit is contained in:
Camilla Berglund
2016-10-14 01:46:56 +02:00
parent c3db1cae3f
commit e94d16667b
12 changed files with 182 additions and 22 deletions
+13
View File
@@ -39,6 +39,18 @@
typedef void* id;
#endif
typedef VkFlags VkMacOSSurfaceCreateFlagsMVK;
typedef struct VkMacOSSurfaceCreateInfoMVK
{
VkStructureType sType;
const void* pNext;
VkMacOSSurfaceCreateFlagsMVK flags;
const void* pView;
} VkMacOSSurfaceCreateInfoMVK;
typedef VkResult (APIENTRY *PFN_vkCreateMacOSSurfaceMVK)(VkInstance,const VkMacOSSurfaceCreateInfoMVK*,const VkAllocationCallbacks*,VkSurfaceKHR*);
#include "posix_tls.h"
#include "cocoa_joystick.h"
#include "nsgl_context.h"
@@ -74,6 +86,7 @@ typedef struct _GLFWwindowNS
id object;
id delegate;
id view;
id layer;
GLFWbool maximized;