[cogl/cogl-1.12] Use the right context when pushing the GLES2 context to an onscreen



commit 0edb8488503bf8bb9e22e3f4096b2697680c46e8
Author: Neil Roberts <neil linux intel com>
Date:   Mon Oct 1 12:05:06 2012 +0100

    Use the right context when pushing the GLES2 context to an onscreen
    
    Previously when pushing the GLES2 context with an onscreen framebuffer
    it would just call bind_onscreen. This actually binds it with Cogl's
    context so presumably the context isolation wasn't working properly.
    This patch splits out bind_onscreen to have a second function called
    bind_onscreen_with_context that explicitly takes the EGL context to
    use. Cogl now uses this when pushing the GLES2 context.
    
    Reviewed-by: Robert Bragg <robert linux intel com>
    
    (cherry picked from commit 3653c5b10058a3f79900eb2644cb30f4cf1ca47e)

 cogl/winsys/cogl-winsys-egl.c |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/cogl/winsys/cogl-winsys-egl.c b/cogl/winsys/cogl-winsys-egl.c
index b87cdf9..5257a63 100644
--- a/cogl/winsys/cogl-winsys-egl.c
+++ b/cogl/winsys/cogl-winsys-egl.c
@@ -645,17 +645,17 @@ _cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
 }
 
 static CoglBool
-bind_onscreen (CoglOnscreen *onscreen)
+bind_onscreen_with_context (CoglOnscreen *onscreen,
+                            EGLContext egl_context)
 {
   CoglFramebuffer *fb = COGL_FRAMEBUFFER (onscreen);
   CoglContext *context = fb->context;
-  CoglDisplayEGL *egl_display = context->display->winsys;
   CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
 
   CoglBool status = _cogl_winsys_egl_make_current (context->display,
                                                    egl_onscreen->egl_surface,
                                                    egl_onscreen->egl_surface,
-                                                   egl_display->egl_context);
+                                                   egl_context);
   if (status)
     {
       CoglRenderer *renderer = context->display->renderer;
@@ -670,6 +670,16 @@ bind_onscreen (CoglOnscreen *onscreen)
   return status;
 }
 
+static CoglBool
+bind_onscreen (CoglOnscreen *onscreen)
+{
+  CoglFramebuffer *fb = COGL_FRAMEBUFFER (onscreen);
+  CoglContext *context = fb->context;
+  CoglDisplayEGL *egl_display = context->display->winsys;
+
+  return bind_onscreen_with_context (onscreen, egl_display->egl_context);
+}
+
 static void
 _cogl_winsys_onscreen_bind (CoglOnscreen *onscreen)
 {
@@ -777,9 +787,9 @@ _cogl_winsys_set_gles2_context (CoglGLES2Context *gles2_ctx, GError **error)
 
   if (gles2_ctx->write_buffer &&
       cogl_is_onscreen (gles2_ctx->write_buffer))
-    {
-      status = bind_onscreen (COGL_ONSCREEN (gles2_ctx->write_buffer));
-    }
+    status =
+      bind_onscreen_with_context (COGL_ONSCREEN (gles2_ctx->write_buffer),
+                                  gles2_ctx->winsys);
   else
     status = _cogl_winsys_egl_make_current (ctx->display,
                                             egl_display->dummy_surface,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]