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 <mparkinwhite@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/119299
This commit is contained in:
Jason Fielder 2024-03-20 08:33:29 +01:00 committed by Thomas Dinges
parent 3641b4b884
commit 3c25b079ce
1 changed files with 7 additions and 0 deletions

View File

@ -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(