Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Parborg <darkdefende@gmail.com>2022-08-15 17:54:29 +0300
committerSebastian Parborg <darkdefende@gmail.com>2022-08-15 17:54:29 +0300
commit3195a381200eb98e6add8b0504f701318186946d (patch)
treee9b5daa08c9a893e66c499d23c4527c2d1dcbfb8 /source/blender/windowmanager
parent8ffc11dbcb21e81634e8f22cd65fdc921c7320d1 (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')
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c2
-rw-r--r--source/blender/windowmanager/intern/wm_window.c63
-rw-r--r--source/blender/windowmanager/wm_window.h1
3 files changed, 43 insertions, 23 deletions
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 624e434e784..8163b39b3dd 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -166,7 +166,7 @@ void WM_init_opengl(void)
if (G.background) {
/* Ghost is still not initialized elsewhere in background mode. */
- wm_ghost_init(NULL);
+ wm_ghost_init_background();
}
if (!GPU_backend_supported()) {
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)
diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h
index 3644aa085f7..036a34a5140 100644
--- a/source/blender/windowmanager/wm_window.h
+++ b/source/blender/windowmanager/wm_window.h
@@ -20,6 +20,7 @@ extern "C" {
* need to event handling.
*/
void wm_ghost_init(bContext *C);
+void wm_ghost_init_background(void);
void wm_ghost_exit(void);
/**