MacOS WSI
This cl implements the VK_MVK_macos_surface extension, which
adds the vkCreateMacOSSurfaceMVK function on MacOS.
According to the spec:
"The VK_MVK_macos_surface extension is an instance extension.
It provides a mechanism to create a VkSurfaceKHR object
(defined by the VK_KHR_surface extension) that refers to an
NSView, the native surface type of macOS, which is
underpinned by a CAMetalLayer, to support rendering to the
surface using Apple’s Metal framework."
Bug b/137673628
Change-Id: Iacf7696b1d9e52d7349ea4efa01f0acdd09a6c8f
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/33848
Reviewed-by: Hernan Liatis <hliatis@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cc702b2..166049e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -394,9 +394,13 @@
set_cpp_flag("-fPIC")
endif()
- if(LINUX)
+ if(WIN32)
+ set_cpp_flag("-DVK_USE_PLATFORM_WIN32_KHR")
+ elseif(LINUX)
set_cpp_flag("-DUSE_X11=1")
set_cpp_flag("-DVK_USE_PLATFORM_XLIB_KHR")
+ elseif(APPLE)
+ set_cpp_flag("-DVK_USE_PLATFORM_MACOS_MVK")
endif()
# Use -g3 to have even more debug info
@@ -1812,6 +1816,11 @@
list(APPEND OPENGL_COMPILER_LIST
${OPENGL_COMPILER_DIR}/ossource_posix.cpp
)
+
+ list(APPEND VULKAN_LIST
+ ${SOURCE_DIR}/WSI/MacOSSurfaceMVK.mm
+ ${SOURCE_DIR}/WSI/MacOSSurfaceMVK.h
+ )
elseif(ANDROID)
list(APPEND SWIFTSHADER_LIST
${SOURCE_DIR}/Main/FrameBufferAndroid.cpp