From f7d38e2e6426a21f4b91bedc0fe635aba4692ff2 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Wed, 5 Aug 2020 15:26:49 +0200 Subject: Fix T77346: GPU Workaround Always Render Using Main Context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In Blender 2.90 EEVEE materials were refactored that introduced crashes on Intel GPUs on Windows. The crash happened in the `local_context_workaround` that temporary stored compiled materials in a binary form to reload it in the main GL context. It has been tested that the workaround isn't needed anymore for HD6xx GPUs, but it is still needed for HD4000. After several unsuccesfull fixes we came to the conclusion that we could not support the local context workaround and needed to come with a different workaround. The idea of this patch is that in these cases there is only a single context that is used for rendering. Threads that uses these contextes are guarded by a mutex and will block. Impact on User Level: * Due to main mutex lock the UI freezes when rendering or baking or feel less snappy Reviewed By: Clément Foucault, Brecht van Lommel Differential Revision: https://developer.blender.org/D8410 --- source/blender/windowmanager/intern/wm_draw.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/blender/windowmanager/intern/wm_draw.c') diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 16454e473cc..fdbc7a7d136 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -51,6 +51,7 @@ #include "ED_screen.h" #include "ED_view3d.h" +#include "GPU_context.h" #include "GPU_draw.h" #include "GPU_framebuffer.h" #include "GPU_immediate.h" @@ -999,6 +1000,7 @@ void wm_draw_update(bContext *C) wmWindowManager *wm = CTX_wm_manager(C); wmWindow *win; + GPU_context_main_lock(); GPU_free_unused_buffers(); for (win = wm->windows.first; win; win = win->next) { @@ -1036,6 +1038,8 @@ void wm_draw_update(bContext *C) /* Draw non-windows (surfaces) */ wm_surfaces_iter(C, wm_draw_surface); + + GPU_context_main_unlock(); } void wm_draw_region_clear(wmWindow *win, ARegion *UNUSED(region)) -- cgit v1.2.3