Changeset View
Changeset View
Standalone View
Standalone View
intern/ghost/intern/GHOST_SystemWayland.cpp
| Show All 14 Lines | |||||
| #include "GHOST_PathUtils.h" | #include "GHOST_PathUtils.h" | ||||
| #include "GHOST_TimerManager.h" | #include "GHOST_TimerManager.h" | ||||
| #include "GHOST_WaylandUtils.h" | #include "GHOST_WaylandUtils.h" | ||||
| #include "GHOST_WindowManager.h" | #include "GHOST_WindowManager.h" | ||||
| #include "GHOST_utildefines.h" | #include "GHOST_utildefines.h" | ||||
| #include "GHOST_ContextEGL.h" | #include "GHOST_ContextEGL.h" | ||||
| #ifdef WITH_VULKAN_BACKEND | |||||
| # include "GHOST_ContextVK.h" | |||||
| #endif | |||||
| #ifdef WITH_INPUT_NDOF | #ifdef WITH_INPUT_NDOF | ||||
| # include "GHOST_NDOFManagerUnix.h" | # include "GHOST_NDOFManagerUnix.h" | ||||
| #endif | #endif | ||||
| #ifdef WITH_GHOST_WAYLAND_DYNLOAD | #ifdef WITH_GHOST_WAYLAND_DYNLOAD | ||||
| # include <wayland_dynload_API.h> /* For `ghost_wl_dynload_libraries`. */ | # include <wayland_dynload_API.h> /* For `ghost_wl_dynload_libraries`. */ | ||||
| #endif | #endif | ||||
| ▲ Show 20 Lines • Show All 5,978 Lines • ▼ Show 20 Lines | static GHOST_Context *createOffscreenContext_impl(GHOST_SystemWayland *system, | ||||
| if (context->initializeDrawingContext()) { | if (context->initializeDrawingContext()) { | ||||
| return context; | return context; | ||||
| } | } | ||||
| delete context; | delete context; | ||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| GHOST_IContext *GHOST_SystemWayland::createOffscreenContext(GHOST_GLSettings /*glSettings*/) | GHOST_IContext *GHOST_SystemWayland::createOffscreenContext(GHOST_GLSettings glSettings) | ||||
| { | { | ||||
| #ifdef USE_EVENT_BACKGROUND_THREAD | #ifdef USE_EVENT_BACKGROUND_THREAD | ||||
| std::lock_guard lock_server_guard{*server_mutex}; | std::lock_guard lock_server_guard{*server_mutex}; | ||||
| #endif | #endif | ||||
| /* Create new off-screen window. */ | /* Create new off-screen window. */ | ||||
| wl_surface *wl_surface = wl_compositor_create_surface(wl_compositor()); | 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, | |||||
| wl_surface, | |||||
| display_->wl_display, | |||||
| 1, | |||||
| 0, | |||||
| debug_context); | |||||
| if (!context->initializeDrawingContext()) { | |||||
| delete context; | |||||
| return nullptr; | |||||
| } | |||||
| return context; | |||||
| } | |||||
| #else | |||||
| (void)glSettings; | |||||
| #endif | |||||
| wl_egl_window *egl_window = wl_surface ? wl_egl_window_create(wl_surface, 1, 1) : nullptr; | 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); | GHOST_Context *context = createOffscreenContext_impl(this, display_->wl_display, egl_window); | ||||
| if (!context) { | if (!context) { | ||||
| GHOST_PRINT("Cannot create off-screen EGL context" << std::endl); | GHOST_PRINT("Cannot create off-screen EGL context" << std::endl); | ||||
| if (wl_surface) { | if (wl_surface) { | ||||
| wl_surface_destroy(wl_surface); | wl_surface_destroy(wl_surface); | ||||
| ▲ Show 20 Lines • Show All 909 Lines • Show Last 20 Lines | |||||