[cairo-commit] 3 commits - src/cairo-gl-device.c src/cairo-gl-msaa-compositor.c

Chris Wilson ickle at kemper.freedesktop.org
Thu Dec 15 11:33:11 PST 2011


 src/cairo-gl-device.c          |   14 ++++++++++++--
 src/cairo-gl-msaa-compositor.c |   15 +++++++++++----
 2 files changed, 23 insertions(+), 6 deletions(-)

New commits:
commit bbe692372d593a70d80de9fdb0de521a9f012f08
Author: Martin Robinson <mrobinson at igalia.com>
Date:   Thu Dec 15 10:49:27 2011 -0800

    gl/msaa: Ignore the antialiasing property of the clip.
    
    If the clip suggests anti-aliasing and we don't support it,
    draw the clip anyway. Currently disabling anti-aliasing does
    not disable anti-aliasing on certain clips.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-gl-msaa-compositor.c b/src/cairo-gl-msaa-compositor.c
index bfd23d4..fdd9666 100644
--- a/src/cairo-gl-msaa-compositor.c
+++ b/src/cairo-gl-msaa-compositor.c
@@ -141,10 +141,16 @@ _draw_clip (cairo_gl_context_t		*ctx,
     if (unlikely (status))
 	return status;
 
-    if (antialias != CAIRO_ANTIALIAS_NONE) {
-	_cairo_polygon_fini (&polygon);
-	return CAIRO_INT_STATUS_UNSUPPORTED;
-    }
+    /* We ignore the antialias mode of the clip here, since the user requested
+     * unantialiased rendering of their path and we expect that this stencil
+     * based rendering of the clip to be a reasonable approximation to
+     * the intersection between that clip and the path.
+     *
+     * In other words, what the user expects when they try to perform
+     * a geometric intersection between an unantialiased polygon and an
+     * antialiased polygon is open to interpretation. And we choose the fast
+     * option.
+     */
 
     _cairo_traps_init (&traps);
     status = _cairo_bentley_ottmann_tessellate_polygon (&traps,
commit b98c8c126989e1158c3f78d8e5f20834a2af10b2
Author: Martin Robinson <mrobinson at igalia.com>
Date:   Thu Dec 15 10:48:16 2011 -0800

    gl/msaa: If stenciling the clip fails, reset the color mask.
    
    If the clip failed, not resetting the color mask leaves the GL context
    in a state in which we cannot draw anything.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-gl-msaa-compositor.c b/src/cairo-gl-msaa-compositor.c
index 81b8277..bfd23d4 100644
--- a/src/cairo-gl-msaa-compositor.c
+++ b/src/cairo-gl-msaa-compositor.c
@@ -189,6 +189,7 @@ _draw_clip_to_stencil_buffer (cairo_gl_context_t	*ctx,
 
     status = _draw_clip (ctx, setup, clip);
     if (unlikely (status)) {
+	glColorMask (1, 1, 1, 1);
 	_disable_stencil_buffer ();
 	return status;
     }
commit 8f74159d9295c8570c244c6e3c454937c842b9d3
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Dec 15 19:12:00 2011 +0000

    gl: Disable the msaa compositor by default (for release testing)
    
    One of the remaining issues with msaa is Cairo's insistence on
    allocating a depth-stencil for every target. These cause massive
    overallocation and prevents my machines from completing
    cairo-perf-trace. So for the time being switch back to the old
    fashioned span-based compositor.
    
    To continue development of msaa, or indeed other compositors, we
    introduce the CAIRO_GL_COMPOSITOR env variable to allow the default
    compositor to be selected. Use CAIRO_GL_COMPOSITOR=msaa to continue to
    use the msaa compositor for instance.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-gl-device.c b/src/cairo-gl-device.c
index ce34779..edc207e 100644
--- a/src/cairo-gl-device.c
+++ b/src/cairo-gl-device.c
@@ -161,12 +161,22 @@ _cairo_gl_context_init (cairo_gl_context_t *ctx)
     cairo_gl_dispatch_t *dispatch = &ctx->dispatch;
     int gl_version = _cairo_gl_get_version ();
     cairo_gl_flavor_t gl_flavor = _cairo_gl_get_flavor ();
+    const char *env;
     int n;
 
     _cairo_device_init (&ctx->base, &_cairo_gl_device_backend);
 
-    //ctx->compositor = _cairo_gl_span_compositor_get ();
-    ctx->compositor = _cairo_gl_msaa_compositor_get ();
+    ctx->compositor = _cairo_gl_span_compositor_get ();
+
+    /* XXX The choice of compositor should be made automatically at runtime.
+     * However, it is useful to force one particular compositor whilst
+     * testing.
+     */
+    env = getenv ("CAIRO_GL_COMPOSITOR");
+    if (env) {
+	if (strcmp(env, "msaa") == 0)
+	    ctx->compositor = _cairo_gl_msaa_compositor_get ();
+    }
 
     memset (ctx->glyph_cache, 0, sizeof (ctx->glyph_cache));
     cairo_list_init (&ctx->fonts);


More information about the cairo-commit mailing list