[cairo-commit] src/cairo-gl-operand.c src/cairo-gl-private.h src/cairo-gl-surface.c
Martin Robinson
mrobinson at kemper.freedesktop.org
Wed Apr 17 10:31:23 PDT 2013
src/cairo-gl-operand.c | 39 +++------------------------------------
src/cairo-gl-private.h | 3 +++
src/cairo-gl-surface.c | 35 +++++++++++++++++++++++++++++++++++
3 files changed, 41 insertions(+), 36 deletions(-)
New commits:
commit 498421bec90f68f3d7219b145860a71fd39f0c64
Author: Henry Song <henry.song at samsung.com>
Date: Wed Apr 17 10:23:27 2013 -0700
gl/msaa: Resolve multisampling on surface flush
When flushing a surface, we must resolve multisampling for desktop GL.
This allows use of the original surface texture in any following raw GL
operations. This fixes accelerated canvas with WebKitGTK+ using the MSAA
compositor.
diff --git a/src/cairo-gl-operand.c b/src/cairo-gl-operand.c
index f99400c..7b5b404 100644
--- a/src/cairo-gl-operand.c
+++ b/src/cairo-gl-operand.c
@@ -69,39 +69,6 @@ _cairo_gl_create_gradient_texture (cairo_gl_surface_t *dst,
return _cairo_gl_context_release (ctx, status);
}
-static cairo_int_status_t
-_resolve_multisampling (cairo_gl_surface_t *surface)
-{
- cairo_gl_context_t *ctx;
- cairo_int_status_t status;
-
- if (! surface->msaa_active)
- return CAIRO_INT_STATUS_SUCCESS;
-
- if (surface->base.device == NULL)
- return CAIRO_INT_STATUS_SUCCESS;
-
- /* GLES surfaces do not need explicit resolution. */
- if (((cairo_gl_context_t *) surface->base.device)->gl_flavor == CAIRO_GL_FLAVOR_ES)
- return CAIRO_INT_STATUS_SUCCESS;
-
- if (! _cairo_gl_surface_is_texture (surface))
- return CAIRO_INT_STATUS_SUCCESS;
-
- status = _cairo_gl_context_acquire (surface->base.device, &ctx);
- if (unlikely (status))
- return status;
-
- ctx->current_target = surface;
-
-#if CAIRO_HAS_GL_SURFACE
- _cairo_gl_activate_surface_as_nonmultisampling (ctx, surface);
-#endif
-
- status = _cairo_gl_context_release (ctx, status);
- return status;
-}
-
static cairo_status_t
_cairo_gl_subsurface_clone_operand_init (cairo_gl_operand_t *operand,
const cairo_pattern_t *_src,
@@ -161,7 +128,7 @@ _cairo_gl_subsurface_clone_operand_init (cairo_gl_operand_t *operand,
_cairo_surface_subsurface_set_snapshot (&sub->base, &surface->base);
}
- status = _resolve_multisampling (surface);
+ status = _cairo_gl_surface_resolve_multisampling (surface);
if (unlikely (status))
return status;
@@ -223,7 +190,7 @@ _cairo_gl_subsurface_operand_init (cairo_gl_operand_t *operand,
if (! _cairo_gl_surface_is_texture (surface))
return CAIRO_INT_STATUS_UNSUPPORTED;
- status = _resolve_multisampling (surface);
+ status = _cairo_gl_surface_resolve_multisampling (surface);
if (unlikely (status))
return status;
@@ -281,7 +248,7 @@ _cairo_gl_surface_operand_init (cairo_gl_operand_t *operand,
if (surface->base.device && ! _cairo_gl_surface_is_texture (surface))
return CAIRO_INT_STATUS_UNSUPPORTED;
- status = _resolve_multisampling (surface);
+ status = _cairo_gl_surface_resolve_multisampling (surface);
if (unlikely (status))
return status;
diff --git a/src/cairo-gl-private.h b/src/cairo-gl-private.h
index 5c9193d..c99bd16 100644
--- a/src/cairo-gl-private.h
+++ b/src/cairo-gl-private.h
@@ -440,6 +440,9 @@ _cairo_gl_surface_draw_image (cairo_gl_surface_t *dst,
int dst_x, int dst_y,
cairo_bool_t force_flush);
+cairo_private cairo_int_status_t
+_cairo_gl_surface_resolve_multisampling (cairo_gl_surface_t *surface);
+
static cairo_always_inline cairo_bool_t
_cairo_gl_device_has_glsl (cairo_device_t *device)
{
diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 1d7515a..144dccc 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -1278,9 +1278,44 @@ _cairo_gl_surface_flush (void *abstract_surface, unsigned flags)
(ctx->current_target == surface))
_cairo_gl_composite_flush (ctx);
+ status = _cairo_gl_surface_resolve_multisampling (surface);
+
return _cairo_gl_context_release (ctx, status);
}
+cairo_int_status_t
+_cairo_gl_surface_resolve_multisampling (cairo_gl_surface_t *surface)
+{
+ cairo_gl_context_t *ctx;
+ cairo_int_status_t status;
+
+ if (! surface->msaa_active)
+ return CAIRO_INT_STATUS_SUCCESS;
+
+ if (surface->base.device == NULL)
+ return CAIRO_INT_STATUS_SUCCESS;
+
+ /* GLES surfaces do not need explicit resolution. */
+ if (((cairo_gl_context_t *) surface->base.device)->gl_flavor == CAIRO_GL_FLAVOR_ES)
+ return CAIRO_INT_STATUS_SUCCESS;
+
+ if (! _cairo_gl_surface_is_texture (surface))
+ return CAIRO_INT_STATUS_SUCCESS;
+
+ status = _cairo_gl_context_acquire (surface->base.device, &ctx);
+ if (unlikely (status))
+ return status;
+
+ ctx->current_target = surface;
+
+#if CAIRO_HAS_GL_SURFACE
+ _cairo_gl_activate_surface_as_nonmultisampling (ctx, surface);
+#endif
+
+ status = _cairo_gl_context_release (ctx, status);
+ return status;
+}
+
static const cairo_compositor_t *
get_compositor (cairo_gl_surface_t *surface)
{
More information about the cairo-commit
mailing list