diff options
author | Sebastian Parborg <darkdefende@gmail.com> | 2022-08-15 17:54:29 +0300 |
---|---|---|
committer | Sebastian Parborg <darkdefende@gmail.com> | 2022-08-15 17:54:29 +0300 |
commit | 3195a381200eb98e6add8b0504f701318186946d (patch) | |
tree | e9b5daa08c9a893e66c499d23c4527c2d1dcbfb8 /source/blender/windowmanager/intern/wm_window.c | |
parent | 8ffc11dbcb21e81634e8f22cd65fdc921c7320d1 (diff) |
Introduce headless OpenGL rendering on Linux
With this patch true headless OpenGL rendering is now possible on Linux.
It changes the logic of the WITH_HEADLESS build flag.
The headless backend is now always available with regular builds and
Blender will try to fall back to it if it fails to initialize other
backends while in background mode.
The headless backend only works on Linux as EGL is not used on Mac or Windows.
libepoxy does support windows and mac, so this can perhaps be remedied in the future.
Reviewed By: Brecht, Jeroen, Campbell
Differential Revision: http://developer.blender.org/D15555
Diffstat (limited to 'source/blender/windowmanager/intern/wm_window.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 63 |
1 files changed, 41 insertions, 22 deletions
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 0c31ff87fdd..a4dba7145bd 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -1558,36 +1558,55 @@ void wm_window_process_events(const bContext *C) void wm_ghost_init(bContext *C) { - if (!g_system) { - GHOST_EventConsumerHandle consumer; + if (g_system) { + return; + } - if (C != NULL) { - consumer = GHOST_CreateEventConsumer(ghost_event_proc, C); - } + BLI_assert(C != NULL); + BLI_assert_msg(!G.background, "Use wm_ghost_init_background instead"); - GHOST_SetBacktraceHandler((GHOST_TBacktraceFn)BLI_system_backtrace); + GHOST_EventConsumerHandle consumer; - g_system = GHOST_CreateSystem(); + consumer = GHOST_CreateEventConsumer(ghost_event_proc, C); - GHOST_Debug debug = {0}; - if (G.debug & G_DEBUG_GHOST) { - debug.flags |= GHOST_kDebugDefault; - } - if (G.debug & G_DEBUG_WINTAB) { - debug.flags |= GHOST_kDebugWintab; - } - GHOST_SystemInitDebug(g_system, debug); + GHOST_SetBacktraceHandler((GHOST_TBacktraceFn)BLI_system_backtrace); - if (C != NULL) { - GHOST_AddEventConsumer(g_system, consumer); - } + g_system = GHOST_CreateSystem(); - if (wm_init_state.native_pixels) { - GHOST_UseNativePixels(); - } + GHOST_Debug debug = {0}; + if (G.debug & G_DEBUG_GHOST) { + debug.flags |= GHOST_kDebugDefault; + } + if (G.debug & G_DEBUG_WINTAB) { + debug.flags |= GHOST_kDebugWintab; + } + GHOST_SystemInitDebug(g_system, debug); + + GHOST_AddEventConsumer(g_system, consumer); + + if (wm_init_state.native_pixels) { + GHOST_UseNativePixels(); + } + + GHOST_UseWindowFocus(wm_init_state.window_focus); +} + +/* TODO move this to wm_init_exit.c. */ +void wm_ghost_init_background(void) +{ + if (g_system) { + return; + } + + GHOST_SetBacktraceHandler((GHOST_TBacktraceFn)BLI_system_backtrace); + + g_system = GHOST_CreateSystemBackground(); - GHOST_UseWindowFocus(wm_init_state.window_focus); + GHOST_Debug debug = {0}; + if (G.debug & G_DEBUG_GHOST) { + debug.flags |= GHOST_kDebugDefault; } + GHOST_SystemInitDebug(g_system, debug); } void wm_ghost_exit(void) |