From 3c25b079cef557e6889b62985ee3b3be9fcfc1b4 Mon Sep 17 00:00:00 2001 From: Jason Fielder Date: Wed, 20 Mar 2024 08:33:29 +0100 Subject: [PATCH] Fix #109739: Resolve greyed out UI on MacOS UI would sometimes disappear with the Metal backend. This occured in situations where there was only a single GPUContext within a single GHOST window, meaning the activation routine for the context was never run. Context activation is required to ensure the backbuffer was up to date upon resize. Otherwise, re-sizing the window would cause the screen to turn grey as the new drawables would not be rendered to. Authored by Apple: Michael Parkin-White Co-authored-by: Michael Parkin-White Pull Request: https://projects.blender.org/blender/blender/pulls/119299 --- source/blender/windowmanager/intern/wm_draw.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/blender/windowmanager/intern/wm_draw.cc b/source/blender/windowmanager/intern/wm_draw.cc index a64dd81ef03..c72221c901b 100644 --- a/source/blender/windowmanager/intern/wm_draw.cc +++ b/source/blender/windowmanager/intern/wm_draw.cc @@ -1544,6 +1544,13 @@ void wm_draw_update(bContext *C) BKE_image_free_unused_gpu_textures(); +#ifdef WITH_METAL_BACKEND + /* Reset drawable to ensure GPU context activation happens at least once per frame if only a + * single context exists. This is required to ensure the default framebuffer is updated + * to be the latest backbuffer. */ + wm_window_clear_drawable(wm); +#endif + LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { #ifdef WIN32 GHOST_TWindowState state = GHOST_GetWindowState(