jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=224506171fca9c814fc188e78c64d57d8529fac1
commit 224506171fca9c814fc188e78c64d57d8529fac1 Author: Jean-Philippe Andre <jp.an...@samsung.com> Date: Fri Jul 4 18:07:34 2014 +0900 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. --- src/modules/evas/engines/gl_common/shader/compile.sh | 3 +++ .../evas/engines/gl_common/shader/rgb_a_pair_frag.h | 18 ++++++++++++++++++ .../evas/engines/gl_common/shader/rgb_a_pair_frag.shd | 18 ++++++++++++++++++ .../engines/gl_common/shader/rgb_a_pair_nomul_frag.h | 16 ++++++++++++++++ .../gl_common/shader/rgb_a_pair_nomul_frag.shd | 16 ++++++++++++++++ .../engines/gl_common/shader/rgb_a_pair_nomul_vert.h | 16 ++++++++++++++++ .../gl_common/shader/rgb_a_pair_nomul_vert.shd | 16 ++++++++++++++++ .../evas/engines/gl_common/shader/rgb_a_pair_vert.h | 19 +++++++++++++++++++ .../evas/engines/gl_common/shader/rgb_a_pair_vert.shd | 19 +++++++++++++++++++ 9 files changed, 141 insertions(+) diff --git a/src/modules/evas/engines/gl_common/shader/compile.sh b/src/modules/evas/engines/gl_common/shader/compile.sh index 3ce2d5c..bf7c4cd 100755 --- a/src/modules/evas/engines/gl_common/shader/compile.sh +++ b/src/modules/evas/engines/gl_common/shader/compile.sh @@ -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 diff --git a/src/modules/evas/engines/gl_common/shader/rgb_a_pair_frag.h b/src/modules/evas/engines/gl_common/shader/rgb_a_pair_frag.h new file mode 100644 index 0000000..168709d --- /dev/null +++ b/src/modules/evas/engines/gl_common/shader/rgb_a_pair_frag.h @@ -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" diff --git a/src/modules/evas/engines/gl_common/shader/rgb_a_pair_frag.shd b/src/modules/evas/engines/gl_common/shader/rgb_a_pair_frag.shd new file mode 100644 index 0000000..5dab4d0 --- /dev/null +++ b/src/modules/evas/engines/gl_common/shader/rgb_a_pair_frag.shd @@ -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; +} + diff --git a/src/modules/evas/engines/gl_common/shader/rgb_a_pair_nomul_frag.h b/src/modules/evas/engines/gl_common/shader/rgb_a_pair_nomul_frag.h new file mode 100644 index 0000000..c48aee4 --- /dev/null +++ b/src/modules/evas/engines/gl_common/shader/rgb_a_pair_nomul_frag.h @@ -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" diff --git a/src/modules/evas/engines/gl_common/shader/rgb_a_pair_nomul_frag.shd b/src/modules/evas/engines/gl_common/shader/rgb_a_pair_nomul_frag.shd new file mode 100644 index 0000000..6baba6c --- /dev/null +++ b/src/modules/evas/engines/gl_common/shader/rgb_a_pair_nomul_frag.shd @@ -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; +} diff --git a/src/modules/evas/engines/gl_common/shader/rgb_a_pair_nomul_vert.h b/src/modules/evas/engines/gl_common/shader/rgb_a_pair_nomul_vert.h new file mode 100644 index 0000000..a0685be --- /dev/null +++ b/src/modules/evas/engines/gl_common/shader/rgb_a_pair_nomul_vert.h @@ -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" diff --git a/src/modules/evas/engines/gl_common/shader/rgb_a_pair_nomul_vert.shd b/src/modules/evas/engines/gl_common/shader/rgb_a_pair_nomul_vert.shd new file mode 100644 index 0000000..bf2c242 --- /dev/null +++ b/src/modules/evas/engines/gl_common/shader/rgb_a_pair_nomul_vert.shd @@ -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; +} + diff --git a/src/modules/evas/engines/gl_common/shader/rgb_a_pair_vert.h b/src/modules/evas/engines/gl_common/shader/rgb_a_pair_vert.h new file mode 100644 index 0000000..e8158d1 --- /dev/null +++ b/src/modules/evas/engines/gl_common/shader/rgb_a_pair_vert.h @@ -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" diff --git a/src/modules/evas/engines/gl_common/shader/rgb_a_pair_vert.shd b/src/modules/evas/engines/gl_common/shader/rgb_a_pair_vert.shd new file mode 100644 index 0000000..4a57c52 --- /dev/null +++ b/src/modules/evas/engines/gl_common/shader/rgb_a_pair_vert.shd @@ -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; +} + --