[Cogl] [PATCH 3/3] Use the right context when pushing the GLES2 context to an onscreen
Robert Bragg
robert at sixbynine.org
Mon Oct 1 05:58:43 PDT 2012
This looks good to land to me:
Reviewed-by: Robert Bragg <robert at linux.intel.com>
thanks,
- Robert
On Mon, Oct 1, 2012 at 12:06 PM, Neil Roberts <neil at linux.intel.com> wrote:
> 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.
> ---
> cogl/winsys/cogl-winsys-egl.c | 22 ++++++++++++++++------
> 1 file changed, 16 insertions(+), 6 deletions(-)
>
> diff --git a/cogl/winsys/cogl-winsys-egl.c b/cogl/winsys/cogl-winsys-egl.c
> index 91f247d..cd6ae3a 100644
> --- a/cogl/winsys/cogl-winsys-egl.c
> +++ b/cogl/winsys/cogl-winsys-egl.c
> @@ -648,17 +648,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;
> @@ -673,6 +673,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)
> {
> @@ -780,9 +790,9 @@ _cogl_winsys_set_gles2_context (CoglGLES2Context *gles2_ctx, CoglError **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,
> --
> 1.7.11.3.g3c3efa5
>
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl
More information about the Cogl
mailing list