[cairo-commit] src/cairo-gl-surface.c
Chris Wilson
ickle at kemper.freedesktop.org
Mon Dec 12 05:59:52 PST 2011
src/cairo-gl-surface.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
New commits:
commit 909f4a4a7f0a6082f4f1e9edaba8034a819a12ec
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Dec 12 13:52:27 2011 +0000
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 at gmail.com>
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index ed43a51..7601b6a 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);
More information about the cairo-commit
mailing list