From: Paul Gofman <pgofman@codeweavers.com> --- dlls/win32u/opengl.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/dlls/win32u/opengl.c b/dlls/win32u/opengl.c index a3884ad41fb..a9169ef15f8 100644 --- a/dlls/win32u/opengl.c +++ b/dlls/win32u/opengl.c @@ -1789,8 +1789,9 @@ static BOOL context_unset_current( struct opengl_context *context ) } /* return an updated drawable, recreating one if the window drawables have been invalidated (mostly wineandroid) */ -static struct opengl_drawable *get_updated_drawable( HDC hdc, int format, struct opengl_drawable *drawable ) +static struct opengl_drawable *get_updated_drawable( HDC hdc, int format, struct opengl_drawable *drawable, HDC update_dc ) { + struct opengl_drawable *ret; HWND hwnd = NULL; /* return the memory DCs drawables directly */ @@ -1809,7 +1810,9 @@ static struct opengl_drawable *get_updated_drawable( HDC hdc, int format, struct if (hdc && (drawable = get_dc_opengl_drawable( hdc ))) return drawable; /* get an updated drawable with the desired format */ - return get_window_unused_drawable( hwnd, format ); + ret = get_window_unused_drawable( hwnd, format ); + if (ret && update_dc) set_dc_opengl_drawable( update_dc, ret ); + return ret; } static BOOL context_sync_drawables( struct opengl_context *context, HDC draw_hdc, HDC read_hdc ) @@ -1818,10 +1821,12 @@ static BOOL context_sync_drawables( struct opengl_context *context, HDC draw_hdc struct opengl_context *previous = NtCurrentTeb()->glContext; BOOL ret = FALSE; - if (!(new_draw = get_updated_drawable( draw_hdc, context->format, context->draw ))) return FALSE; + if (!(new_draw = get_updated_drawable( draw_hdc, context->format, context->draw, + draw_hdc ? draw_hdc : NtCurrentTeb()->glReserved1[0] ))) return FALSE; if (!draw_hdc && context->draw == context->read) opengl_drawable_add_ref( (new_read = new_draw) ); else if (draw_hdc && draw_hdc == read_hdc) opengl_drawable_add_ref( (new_read = new_draw) ); - else new_read = get_updated_drawable( read_hdc, context->format, context->read ); + else new_read = get_updated_drawable( read_hdc, context->format, context->read, + read_hdc ? read_hdc : NtCurrentTeb()->glReserved1[1] ); TRACE( "context %p, new_draw %s, new_read %s\n", context, debugstr_opengl_drawable( new_draw ), debugstr_opengl_drawable( new_read ) ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10190