Commit 15cb8643 authored by Matthew Waters's avatar Matthew Waters 🐨

glshader: fix default external-oes shaders

In glsl, #extension directives need to before other non-preprocesser
directives.  We were placing the precision qualifier before that.  Fix
by moving the #extension to the first line in the shader.

Fixes: gstreamer/gst-plugins-base#601
parent f8bed33d
......@@ -84,8 +84,10 @@ const gchar *gst_gl_shader_string_fragment_default =
MEDIUMP_PRECISION
DEFAULT_FRAGMENT_BODY;
#define EXTERNAL_FRAGMENT_HEADER \
"#extension GL_OES_EGL_image_external : require\n"
#define EXTERNAL_FRAGMENT_BODY \
"#extension GL_OES_EGL_image_external : require\n" \
"varying vec2 v_texcoord;\n" \
"uniform samplerExternalOES tex;\n" \
"void main()\n" \
......@@ -93,6 +95,7 @@ const gchar *gst_gl_shader_string_fragment_default =
" gl_FragColor = texture2D(tex, v_texcoord);\n" \
"}"
const gchar *gst_gl_shader_string_fragment_external_oes_default =
EXTERNAL_FRAGMENT_HEADER
MEDIUMP_PRECISION
EXTERNAL_FRAGMENT_BODY;
/* *INDENT-ON* */
......@@ -168,5 +171,6 @@ gst_gl_shader_string_fragment_external_oes_get_default (GstGLContext * context,
const gchar *precision =
gst_gl_shader_string_get_highest_precision (context, version, profile);
return g_strdup_printf ("%s%s", precision, EXTERNAL_FRAGMENT_BODY);
return g_strdup_printf ("%s%s%s", EXTERNAL_FRAGMENT_HEADER, precision,
EXTERNAL_FRAGMENT_BODY);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment