[cairo-commit] 3 commits - src/cairo-gl-composite.c src/cairo-gl-private.h src/cairo-gl-shaders.c src/cairo-gl-surface.c

Chris Wilson ickle at kemper.freedesktop.org
Thu May 27 12:13:49 PDT 2010


 src/cairo-gl-composite.c |    7 ++++---
 src/cairo-gl-private.h   |   10 ----------
 src/cairo-gl-shaders.c   |   41 +++++++++++++++++++++++++----------------
 src/cairo-gl-surface.c   |    3 +++
 4 files changed, 32 insertions(+), 29 deletions(-)

New commits:
commit b3e15bd5c307352065555c6c3ae5f0bd15b9a791
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu May 27 18:43:03 2010 +0100

    gl: _cairo_set_shader_by_type() cannot return UNSUPPORTED
    
    So remove the superfuous test.

diff --git a/src/cairo-gl-composite.c b/src/cairo-gl-composite.c
index 471d241..50f2c07 100644
--- a/src/cairo-gl-composite.c
+++ b/src/cairo-gl-composite.c
@@ -1029,6 +1029,7 @@ _cairo_gl_composite_begin_component_alpha  (cairo_gl_context_t *ctx,
                                                CAIRO_GL_SHADER_IN_CA_SOURCE_ALPHA);
         if (unlikely (status))
             return status;
+
         _cairo_gl_composite_bind_to_shader (ctx, setup);
         setup->pre_shader = ctx->current_shader;
     }
@@ -1059,9 +1060,7 @@ _cairo_gl_composite_begin (cairo_gl_context_t *ctx,
                                                                       : CAIRO_GL_SHADER_IN_NORMAL);
     if (unlikely (status)) {
         setup->pre_shader = NULL;
-        if (_cairo_status_is_error (status))
-	    return status;
-        /* fall back to fixed function here */
+	return status;
     }
 
     status = CAIRO_STATUS_SUCCESS;
@@ -1105,6 +1104,7 @@ _cairo_gl_composite_draw (cairo_gl_context_t *ctx,
 {
     unsigned int count = ctx->vb_offset / ctx->vertex_size;
 
+    _cairo_gl_check_error();
     if (! setup->pre_shader) {
         glDrawArrays (GL_TRIANGLES, 0, count);
     } else {
@@ -1122,6 +1122,7 @@ _cairo_gl_composite_draw (cairo_gl_context_t *ctx,
         _cairo_gl_set_component_alpha_mask_operand (ctx, setup);
         glDrawArrays (GL_TRIANGLES, 0, count);
     }
+    _cairo_gl_check_error();
 }
 
 void
commit 59bd34e6a3661483f60bb01be8b406a5c38e1131
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu May 27 18:35:40 2010 +0100

    gl: Check for an error device when creating surfaces.

diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 96b10e9..ca0b7a2 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -359,6 +359,9 @@ cairo_gl_surface_create (cairo_device_t		*abstract_device,
 					   width, height);
     }
 
+    if (abstract_device->status)
+	return _cairo_surface_create_in_error (abstract_device->status);
+
     if (abstract_device->backend->type != CAIRO_DEVICE_TYPE_GL)
 	return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH));
 
commit 53f086105975c1c2bd4c43a1b0613ebde3580e95
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu May 27 18:27:53 2010 +0100

    gl: Make _cairo_gl_shader_(init|compile) static
    
    Only used within _cairo_gl_shaders.c, so remove the private symbol.

diff --git a/src/cairo-gl-private.h b/src/cairo-gl-private.h
index dd4e1a4..960865c 100644
--- a/src/cairo-gl-private.h
+++ b/src/cairo-gl-private.h
@@ -392,16 +392,6 @@ _cairo_gl_context_init_shaders (cairo_gl_context_t *ctx);
 cairo_private void
 _cairo_gl_context_fini_shaders (cairo_gl_context_t *ctx);
 
-cairo_private void
-_cairo_gl_shader_init (cairo_gl_shader_t *shader);
-
-cairo_private cairo_status_t
-_cairo_gl_shader_compile (cairo_gl_context_t *ctx,
-			  cairo_gl_shader_t *program,
-			  cairo_gl_var_type_t src,
-			  cairo_gl_var_type_t mask,
-			  const char *fragment_text);
-
 cairo_private cairo_status_t
 _cairo_gl_set_shader_by_type (cairo_gl_context_t *ctx,
                               cairo_gl_operand_type_t source,
diff --git a/src/cairo-gl-shaders.c b/src/cairo-gl-shaders.c
index c6ab07a..fdd4b67 100644
--- a/src/cairo-gl-shaders.c
+++ b/src/cairo-gl-shaders.c
@@ -93,6 +93,13 @@ typedef struct cairo_gl_shader_impl {
     (*use) (cairo_gl_shader_t *shader);
 } shader_impl_t;
 
+static cairo_status_t
+_cairo_gl_shader_compile (cairo_gl_context_t *ctx,
+			  cairo_gl_shader_t *shader,
+			  cairo_gl_var_type_t src,
+			  cairo_gl_var_type_t mask,
+			  const char *fragment_text);
+
 /* ARB_shader_objects / ARB_vertex_shader / ARB_fragment_shader extensions
    API. */
 static void
@@ -475,6 +482,13 @@ _cairo_gl_shader_cache_destroy (void *data)
     free (entry);
 }
 
+static void
+_cairo_gl_shader_init (cairo_gl_shader_t *shader)
+{
+    shader->fragment_shader = 0;
+    shader->program = 0;
+}
+
 cairo_status_t
 _cairo_gl_context_init_shaders (cairo_gl_context_t *ctx)
 {
@@ -507,14 +521,16 @@ _cairo_gl_context_init_shaders (cairo_gl_context_t *ctx)
     if (unlikely (status))
 	return status;
 
-    _cairo_gl_shader_init (&ctx->fill_rectangles_shader);
-    status = _cairo_gl_shader_compile (ctx,
-				       &ctx->fill_rectangles_shader,
-				       CAIRO_GL_VAR_NONE,
-				       CAIRO_GL_VAR_NONE,
-				       fill_fs_source);
-    if (unlikely (status))
-	return status;
+    if (ctx->shader_impl != NULL) {
+	_cairo_gl_shader_init (&ctx->fill_rectangles_shader);
+	status = _cairo_gl_shader_compile (ctx,
+					   &ctx->fill_rectangles_shader,
+					   CAIRO_GL_VAR_NONE,
+					   CAIRO_GL_VAR_NONE,
+					   fill_fs_source);
+	if (unlikely (status))
+	    return status;
+    }
 
     return CAIRO_STATUS_SUCCESS;
 }
@@ -533,13 +549,6 @@ _cairo_gl_context_fini_shaders (cairo_gl_context_t *ctx)
 }
 
 void
-_cairo_gl_shader_init (cairo_gl_shader_t *shader)
-{
-    shader->fragment_shader = 0;
-    shader->program = 0;
-}
-
-void
 _cairo_gl_shader_fini (cairo_gl_context_t *ctx,
 		       cairo_gl_shader_t *shader)
 {
@@ -809,7 +818,7 @@ cairo_gl_shader_get_fragment_source (GLuint tex_target,
     return CAIRO_STATUS_SUCCESS;
 }
 
-cairo_status_t
+static cairo_status_t
 _cairo_gl_shader_compile (cairo_gl_context_t *ctx,
 			  cairo_gl_shader_t *shader,
 			  cairo_gl_var_type_t src,


More information about the cairo-commit mailing list