diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-12-12 13:52:27 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-12-12 13:57:10 +0000 |
commit | 909f4a4a7f0a6082f4f1e9edaba8034a819a12ec (patch) | |
tree | 24d570e22f0ea5557714b711ec019a2e3b88e7cf | |
parent | 8025fcc4d38db1e2f7adabe732dbde481b6aeade (diff) |
gl: Set the destination for swap buffers, required by EGL at least
EGL mandates that the current context be valid for a call to
swapbuffers, and does not just operate upon the drawable passed in. The
current code prevents this as a side effect of calling flush decouples
the current context (so that the state can be clobbered by the
application without impacting upon Cairo). So when we try to swap, EGL
complains.
We can get the desired behaviour by setting the surface upon the
context, thus calling MakeCurrent as necessary, and then flushing any
pending operations before swapping. This has the positive side-effect
of not clobbering our own state unnecessarily.
Reported-by: Pekka Paalanen <ppaalanen@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/cairo-gl-surface.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c index ed43a515..7601b6ad 100644 --- a/src/cairo-gl-surface.c +++ b/src/cairo-gl-surface.c @@ -695,7 +695,10 @@ cairo_gl_surface_swapbuffers (cairo_surface_t *abstract_surface) if (unlikely (status)) return; - cairo_surface_flush (abstract_surface); + /* For swapping on EGL, at least, we need a valid context/target. */ + _cairo_gl_context_set_destination (ctx, surface); + /* And in any case we should flush any pending operations. */ + _cairo_gl_composite_flush (ctx); ctx->swap_buffers (ctx, surface); |