diff options
-rw-r--r-- | source/blender/render/intern/source/pipeline.c | 12 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 13 |
2 files changed, 15 insertions, 10 deletions
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 510a4aa4685..9d220e181fa 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -1043,12 +1043,14 @@ void RE_gl_context_create(Render *re) void RE_gl_context_destroy(Render *re) { /* Needs to be called from the thread which used the ogl context for rendering. */ - if (re->gpu_context) { - GPU_context_active_set(re->gpu_context); - GPU_context_discard(re->gpu_context); - re->gpu_context = NULL; - } if (re->gl_context) { + if (re->gpu_context) { + WM_opengl_context_activate(re->gl_context); + GPU_context_active_set(re->gpu_context); + GPU_context_discard(re->gpu_context); + re->gpu_context = NULL; + } + WM_opengl_context_dispose(re->gl_context); re->gl_context = NULL; } diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index f391c92b4ca..c5226a0b809 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -631,6 +631,10 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm wm_get_screensize(&scr_w, &scr_h); posy = (scr_h - win->posy - win->sizey); + /* Clear drawable so we can set the new window. */ + wmWindow *prev_windrawable = wm->windrawable; + wm_window_clear_drawable(wm); + ghostwin = GHOST_CreateWindow(g_system, title, win->posx, posy, win->sizex, win->sizey, (GHOST_TWindowState)win->windowstate, @@ -640,9 +644,6 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm if (ghostwin) { GHOST_RectangleHandle bounds; - /* Clear drawable so we can set the new window. */ - wm_window_clear_drawable(wm); - win->gpuctx = GPU_context_create(); /* needed so we can detect the graphics card below */ @@ -650,8 +651,7 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm /* Set window as drawable upon creation. Note this has already been * it has already been activated by GHOST_CreateWindow. */ - bool activate = false; - wm_window_set_drawable(wm, win, activate); + wm_window_set_drawable(wm, win, false); win->ghostwin = ghostwin; GHOST_SetWindowUserData(ghostwin, win); /* pointer back */ @@ -689,6 +689,9 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm /* standard state vars for window */ GPU_state_init(); } + else { + wm_window_set_drawable(wm, prev_windrawable, false); + } } /** |