gl: Define the float precision in the fragment shader for GLES2

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 <chris@chris-wilson.co.uk>
This commit is contained in:
Alexandros Frantzis 2011-03-09 18:17:42 +02:00 committed by Chris Wilson
parent 1595f20bb7
commit 2001d20747

View file

@ -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);