[Bf-blender-cvs] [31ecc302837] temp-ghost-vulkan: Added support for Linux. Thanks to Qiang Yu for the patch!

Jeroen Bakker noreply at git.blender.org
Tue Nov 8 14:29:32 CET 2022


Commit: 31ecc302837236c22a95286c480155c0ef7e9424
Author: Jeroen Bakker
Date:   Tue Nov 8 14:29:25 2022 +0100
Branches: temp-ghost-vulkan
https://developer.blender.org/rB31ecc302837236c22a95286c480155c0ef7e9424

Added support for Linux. Thanks to Qiang Yu for the patch!

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

M	intern/ghost/intern/GHOST_SystemWayland.cpp
M	intern/ghost/intern/GHOST_SystemX11.cpp
M	intern/ghost/intern/GHOST_WindowWayland.cpp

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

diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 770291d6ce6..3255d667e41 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -20,6 +20,10 @@
 
 #include "GHOST_ContextEGL.h"
 
+#ifdef WITH_VULKAN_BACKEND
+#  include "GHOST_ContextVK.h"
+#endif
+
 #ifdef WITH_INPUT_NDOF
 #  include "GHOST_NDOFManagerUnix.h"
 #endif
@@ -5581,12 +5585,18 @@ static GHOST_Context *createOffscreenContext_impl(GHOST_SystemWayland *system,
 
 GHOST_IContext *GHOST_SystemWayland::createOffscreenContext(GHOST_GLSettings glSettings)
 {
+  /* Create new off-screen window. */
+  wl_surface *wl_surface = wl_compositor_create_surface(wl_compositor());
+
 #ifdef WITH_VULKAN_BACKEND
   const bool debug_context = (glSettings.flags & GHOST_glDebugContext) != 0;
 
   if (glSettings.context_type == GHOST_kDrawingContextTypeVulkan) {
-    GHOST_Context *context = new GHOST_ContextVK(
-        false, GHOST_kVulkanPlatformWayland, 0, NULL, NULL, d->display, 1, 0, debug_context);
+    GHOST_Context *context = new GHOST_ContextVK(false,
+                                                 GHOST_kVulkanPlatformWayland,
+                                                 0, NULL,
+                                                 wl_surface, display_->wl_display,
+                                                 1, 0, debug_context);
 
     if (!context->initializeDrawingContext()) {
       delete context;
@@ -5598,8 +5608,6 @@ GHOST_IContext *GHOST_SystemWayland::createOffscreenContext(GHOST_GLSettings glS
   (void)glSettings;
 #endif
 
-  /* Create new off-screen window. */
-  wl_surface *wl_surface = wl_compositor_create_surface(wl_compositor());
   wl_egl_window *egl_window = wl_surface ? wl_egl_window_create(wl_surface, 1, 1) : nullptr;
 
   GHOST_Context *context = createOffscreenContext_impl(this, display_->wl_display, egl_window);
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 769e1b83476..4baa3ff598f 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -36,6 +36,10 @@
 #include "GHOST_ContextEGL.h"
 #include "GHOST_ContextGLX.h"
 
+#ifdef WITH_VULKAN_BACKEND
+#  include "GHOST_ContextVK.h"
+#endif
+
 #ifdef WITH_XF86KEYSYM
 #  include <X11/XF86keysym.h>
 #endif
diff --git a/intern/ghost/intern/GHOST_WindowWayland.cpp b/intern/ghost/intern/GHOST_WindowWayland.cpp
index c58aca3d72d..f3cea98a065 100644
--- a/intern/ghost/intern/GHOST_WindowWayland.cpp
+++ b/intern/ghost/intern/GHOST_WindowWayland.cpp
@@ -920,7 +920,12 @@ GHOST_Context *GHOST_WindowWayland::newDrawingContext(GHOST_TDrawingContextType
 
 #ifdef WITH_VULKAN_BACKEND
     case GHOST_kDrawingContextTypeVulkan:
-      context = new GHOST_ContextVK(m_wantStereoVisual, m_metalLayer, 1, 0, true);
+      context = new GHOST_ContextVK(m_wantStereoVisual,
+                                    GHOST_kVulkanPlatformWayland,
+                                    0, NULL,
+                                    window_->wl_surface,
+                                    system_->wl_display(),
+                                    1, 0, true);
       break;
 #endif



More information about the Bf-blender-cvs mailing list