From patchwork Mon Jul 25 14:06:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexandros.frantzis@linaro.org X-Patchwork-Id: 3106 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id E3218241E1 for ; Mon, 25 Jul 2011 14:07:05 +0000 (UTC) Received: from mail-qy0-f173.google.com (mail-qy0-f173.google.com [209.85.216.173]) by fiordland.canonical.com (Postfix) with ESMTP id A3478A1844E for ; Mon, 25 Jul 2011 14:07:05 +0000 (UTC) Received: by qyk10 with SMTP id 10so1064330qyk.11 for ; Mon, 25 Jul 2011 07:07:05 -0700 (PDT) Received: by 10.229.1.217 with SMTP id 25mr1012546qcg.38.1311602822970; Mon, 25 Jul 2011 07:07:02 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.229.217.78 with SMTP id hl14cs78218qcb; Mon, 25 Jul 2011 07:07:02 -0700 (PDT) Received: by 10.223.55.8 with SMTP id s8mr6795932fag.141.1311602821955; Mon, 25 Jul 2011 07:07:01 -0700 (PDT) Received: from mail-fx0-f44.google.com (mail-fx0-f44.google.com [209.85.161.44]) by mx.google.com with ESMTPS id l8si7047111fam.151.2011.07.25.07.07.01 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Jul 2011 07:07:01 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.161.44 is neither permitted nor denied by best guess record for domain of alexandros.frantzis@linaro.org) client-ip=209.85.161.44; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.161.44 is neither permitted nor denied by best guess record for domain of alexandros.frantzis@linaro.org) smtp.mail=alexandros.frantzis@linaro.org Received: by mail-fx0-f44.google.com with SMTP id 6so6812833fxe.17 for ; Mon, 25 Jul 2011 07:07:01 -0700 (PDT) Received: by 10.223.96.13 with SMTP id f13mr3599381fan.37.1311602821557; Mon, 25 Jul 2011 07:07:01 -0700 (PDT) Received: from localhost (77.49.93.204.dsl.dyn.forthnet.gr [77.49.93.204]) by mx.google.com with ESMTPS id e10sm3805755fak.42.2011.07.25.07.07.00 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Jul 2011 07:07:01 -0700 (PDT) From: alexandros.frantzis@linaro.org To: patches@linaro.org Subject: [PATCH 2/3] gl: Remove unnecessary checks for NULL shader implementation Date: Mon, 25 Jul 2011 17:06:54 +0300 Message-Id: <1311602815-6314-2-git-send-email-alexandros.frantzis@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1311602815-6314-1-git-send-email-alexandros.frantzis@linaro.org> References: <1311602815-6314-1-git-send-email-alexandros.frantzis@linaro.org> From: Alexandros Frantzis 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 --- src/cairo-gl-shaders.c | 29 ++++++++--------------------- 1 files changed, 8 insertions(+), 21 deletions(-) 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;