From 026232676c6317d46b2db53223455e7909dc5fc7 Mon Sep 17 00:00:00 2001 From: Stanislav Vorobiov Date: Fri, 22 Nov 2013 10:44:39 +0400 Subject: [PATCH] YaGL: Add glFlush before makeCurrent On Mac OS X aglSetCurrentContext doesn't implicitly glFlush like on linux and windows. glFlush is required because some apps, like webkit based apps for example, rely on this behavior Change-Id: I275a523152369206daa1602217443f28e2e6479f --- hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen.c | 7 +++++++ hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen.c | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen.c b/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen.c index 2045945799..04f9225e70 100644 --- a/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen.c +++ b/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen.c @@ -36,6 +36,7 @@ #include "yagl_log.h" #include "yagl_process.h" #include "yagl_thread.h" +#include "yagl_gles_driver.h" YAGL_DEFINE_TLS(struct yagl_egl_offscreen_ts*, egl_offscreen_ts); @@ -106,6 +107,10 @@ static bool yagl_egl_offscreen_make_current(struct yagl_egl_backend *backend, YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_make_current, NULL); + if (egl_offscreen_ts->dpy) { + egl_offscreen->gles_driver->Flush(); + } + if (draw && read) { res = egl_offscreen->egl_driver->make_current(egl_offscreen->egl_driver, egl_offscreen_dpy->native_dpy, @@ -145,6 +150,8 @@ static bool yagl_egl_offscreen_release_current(struct yagl_egl_backend *backend, return false; } + egl_offscreen->gles_driver->Flush(); + res = egl_offscreen->egl_driver->make_current(egl_offscreen->egl_driver, egl_offscreen_ts->dpy->native_dpy, EGL_NO_SURFACE, diff --git a/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen.c b/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen.c index c700f13abe..ac03123e7c 100644 --- a/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen.c +++ b/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen.c @@ -145,6 +145,10 @@ static bool yagl_egl_onscreen_make_current(struct yagl_egl_backend *backend, YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_make_current, NULL); + if (egl_onscreen_ts->dpy) { + egl_onscreen->gles_driver->Flush(); + } + if (draw && read) { res = egl_onscreen->egl_driver->make_current(egl_onscreen->egl_driver, egl_onscreen_dpy->native_dpy, @@ -227,6 +231,8 @@ static bool yagl_egl_onscreen_release_current(struct yagl_egl_backend *backend, return false; } + egl_onscreen->gles_driver->Flush(); + res = egl_onscreen->egl_driver->make_current(egl_onscreen->egl_driver, egl_onscreen_ts->dpy->native_dpy, EGL_NO_SURFACE, -- 2.34.1