[Bf-blender-cvs] [e70dcde88bd] tmp-vulkan: Vulkan: OSX: Use vulkan context for offscreen context

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


Commit: e70dcde88bde62deeb6ba71f1ed89d5c99037137
Author: Clément Foucault
Date:   Sun Sep 13 01:52:57 2020 +0200
Branches: tmp-vulkan
https://developer.blender.org/rBe70dcde88bde62deeb6ba71f1ed89d5c99037137

Vulkan: OSX: Use vulkan context for offscreen context

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

M	intern/ghost/intern/GHOST_SystemCocoa.mm

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

diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 5a4dfba25b0..1a06f406fc8 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -38,6 +38,10 @@
 #  include "GHOST_ContextCGL.h"
 #endif
 
+#if defined(WITH_VULKAN)
+#  include "GHOST_ContextVK.h"
+#endif
+
 #ifdef WITH_INPUT_NDOF
 #  include "GHOST_NDOFManagerCocoa.h"
 #endif
@@ -765,9 +769,20 @@ GHOST_IWindow *GHOST_SystemCocoa::createWindow(const char *title,
  * Never explicitly delete the context, use #disposeContext() instead.
  * \return  The new context (or 0 if creation failed).
  */
-GHOST_IContext *GHOST_SystemCocoa::createOffscreenContext(GHOST_TDrawingContextType /* type */,
+GHOST_IContext *GHOST_SystemCocoa::createOffscreenContext(GHOST_TDrawingContextType type,
                                                           GHOST_GLSettings glSettings)
 {
+#ifdef WITH_VULKAN
+  if (type == GHOST_kDrawingContextTypeVulkan) {
+    GHOST_Context *context = new GHOST_ContextVK(false, NULL, 1, 0, false);
+    if (context->initializeDrawingContext()) {
+      return context;
+    }
+    delete context;
+    type = GHOST_kDrawingContextTypeOpenGL;
+  }
+#endif
+
   GHOST_Context *context = new GHOST_ContextCGL(false, NULL, NULL, NULL);
   if (context->initializeDrawingContext())
     return context;



More information about the Bf-blender-cvs mailing list