Evas gl: Add shaders for RGB+Alpha mode

These shaders take two textures as input and sample RGB from
texture 1 and alpha from texture 2. This is the non-premultiplied
version, so RGB' = RGB*A.

This includes only the GLSL code.
This commit is contained in:
Jean-Philippe Andre 2014-07-04 18:07:34 +09:00
parent 23e60bd6ff
commit 224506171f
9 changed files with 141 additions and 0 deletions

View File

@ -66,6 +66,9 @@ compile nv12_nomul
compile yuy2
compile yuy2_nomul
compile rgb_a_pair
compile rgb_a_pair_nomul
compile filter_blur_bgra
compile filter_blur_bgra_nomul
compile filter_blur

View File

@ -0,0 +1,18 @@
"#ifdef GL_ES\n"
"#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
"precision highp float;\n"
"#else\n"
"precision mediump float;\n"
"#endif\n"
"#endif\n"
"uniform sampler2D tex;\n"
"uniform sampler2D texm;\n"
"varying vec4 col;\n"
"varying vec2 tex_c;\n"
"varying vec2 tex_a;\n"
"void main()\n"
"{\n"
" gl_FragColor.rgb = texture2D(tex, tex_c.xy).rgb * col.rgb * texture2D(texm, tex_a).g;\n"
" gl_FragColor.a = col.a * texture2D(texm, tex_a).g;\n"
"}\n"
"\n"

View File

@ -0,0 +1,18 @@
#ifdef GL_ES
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
#endif
uniform sampler2D tex;
uniform sampler2D texm;
varying vec4 col;
varying vec2 tex_c;
varying vec2 tex_a;
void main()
{
gl_FragColor.rgb = texture2D(tex, tex_c.xy).rgb * col.rgb * texture2D(texm, tex_a).g;
gl_FragColor.a = col.a * texture2D(texm, tex_a).g;
}

View File

@ -0,0 +1,16 @@
"#ifdef GL_ES\n"
"#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
"precision highp float;\n"
"#else\n"
"precision mediump float;\n"
"#endif\n"
"#endif\n"
"uniform sampler2D tex;\n"
"uniform sampler2D texm;\n"
"varying vec2 tex_c;\n"
"varying vec2 tex_a;\n"
"void main()\n"
"{\n"
" gl_FragColor.rgb = texture2D(tex, tex_c.xy).rgb * texture2D(texm, tex_a).g;\n"
" gl_FragColor.a = texture2D(texm, tex_a).g;\n"
"}\n"

View File

@ -0,0 +1,16 @@
#ifdef GL_ES
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
#endif
uniform sampler2D tex;
uniform sampler2D texm;
varying vec2 tex_c;
varying vec2 tex_a;
void main()
{
gl_FragColor.rgb = texture2D(tex, tex_c.xy).rgb * texture2D(texm, tex_a).g;
gl_FragColor.a = texture2D(texm, tex_a).g;
}

View File

@ -0,0 +1,16 @@
"#ifdef GL_ES\n"
"precision highp float;\n"
"#endif\n"
"attribute vec4 vertex;\n"
"attribute vec2 tex_coord;\n"
"attribute vec2 tex_coordm;\n"
"uniform mat4 mvp;\n"
"varying vec2 tex_c;\n"
"varying vec2 tex_a;\n"
"void main()\n"
"{\n"
" gl_Position = mvp * vertex;\n"
" tex_c = tex_coord;\n"
" tex_a = tex_coordm;\n"
"}\n"
"\n"

View File

@ -0,0 +1,16 @@
#ifdef GL_ES
precision highp float;
#endif
attribute vec4 vertex;
attribute vec2 tex_coord;
attribute vec2 tex_coordm;
uniform mat4 mvp;
varying vec2 tex_c;
varying vec2 tex_a;
void main()
{
gl_Position = mvp * vertex;
tex_c = tex_coord;
tex_a = tex_coordm;
}

View File

@ -0,0 +1,19 @@
"#ifdef GL_ES\n"
"precision highp float;\n"
"#endif\n"
"attribute vec4 vertex;\n"
"attribute vec4 color;\n"
"attribute vec2 tex_coord;\n"
"attribute vec2 tex_coordm;\n"
"uniform mat4 mvp;\n"
"varying vec4 col;\n"
"varying vec2 tex_c;\n"
"varying vec2 tex_a;\n"
"void main()\n"
"{\n"
" gl_Position = mvp * vertex;\n"
" col = color;\n"
" tex_c = tex_coord;\n"
" tex_a = tex_coordm;\n"
"}\n"
"\n"

View File

@ -0,0 +1,19 @@
#ifdef GL_ES
precision highp float;
#endif
attribute vec4 vertex;
attribute vec4 color;
attribute vec2 tex_coord;
attribute vec2 tex_coordm;
uniform mat4 mvp;
varying vec4 col;
varying vec2 tex_c;
varying vec2 tex_a;
void main()
{
gl_Position = mvp * vertex;
col = color;
tex_c = tex_coord;
tex_a = tex_coordm;
}