YaGL: Add glFlush before makeCurrent 62/12762/1
authorStanislav Vorobiov <s.vorobiov@samsung.com>
Fri, 22 Nov 2013 06:44:39 +0000 (10:44 +0400)
committerStanislav Vorobiov <s.vorobiov@samsung.com>
Fri, 22 Nov 2013 06:44:39 +0000 (10:44 +0400)
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
hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen.c

index 2045945..04f9225 100644 (file)
@@ -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,
index c700f13..ac03123 100644 (file)
@@ -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,