From patchwork Mon Jul 25 13:56:46 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: 3096 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 693E4241E1 for ; Mon, 25 Jul 2011 13:59:32 +0000 (UTC) Received: from mail-qy0-f180.google.com (mail-qy0-f180.google.com [209.85.216.180]) by fiordland.canonical.com (Postfix) with ESMTP id 312F2A18492 for ; Mon, 25 Jul 2011 13:59:32 +0000 (UTC) Received: by qyk30 with SMTP id 30so2965289qyk.11 for ; Mon, 25 Jul 2011 06:59:31 -0700 (PDT) Received: by 10.229.68.200 with SMTP id w8mr3732492qci.114.1311602371453; Mon, 25 Jul 2011 06:59:31 -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 hl14cs77984qcb; Mon, 25 Jul 2011 06:59:31 -0700 (PDT) Received: by 10.223.87.79 with SMTP id v15mr2470179fal.125.1311602278143; Mon, 25 Jul 2011 06:57:58 -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 18si7042659fat.105.2011.07.25.06.57.57 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Jul 2011 06:57:58 -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 6so6802455fxe.17 for ; Mon, 25 Jul 2011 06:57:57 -0700 (PDT) Received: by 10.223.86.76 with SMTP id r12mr6907780fal.80.1311602277679; Mon, 25 Jul 2011 06:57:57 -0700 (PDT) Received: from localhost (77.49.93.204.dsl.dyn.forthnet.gr [77.49.93.204]) by mx.google.com with ESMTPS id d6sm3807523fak.10.2011.07.25.06.57.56 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Jul 2011 06:57:57 -0700 (PDT) From: alexandros.frantzis@linaro.org To: patches@linaro.org Subject: [PATCH 19/21] gl: Define the float precision in the fragment shader for GLES2 Date: Mon, 25 Jul 2011 16:56:46 +0300 Message-Id: <1311602208-5973-19-git-send-email-alexandros.frantzis@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1311602208-5973-1-git-send-email-alexandros.frantzis@linaro.org> References: <1311602208-5973-1-git-send-email-alexandros.frantzis@linaro.org> From: Alexandros Frantzis According to the GLSL ES standard, the precision of variables in the fragment shader should be explicitly defined (although mesa's compiler is not that strict). Signed-off-by: Chris Wilson --- src/cairo-gl-shaders.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/src/cairo-gl-shaders.c b/src/cairo-gl-shaders.c index 77a28aa..7d60c0f 100644 --- a/src/cairo-gl-shaders.c +++ b/src/cairo-gl-shaders.c @@ -385,6 +385,9 @@ cairo_status_t _cairo_gl_context_init_shaders (cairo_gl_context_t *ctx) { static const char *fill_fs_source = + "#ifdef GL_ES\n" + "precision mediump float;\n" + "#endif\n" "uniform vec4 color;\n" "void main()\n" "{\n" @@ -847,6 +850,11 @@ cairo_gl_shader_get_fragment_source (cairo_gl_context_t *ctx, unsigned long length; cairo_status_t status; + _cairo_output_stream_printf (stream, + "#ifdef GL_ES\n" + "precision mediump float;\n" + "#endif\n"); + if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES) { if (_cairo_gl_shader_needs_border_fade (src)) _cairo_gl_shader_emit_border_fade (stream, src, CAIRO_GL_TEX_SOURCE);