[Bf-blender-cvs] [47613a40f56] tmp-vulkan: VK: OSX: Use debug context and use METAL_SURFACE instead of MACOS_SURFACE

Clément Foucault noreply at git.blender.org
Sun Sep 13 03:38:07 CEST 2020


Commit: 47613a40f567b02ec4b9bdaf8096e81e294ab985
Author: Clément Foucault
Date:   Sun Sep 13 03:37:35 2020 +0200
Branches: tmp-vulkan
https://developer.blender.org/rB47613a40f567b02ec4b9bdaf8096e81e294ab985

VK: OSX: Use debug context and use METAL_SURFACE instead of MACOS_SURFACE

===================================================================

M	intern/ghost/intern/GHOST_ContextVK.cpp
M	intern/ghost/intern/GHOST_SystemCocoa.mm
M	intern/ghost/intern/GHOST_WindowCocoa.mm

===================================================================

diff --git a/intern/ghost/intern/GHOST_ContextVK.cpp b/intern/ghost/intern/GHOST_ContextVK.cpp
index d0ffe743d6a..b013952124c 100644
--- a/intern/ghost/intern/GHOST_ContextVK.cpp
+++ b/intern/ghost/intern/GHOST_ContextVK.cpp
@@ -829,7 +829,7 @@ GHOST_TSuccess GHOST_ContextVK::initializeDrawingContext()
 #ifdef _WIN32
     const char *native_surface_extension_name = VK_KHR_WIN32_SURFACE_EXTENSION_NAME;
 #elif defined(__APPLE__)
-    const char *native_surface_extension_name = VK_MVK_MACOS_SURFACE_EXTENSION_NAME;
+    const char *native_surface_extension_name = VK_EXT_METAL_SURFACE_EXTENSION_NAME;
 #else /* X11 */
     const char *native_surface_extension_name = VK_KHR_XLIB_SURFACE_EXTENSION_NAME;
 #endif
@@ -868,12 +868,12 @@ GHOST_TSuccess GHOST_ContextVK::initializeDrawingContext()
     };
     VK_CHECK(vkCreateWin32SurfaceKHR(m_instance, &surface_create_info, NULL, &m_surface));
 #elif defined(__APPLE__)
-    VkMacOSSurfaceCreateInfoMVK info = {};
-    info.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK;
+    VkMetalSurfaceCreateInfoEXT info = {};
+    info.sType = VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT;
     info.pNext = NULL;
     info.flags = 0;
-    info.pView = m_metal_layer;
-    VK_CHECK(vkCreateMacOSSurfaceMVK(m_instance, &info, nullptr, &m_surface));
+    info.pLayer = m_metal_layer;
+    VK_CHECK(vkCreateMetalSurfaceEXT(m_instance, &info, nullptr, &m_surface));
 #else
     VkXlibSurfaceCreateInfoKHR surface_create_info = {
         .sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR,
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 1a06f406fc8..0d79d8ccdbc 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -774,7 +774,8 @@ GHOST_IContext *GHOST_SystemCocoa::createOffscreenContext(GHOST_TDrawingContextT
 {
 #ifdef WITH_VULKAN
   if (type == GHOST_kDrawingContextTypeVulkan) {
-    GHOST_Context *context = new GHOST_ContextVK(false, NULL, 1, 0, false);
+    const bool debug_context = (glSettings.flags & GHOST_glDebugContext) != 0;
+    GHOST_Context *context = new GHOST_ContextVK(false, NULL, 1, 0, debug_context);
     if (context->initializeDrawingContext()) {
       return context;
     }
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm
index 74d4bb9425a..2d1d4f228c3 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.mm
+++ b/intern/ghost/intern/GHOST_WindowCocoa.mm
@@ -839,7 +839,7 @@ GHOST_Context *GHOST_WindowCocoa::newDrawingContext(GHOST_TDrawingContextType ty
 {
 #ifdef WITH_VULKAN
   if (type == GHOST_kDrawingContextTypeVulkan) {
-    GHOST_Context *context = new GHOST_ContextVK(m_wantStereoVisual, m_metalLayer, 1, 0, false);
+    GHOST_Context *context = new GHOST_ContextVK(m_wantStereoVisual, m_metalLayer, 1, 0, true);
 
     if (context->initializeDrawingContext()) {
       return context;



More information about the Bf-blender-cvs mailing list