diff mbox

[2/3] gl: Remove unnecessary checks for NULL shader implementation

Message ID 1311602815-6314-2-git-send-email-alexandros.frantzis@linaro.org
State Accepted
Headers show

Commit Message

alexandros.frantzis@linaro.org July 25, 2011, 2:06 p.m. UTC
From: Alexandros Frantzis <alexandros.frantzis@linaro.org>

Due to the fact that we fail if the system doesn't support shaders, we
now always have a valid shader implementation.

Reviewed-by: Eric Anholt <eric@anholt.net>
---
 src/cairo-gl-shaders.c |   29 ++++++++---------------------
 1 files changed, 8 insertions(+), 21 deletions(-)
diff mbox

Patch

diff --git a/src/cairo-gl-shaders.c b/src/cairo-gl-shaders.c
index 6a42fd1..a39883d 100644
--- a/src/cairo-gl-shaders.c
+++ b/src/cairo-gl-shaders.c
@@ -379,16 +379,14 @@  _cairo_gl_context_init_shaders (cairo_gl_context_t *ctx)
     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;
-    }
+    _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;
 }
@@ -719,9 +717,6 @@  _cairo_gl_shader_compile (cairo_gl_context_t *ctx,
     unsigned int vertex_shader;
     cairo_status_t status;
 
-    if (ctx->shader_impl == NULL)
-        return CAIRO_STATUS_SUCCESS;
-
     assert (shader->program == 0);
 
     vertex_shader = cairo_gl_var_type_hash (src, mask, CAIRO_GL_VAR_NONE);
@@ -813,9 +808,6 @@  void
 _cairo_gl_set_shader (cairo_gl_context_t *ctx,
 		      cairo_gl_shader_t *shader)
 {
-    if (ctx->shader_impl == NULL)
-	return;
-
     if (ctx->current_shader == shader)
         return;
 
@@ -835,11 +827,6 @@  _cairo_gl_get_shader_by_type (cairo_gl_context_t *ctx,
     char *fs_source;
     cairo_status_t status;
 
-    if (ctx->shader_impl == NULL) {
-        *shader = NULL;
-	return CAIRO_STATUS_SUCCESS;
-    }
-
     lookup.src = source;
     lookup.mask = mask;
     lookup.dest = CAIRO_GL_OPERAND_NONE;