diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-09-08 04:18:49 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-09-08 05:15:50 +0300 |
commit | ccc512cc619dc9f0e6fd79270a7a96ece34d23b5 (patch) | |
tree | da728c4f3745fc352a5e223502ca8734c3c1f01b /source/blender/draw/intern | |
parent | ca8ffc523e3d08fc55c5cf000fa9fc3888950bf7 (diff) |
GPUImmediate: Make activation / deactivation implicit
This avoids unecessary complexity.
Also makes the GPUImmediate threadsafe by using a threadlocal imm variable.
Diffstat (limited to 'source/blender/draw/intern')
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index f7c126d2e99..d2a95f9b7b3 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -2767,17 +2767,11 @@ void DRW_opengl_context_create(void) BLI_assert(DST.gl_context == NULL); /* Ensure it's called once */ DST.gl_context_mutex = BLI_ticket_mutex_alloc(); - if (!G.background) { - immDeactivate(); - } /* This changes the active context. */ DST.gl_context = WM_opengl_context_create(); WM_opengl_context_activate(DST.gl_context); /* Be sure to create gpu_context too. */ DST.gpu_context = GPU_context_create(0); - if (!G.background) { - immActivate(); - } /* So we activate the window's one afterwards. */ wm_window_reset_drawable(); } @@ -2794,25 +2788,15 @@ void DRW_opengl_context_destroy(void) } } -void DRW_opengl_context_enable_ex(bool restore) +void DRW_opengl_context_enable_ex(bool UNUSED(restore)) { if (DST.gl_context != NULL) { /* IMPORTANT: We dont support immediate mode in render mode! * This shall remain in effect until immediate mode supports * multiple threads. */ BLI_ticket_mutex_lock(DST.gl_context_mutex); - if (BLI_thread_is_main() && restore) { - if (!G.background) { - immDeactivate(); - } - } WM_opengl_context_activate(DST.gl_context); GPU_context_active_set(DST.gpu_context); - if (BLI_thread_is_main() && restore) { - if (!G.background) { - immActivate(); - } - } } } |