From: Paul Gofman <pgofman@codeweavers.com> --- dlls/winex11.drv/opengl.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 01eb3b9c356..3274cb53365 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -216,6 +216,7 @@ enum glx_swap_control_method static struct glx_pixel_format *pixel_formats; static int nb_pixel_formats, nb_onscreen_formats; static const struct egl_platform *egl; +static EGLContext egl_fallback_context; static BOOL (*p_egl_describe_pixel_format)( int format, struct wgl_pixel_format *pf ); /* Selects the preferred GLX swap control method for use by wglSwapIntervalEXT */ @@ -1511,7 +1512,16 @@ static BOOL x11drv_egl_surface_swap( struct opengl_drawable *base ) TRACE( "%s\n", debugstr_opengl_drawable( base ) ); - funcs->p_eglSwapBuffers( egl->display, gl->base.surface ); + if (!funcs->p_eglSwapBuffers( egl->display, gl->base.surface ) && funcs->p_eglGetError() == EGL_BAD_SURFACE + && !funcs->p_eglGetCurrentContext()) + { + if (!egl_fallback_context) + egl_fallback_context = funcs->p_eglCreateContext( egl->display, EGL_NO_CONFIG_KHR, EGL_NO_CONTEXT, NULL ); + + funcs->p_eglMakeCurrent( egl->display, gl->base.surface, gl->base.surface, egl_fallback_context ); + funcs->p_eglSwapBuffers( egl->display, gl->base.surface ); + funcs->p_eglMakeCurrent( egl->display, EGL_NO_CONTEXT, EGL_NO_SURFACE, EGL_NO_CONTEXT ); + } if (InterlockedCompareExchange( &base->client->offscreen, 0, 0 )) XFlush( gdi_display ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10033