mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-04-30 23:47:59 +02:00
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:
parent
1595f20bb7
commit
2001d20747
1 changed files with 8 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue