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)
This commit is contained in:
Neil Roberts 2012-10-01 12:05:06 +01:00
parent 5e730568d4
commit 0edb848850

View File

@ -645,17 +645,17 @@ _cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
} }
static CoglBool static CoglBool
bind_onscreen (CoglOnscreen *onscreen) bind_onscreen_with_context (CoglOnscreen *onscreen,
EGLContext egl_context)
{ {
CoglFramebuffer *fb = COGL_FRAMEBUFFER (onscreen); CoglFramebuffer *fb = COGL_FRAMEBUFFER (onscreen);
CoglContext *context = fb->context; CoglContext *context = fb->context;
CoglDisplayEGL *egl_display = context->display->winsys;
CoglOnscreenEGL *egl_onscreen = onscreen->winsys; CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
CoglBool status = _cogl_winsys_egl_make_current (context->display, CoglBool status = _cogl_winsys_egl_make_current (context->display,
egl_onscreen->egl_surface, egl_onscreen->egl_surface,
egl_onscreen->egl_surface, egl_onscreen->egl_surface,
egl_display->egl_context); egl_context);
if (status) if (status)
{ {
CoglRenderer *renderer = context->display->renderer; CoglRenderer *renderer = context->display->renderer;
@ -670,6 +670,16 @@ bind_onscreen (CoglOnscreen *onscreen)
return status; 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 static void
_cogl_winsys_onscreen_bind (CoglOnscreen *onscreen) _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 && if (gles2_ctx->write_buffer &&
cogl_is_onscreen (gles2_ctx->write_buffer)) cogl_is_onscreen (gles2_ctx->write_buffer))
{ status =
status = bind_onscreen (COGL_ONSCREEN (gles2_ctx->write_buffer)); bind_onscreen_with_context (COGL_ONSCREEN (gles2_ctx->write_buffer),
} gles2_ctx->winsys);
else else
status = _cogl_winsys_egl_make_current (ctx->display, status = _cogl_winsys_egl_make_current (ctx->display,
egl_display->dummy_surface, egl_display->dummy_surface,