summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2014-12-01 19:52:13 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2014-12-22 22:33:11 +0900
commit7627a9bafcc56cc91b25e1bc60435a96613f0d35 (patch)
tree0a52eb3350a191d7abd990ab37b437d6ecab01bf
parent9e503aaa20167d9e4d12585f73cca08a66475dd2 (diff)
Evas masking: Add support for YUV, YUY2, NV12 masking in GL
RGB+A masking needs to be implemented, because there's a clash (only one texture name "texa" is available).
-rw-r--r--src/Makefile_Evas.am8
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_context.c135
-rw-r--r--src/modules/evas/engines/gl_common/shader/evas_gl_enum.x4
-rw-r--r--src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x237
-rw-r--r--src/modules/evas/engines/gl_common/shader/nv12_mask_frag.shd31
-rw-r--r--src/modules/evas/engines/gl_common/shader/nv12_mask_vert.shd17
-rw-r--r--src/modules/evas/engines/gl_common/shader/rgb_a_pair_mask_frag.shd19
-rw-r--r--src/modules/evas/engines/gl_common/shader/rgb_a_pair_mask_vert.shd21
-rw-r--r--src/modules/evas/engines/gl_common/shader/yuv_mask_frag.shd25
-rw-r--r--src/modules/evas/engines/gl_common/shader/yuv_mask_vert.shd18
-rw-r--r--src/modules/evas/engines/gl_common/shader/yuy2_mask_frag.shd30
-rw-r--r--src/modules/evas/engines/gl_common/shader/yuy2_mask_vert.shd17
12 files changed, 539 insertions, 23 deletions
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index ce415ce0f4..92238f47bb 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -686,6 +686,14 @@ modules/evas/engines/gl_common/shader/img_mask_bgra_frag.shd \
686modules/evas/engines/gl_common/shader/img_mask_bgra_vert.shd \ 686modules/evas/engines/gl_common/shader/img_mask_bgra_vert.shd \
687modules/evas/engines/gl_common/shader/img_mask_bgra_nomul_frag.shd \ 687modules/evas/engines/gl_common/shader/img_mask_bgra_nomul_frag.shd \
688modules/evas/engines/gl_common/shader/img_mask_bgra_nomul_vert.shd \ 688modules/evas/engines/gl_common/shader/img_mask_bgra_nomul_vert.shd \
689modules/evas/engines/gl_common/shader/yuv_mask_frag.shd \
690modules/evas/engines/gl_common/shader/yuv_mask_vert.shd \
691modules/evas/engines/gl_common/shader/nv12_mask_frag.shd \
692modules/evas/engines/gl_common/shader/nv12_mask_vert.shd \
693modules/evas/engines/gl_common/shader/yuy2_mask_frag.shd \
694modules/evas/engines/gl_common/shader/yuy2_mask_vert.shd \
695modules/evas/engines/gl_common/shader/rgb_a_pair_mask_frag.shd \
696modules/evas/engines/gl_common/shader/rgb_a_pair_mask_vert.shd \
689$(NULL) 697$(NULL)
690 698
691EXTRA_DIST += \ 699EXTRA_DIST += \
diff --git a/src/modules/evas/engines/gl_common/evas_gl_context.c b/src/modules/evas/engines/gl_common/evas_gl_context.c
index 00e4489560..170581ff4f 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_context.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_context.c
@@ -2068,7 +2068,7 @@ evas_gl_common_context_yuv_push(Evas_Engine_GL_Context *gc,
2068 int r, int g, int b, int a, 2068 int r, int g, int b, int a,
2069 Eina_Bool smooth) 2069 Eina_Bool smooth)
2070{ 2070{
2071 int pnum, nv, nc, nu, nu2, nu3, i; 2071 int pnum, nv, nc, nu, nu2, nu3, na, i;
2072 GLfloat tx1, tx2, ty1, ty2, t2x1, t2x2, t2y1, t2y2; 2072 GLfloat tx1, tx2, ty1, ty2, t2x1, t2x2, t2y1, t2y2;
2073 Eina_Bool blend = 0; 2073 Eina_Bool blend = 0;
2074 GLuint prog; 2074 GLuint prog;
@@ -2076,10 +2076,9 @@ evas_gl_common_context_yuv_push(Evas_Engine_GL_Context *gc,
2076 2076
2077 if (a < 255) blend = 1; 2077 if (a < 255) blend = 1;
2078 2078
2079#warning YUV+mask
2080 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 2079 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
2081 SHADER_YUV_NOMUL, SHADER_YUV, 2080 SHADER_YUV_NOMUL, SHADER_YUV,
2082 SHADER_YUV_NOMUL, SHADER_YUV)].prog; 2081 SHADER_YUV_MASK, SHADER_YUV_MASK)].prog;
2083 2082
2084 pn = _evas_gl_common_context_push(RTYPE_YUV, 2083 pn = _evas_gl_common_context_push(RTYPE_YUV,
2085 gc, tex, 2084 gc, tex,
@@ -2093,6 +2092,7 @@ evas_gl_common_context_yuv_push(Evas_Engine_GL_Context *gc,
2093 gc->pipe[pn].shader.cur_tex = tex->pt->texture; 2092 gc->pipe[pn].shader.cur_tex = tex->pt->texture;
2094 gc->pipe[pn].shader.cur_texu = tex->ptu->texture; 2093 gc->pipe[pn].shader.cur_texu = tex->ptu->texture;
2095 gc->pipe[pn].shader.cur_texv = tex->ptv->texture; 2094 gc->pipe[pn].shader.cur_texv = tex->ptv->texture;
2095 gc->pipe[pn].shader.cur_texa = mtex ? mtex->pt->texture : 0;
2096 gc->pipe[pn].shader.cur_prog = prog; 2096 gc->pipe[pn].shader.cur_prog = prog;
2097 gc->pipe[pn].shader.smooth = smooth; 2097 gc->pipe[pn].shader.smooth = smooth;
2098 gc->pipe[pn].shader.blend = blend; 2098 gc->pipe[pn].shader.blend = blend;
@@ -2108,13 +2108,13 @@ evas_gl_common_context_yuv_push(Evas_Engine_GL_Context *gc,
2108 gc->pipe[pn].array.use_texuv = 1; 2108 gc->pipe[pn].array.use_texuv = 1;
2109 gc->pipe[pn].array.use_texuv2 = 1; 2109 gc->pipe[pn].array.use_texuv2 = 1;
2110 gc->pipe[pn].array.use_texuv3 = 1; 2110 gc->pipe[pn].array.use_texuv3 = 1;
2111 gc->pipe[pn].array.use_texa = 0; 2111 gc->pipe[pn].array.use_texa = !!mtex;
2112 gc->pipe[pn].array.use_texsam = 0; 2112 gc->pipe[pn].array.use_texsam = 0;
2113 2113
2114 pipe_region_expand(gc, pn, x, y, w, h); 2114 pipe_region_expand(gc, pn, x, y, w, h);
2115 2115
2116 pnum = gc->pipe[pn].array.num; 2116 pnum = gc->pipe[pn].array.num;
2117 nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; 2117 nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; na = pnum * 2;
2118 nu2 = pnum * 2; nu3 = pnum * 2; 2118 nu2 = pnum * 2; nu3 = pnum * 2;
2119 gc->pipe[pn].array.num += 6; 2119 gc->pipe[pn].array.num += 6;
2120 array_alloc(gc, pn); 2120 array_alloc(gc, pn);
@@ -2161,6 +2161,22 @@ evas_gl_common_context_yuv_push(Evas_Engine_GL_Context *gc,
2161 PUSH_TEXUV3(pn, t2x2, t2y2); 2161 PUSH_TEXUV3(pn, t2x2, t2y2);
2162 PUSH_TEXUV3(pn, t2x1, t2y2); 2162 PUSH_TEXUV3(pn, t2x1, t2y2);
2163 2163
2164 if (mtex)
2165 {
2166 t2x1 = (mtex->x + mx) / (double)mtex->pt->w;
2167 t2y1 = (mtex->y + my) / (double)mtex->pt->h;
2168 t2x2 = (mtex->x + mx + mw) / (double)mtex->pt->w;
2169 t2y2 = (mtex->y + my + mh) / (double)mtex->pt->h;
2170
2171 PUSH_TEXA(pn, t2x1, t2y1);
2172 PUSH_TEXA(pn, t2x2, t2y1);
2173 PUSH_TEXA(pn, t2x1, t2y2);
2174
2175 PUSH_TEXA(pn, t2x2, t2y1);
2176 PUSH_TEXA(pn, t2x2, t2y2);
2177 PUSH_TEXA(pn, t2x1, t2y2);
2178 }
2179
2164 for (i = 0; i < 6; i++) 2180 for (i = 0; i < 6; i++)
2165 { 2181 {
2166 PUSH_COLOR(pn, r, g, b, a); 2182 PUSH_COLOR(pn, r, g, b, a);
@@ -2176,7 +2192,7 @@ evas_gl_common_context_yuy2_push(Evas_Engine_GL_Context *gc,
2176 int r, int g, int b, int a, 2192 int r, int g, int b, int a,
2177 Eina_Bool smooth) 2193 Eina_Bool smooth)
2178{ 2194{
2179 int pnum, nv, nc, nu, nu2, i; 2195 int pnum, nv, nc, nu, nu2, na, i;
2180 GLfloat tx1, tx2, ty1, ty2, t2x1, t2x2, t2y1, t2y2; 2196 GLfloat tx1, tx2, ty1, ty2, t2x1, t2x2, t2y1, t2y2;
2181 Eina_Bool blend = 0; 2197 Eina_Bool blend = 0;
2182 GLuint prog; 2198 GLuint prog;
@@ -2184,10 +2200,9 @@ evas_gl_common_context_yuy2_push(Evas_Engine_GL_Context *gc,
2184 2200
2185 if (a < 255) blend = 1; 2201 if (a < 255) blend = 1;
2186 2202
2187#warning mask
2188 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 2203 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
2189 SHADER_YUY2_NOMUL, SHADER_YUY2, 2204 SHADER_YUY2_NOMUL, SHADER_YUY2,
2190 SHADER_YUY2_NOMUL, SHADER_YUY2)].prog; 2205 SHADER_YUY2_MASK, SHADER_YUY2_MASK)].prog;
2191 2206
2192 pn = _evas_gl_common_context_push(RTYPE_YUY2, 2207 pn = _evas_gl_common_context_push(RTYPE_YUY2,
2193 gc, tex, 2208 gc, tex,
@@ -2200,6 +2215,7 @@ evas_gl_common_context_yuy2_push(Evas_Engine_GL_Context *gc,
2200 gc->pipe[pn].region.type = RTYPE_YUY2; 2215 gc->pipe[pn].region.type = RTYPE_YUY2;
2201 gc->pipe[pn].shader.cur_tex = tex->pt->texture; 2216 gc->pipe[pn].shader.cur_tex = tex->pt->texture;
2202 gc->pipe[pn].shader.cur_texu = tex->ptuv->texture; 2217 gc->pipe[pn].shader.cur_texu = tex->ptuv->texture;
2218 gc->pipe[pn].shader.cur_texa = mtex ? mtex->pt->texture : 0;
2203 gc->pipe[pn].shader.cur_prog = prog; 2219 gc->pipe[pn].shader.cur_prog = prog;
2204 gc->pipe[pn].shader.smooth = smooth; 2220 gc->pipe[pn].shader.smooth = smooth;
2205 gc->pipe[pn].shader.blend = blend; 2221 gc->pipe[pn].shader.blend = blend;
@@ -2215,13 +2231,13 @@ evas_gl_common_context_yuy2_push(Evas_Engine_GL_Context *gc,
2215 gc->pipe[pn].array.use_texuv = 1; 2231 gc->pipe[pn].array.use_texuv = 1;
2216 gc->pipe[pn].array.use_texuv2 = 1; 2232 gc->pipe[pn].array.use_texuv2 = 1;
2217 gc->pipe[pn].array.use_texuv3 = 0; 2233 gc->pipe[pn].array.use_texuv3 = 0;
2218 gc->pipe[pn].array.use_texa = 0; 2234 gc->pipe[pn].array.use_texa = !!mtex;
2219 gc->pipe[pn].array.use_texsam = 0; 2235 gc->pipe[pn].array.use_texsam = 0;
2220 2236
2221 pipe_region_expand(gc, pn, x, y, w, h); 2237 pipe_region_expand(gc, pn, x, y, w, h);
2222 2238
2223 pnum = gc->pipe[pn].array.num; 2239 pnum = gc->pipe[pn].array.num;
2224 nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; 2240 nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; na = pnum * 2;
2225 nu2 = pnum * 2; 2241 nu2 = pnum * 2;
2226 gc->pipe[pn].array.num += 6; 2242 gc->pipe[pn].array.num += 6;
2227 array_alloc(gc, pn); 2243 array_alloc(gc, pn);
@@ -2260,6 +2276,22 @@ evas_gl_common_context_yuy2_push(Evas_Engine_GL_Context *gc,
2260 PUSH_TEXUV2(pn, t2x2, t2y2); 2276 PUSH_TEXUV2(pn, t2x2, t2y2);
2261 PUSH_TEXUV2(pn, t2x1, t2y2); 2277 PUSH_TEXUV2(pn, t2x1, t2y2);
2262 2278
2279 if (mtex)
2280 {
2281 t2x1 = (mtex->x + mx) / (double)mtex->pt->w;
2282 t2y1 = (mtex->y + my) / (double)mtex->pt->h;
2283 t2x2 = (mtex->x + mx + mw) / (double)mtex->pt->w;
2284 t2y2 = (mtex->y + my + mh) / (double)mtex->pt->h;
2285
2286 PUSH_TEXA(pn, t2x1, t2y1);
2287 PUSH_TEXA(pn, t2x2, t2y1);
2288 PUSH_TEXA(pn, t2x1, t2y2);
2289
2290 PUSH_TEXA(pn, t2x2, t2y1);
2291 PUSH_TEXA(pn, t2x2, t2y2);
2292 PUSH_TEXA(pn, t2x1, t2y2);
2293 }
2294
2263 for (i = 0; i < 6; i++) 2295 for (i = 0; i < 6; i++)
2264 { 2296 {
2265 PUSH_COLOR(pn, r, g, b, a); 2297 PUSH_COLOR(pn, r, g, b, a);
@@ -2275,7 +2307,7 @@ evas_gl_common_context_nv12_push(Evas_Engine_GL_Context *gc,
2275 int r, int g, int b, int a, 2307 int r, int g, int b, int a,
2276 Eina_Bool smooth) 2308 Eina_Bool smooth)
2277{ 2309{
2278 int pnum, nv, nc, nu, nu2, i; 2310 int pnum, nv, nc, nu, nu2, na, i;
2279 GLfloat tx1, tx2, ty1, ty2, t2x1, t2x2, t2y1, t2y2; 2311 GLfloat tx1, tx2, ty1, ty2, t2x1, t2x2, t2y1, t2y2;
2280 Eina_Bool blend = 0; 2312 Eina_Bool blend = 0;
2281 GLuint prog; 2313 GLuint prog;
@@ -2283,10 +2315,9 @@ evas_gl_common_context_nv12_push(Evas_Engine_GL_Context *gc,
2283 2315
2284 if (a < 255) blend = 1; 2316 if (a < 255) blend = 1;
2285 2317
2286#warning mask
2287 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 2318 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
2288 SHADER_NV12_NOMUL, SHADER_NV12, 2319 SHADER_NV12_NOMUL, SHADER_NV12,
2289 SHADER_NV12_NOMUL, SHADER_NV12)].prog; 2320 SHADER_NV12_MASK, SHADER_NV12_MASK)].prog;
2290 2321
2291 pn = _evas_gl_common_context_push(RTYPE_NV12, 2322 pn = _evas_gl_common_context_push(RTYPE_NV12,
2292 gc, tex, 2323 gc, tex,
@@ -2301,6 +2332,7 @@ evas_gl_common_context_nv12_push(Evas_Engine_GL_Context *gc,
2301 gc->pipe[pn].shader.cur_tex_dyn = tex->pt->dyn.img; 2332 gc->pipe[pn].shader.cur_tex_dyn = tex->pt->dyn.img;
2302 gc->pipe[pn].shader.cur_texu = tex->ptuv->texture; 2333 gc->pipe[pn].shader.cur_texu = tex->ptuv->texture;
2303 gc->pipe[pn].shader.cur_texu_dyn = tex->ptuv->dyn.img; 2334 gc->pipe[pn].shader.cur_texu_dyn = tex->ptuv->dyn.img;
2335 gc->pipe[pn].shader.cur_texa = mtex ? mtex->pt->texture : 0;
2304 gc->pipe[pn].shader.cur_prog = prog; 2336 gc->pipe[pn].shader.cur_prog = prog;
2305 gc->pipe[pn].shader.smooth = smooth; 2337 gc->pipe[pn].shader.smooth = smooth;
2306 gc->pipe[pn].shader.blend = blend; 2338 gc->pipe[pn].shader.blend = blend;
@@ -2316,13 +2348,13 @@ evas_gl_common_context_nv12_push(Evas_Engine_GL_Context *gc,
2316 gc->pipe[pn].array.use_texuv = 1; 2348 gc->pipe[pn].array.use_texuv = 1;
2317 gc->pipe[pn].array.use_texuv2 = 1; 2349 gc->pipe[pn].array.use_texuv2 = 1;
2318 gc->pipe[pn].array.use_texuv3 = 0; 2350 gc->pipe[pn].array.use_texuv3 = 0;
2319 gc->pipe[pn].array.use_texa = 0; 2351 gc->pipe[pn].array.use_texa = !!mtex;
2320 gc->pipe[pn].array.use_texsam = 0; 2352 gc->pipe[pn].array.use_texsam = 0;
2321 2353
2322 pipe_region_expand(gc, pn, x, y, w, h); 2354 pipe_region_expand(gc, pn, x, y, w, h);
2323 2355
2324 pnum = gc->pipe[pn].array.num; 2356 pnum = gc->pipe[pn].array.num;
2325 nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; 2357 nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; na = pnum * 2;
2326 nu2 = pnum * 2; 2358 nu2 = pnum * 2;
2327 gc->pipe[pn].array.num += 6; 2359 gc->pipe[pn].array.num += 6;
2328 array_alloc(gc, pn); 2360 array_alloc(gc, pn);
@@ -2361,6 +2393,22 @@ evas_gl_common_context_nv12_push(Evas_Engine_GL_Context *gc,
2361 PUSH_TEXUV2(pn, t2x2, t2y2); 2393 PUSH_TEXUV2(pn, t2x2, t2y2);
2362 PUSH_TEXUV2(pn, t2x1, t2y2); 2394 PUSH_TEXUV2(pn, t2x1, t2y2);
2363 2395
2396 if (mtex)
2397 {
2398 t2x1 = (mtex->x + mx) / (double)mtex->pt->w;
2399 t2y1 = (mtex->y + my) / (double)mtex->pt->h;
2400 t2x2 = (mtex->x + mx + mw) / (double)mtex->pt->w;
2401 t2y2 = (mtex->y + my + mh) / (double)mtex->pt->h;
2402
2403 PUSH_TEXA(pn, t2x1, t2y1);
2404 PUSH_TEXA(pn, t2x2, t2y1);
2405 PUSH_TEXA(pn, t2x1, t2y2);
2406
2407 PUSH_TEXA(pn, t2x2, t2y1);
2408 PUSH_TEXA(pn, t2x2, t2y2);
2409 PUSH_TEXA(pn, t2x1, t2y2);
2410 }
2411
2364 for (i = 0; i < 6; i++) 2412 for (i = 0; i < 6; i++)
2365 { 2413 {
2366 PUSH_COLOR(pn, r, g, b, a); 2414 PUSH_COLOR(pn, r, g, b, a);
@@ -2390,11 +2438,10 @@ evas_gl_common_context_rgb_a_pair_push(Evas_Engine_GL_Context *gc,
2390 GLuint prog; 2438 GLuint prog;
2391 int pn; 2439 int pn;
2392 2440
2393#warning rgba+a+mask
2394 prog = gc->shared->shader[evas_gl_common_shader_choice 2441 prog = gc->shared->shader[evas_gl_common_shader_choice
2395 (0, NULL, r, g, b, a, !!mtex, 2442 (0, NULL, r, g, b, a, !!mtex,
2396 SHADER_RGB_A_PAIR_NOMUL, SHADER_RGB_A_PAIR, 2443 SHADER_RGB_A_PAIR_NOMUL, SHADER_RGB_A_PAIR,
2397 SHADER_RGB_A_PAIR_NOMUL, SHADER_RGB_A_PAIR)].prog; 2444 SHADER_RGB_A_PAIR_MASK, SHADER_RGB_A_PAIR_MASK)].prog;
2398 2445
2399 pn = _evas_gl_common_context_push(RTYPE_IMAGE, 2446 pn = _evas_gl_common_context_push(RTYPE_IMAGE,
2400 gc, tex, 2447 gc, tex,
@@ -2407,6 +2454,8 @@ evas_gl_common_context_rgb_a_pair_push(Evas_Engine_GL_Context *gc,
2407 gc->pipe[pn].region.type = RTYPE_IMAGE; 2454 gc->pipe[pn].region.type = RTYPE_IMAGE;
2408 gc->pipe[pn].shader.cur_tex = tex->pt->texture; 2455 gc->pipe[pn].shader.cur_tex = tex->pt->texture;
2409 gc->pipe[pn].shader.cur_texa = tex->pta->texture; 2456 gc->pipe[pn].shader.cur_texa = tex->pta->texture;
2457#warning FIXME: must add texm instead
2458 //gc->pipe[pn].shader.cur_texu = mtex ? mtex->pt->texture : 0;
2410 gc->pipe[pn].shader.cur_prog = prog; 2459 gc->pipe[pn].shader.cur_prog = prog;
2411 gc->pipe[pn].shader.smooth = smooth; 2460 gc->pipe[pn].shader.smooth = smooth;
2412 gc->pipe[pn].shader.blend = EINA_TRUE; 2461 gc->pipe[pn].shader.blend = EINA_TRUE;
@@ -2468,6 +2517,24 @@ evas_gl_common_context_rgb_a_pair_push(Evas_Engine_GL_Context *gc,
2468 PUSH_TEXA(pn, t2x2, t2y2); 2517 PUSH_TEXA(pn, t2x2, t2y2);
2469 PUSH_TEXA(pn, t2x1, t2y2); 2518 PUSH_TEXA(pn, t2x1, t2y2);
2470 2519
2520 /*
2521 if (mtex)
2522 {
2523 t2x1 = (mtex->x + mx) / (double)mtex->pt->w;
2524 t2y1 = (mtex->y + my) / (double)mtex->pt->h;
2525 t2x2 = (mtex->x + mx + mw) / (double)mtex->pt->w;
2526 t2y2 = (mtex->y + my + mh) / (double)mtex->pt->h;
2527
2528 PUSH_TEXM(pn, t2x1, t2y1);
2529 PUSH_TEXM(pn, t2x2, t2y1);
2530 PUSH_TEXM(pn, t2x1, t2y2);
2531
2532 PUSH_TEXM(pn, t2x2, t2y1);
2533 PUSH_TEXM(pn, t2x2, t2y2);
2534 PUSH_TEXM(pn, t2x1, t2y2);
2535 }
2536 */
2537
2471 for (i = 0; i < 6; i++) 2538 for (i = 0; i < 6; i++)
2472 { 2539 {
2473 PUSH_COLOR(pn, r, g, b, a); 2540 PUSH_COLOR(pn, r, g, b, a);
@@ -2485,7 +2552,7 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
2485 Eina_Bool smooth, Eina_Bool tex_only, 2552 Eina_Bool smooth, Eina_Bool tex_only,
2486 Evas_Colorspace cspace) 2553 Evas_Colorspace cspace)
2487{ 2554{
2488 int pnum, nv, nc, nu, nu2, nu3, i; 2555 int pnum, nv, nc, nu, nu2, nu3, na, i;
2489 const int points[6] = { 0, 1, 2, 0, 2, 3 }; 2556 const int points[6] = { 0, 1, 2, 0, 2, 3 };
2490 int x = 0, y = 0, w = 0, h = 0, px = 0, py = 0; 2557 int x = 0, y = 0, w = 0, h = 0, px = 0, py = 0;
2491 GLfloat tx[4], ty[4], t2x[4], t2y[4]; 2558 GLfloat tx[4], ty[4], t2x[4], t2y[4];
@@ -2520,23 +2587,25 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
2520 case EVAS_COLORSPACE_YCBCR422P709_PL: 2587 case EVAS_COLORSPACE_YCBCR422P709_PL:
2521 prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, !!mtex, 2588 prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, !!mtex,
2522 SHADER_YUV_NOMUL, SHADER_YUV, 2589 SHADER_YUV_NOMUL, SHADER_YUV,
2523 SHADER_YUV_NOMUL, SHADER_YUV)].prog; 2590 SHADER_YUV_MASK, SHADER_YUV_MASK)].prog;
2524 utexture = EINA_TRUE; 2591 utexture = EINA_TRUE;
2525 break; 2592 break;
2526 case EVAS_COLORSPACE_YCBCR422601_PL: 2593 case EVAS_COLORSPACE_YCBCR422601_PL:
2527 prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, !!mtex, 2594 prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, !!mtex,
2528 SHADER_YUY2_NOMUL, SHADER_YUY2, 2595 SHADER_YUY2_NOMUL, SHADER_YUY2,
2529 SHADER_YUY2_NOMUL, SHADER_YUY2)].prog; 2596 SHADER_YUY2_MASK, SHADER_YUY2_MASK)].prog;
2530 uvtexture = EINA_TRUE; 2597 uvtexture = EINA_TRUE;
2531 break; 2598 break;
2532 case EVAS_COLORSPACE_YCBCR420NV12601_PL: 2599 case EVAS_COLORSPACE_YCBCR420NV12601_PL:
2533 case EVAS_COLORSPACE_YCBCR420TM12601_PL: 2600 case EVAS_COLORSPACE_YCBCR420TM12601_PL:
2534 prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, !!mtex, 2601 prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, !!mtex,
2535 SHADER_NV12_NOMUL, SHADER_NV12, 2602 SHADER_NV12_NOMUL, SHADER_NV12,
2536 SHADER_NV12_NOMUL, SHADER_NV12)].prog; 2603 SHADER_NV12_MASK, SHADER_NV12_MASK)].prog;
2537 uvtexture = EINA_TRUE; 2604 uvtexture = EINA_TRUE;
2538 break; 2605 break;
2539 2606
2607 // FIXME: Add RGB+A support
2608
2540 default: 2609 default:
2541 if (tex_only) 2610 if (tex_only)
2542 { 2611 {
@@ -2653,6 +2722,7 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
2653 gc->pipe[pn].shader.cur_texu = tex->ptuv->texture; 2722 gc->pipe[pn].shader.cur_texu = tex->ptuv->texture;
2654 gc->pipe[pn].shader.cur_texu_dyn = tex->ptuv->dyn.img; 2723 gc->pipe[pn].shader.cur_texu_dyn = tex->ptuv->dyn.img;
2655 } 2724 }
2725 gc->pipe[pn].shader.cur_texa = mtex ? mtex->pt->texture : 0;
2656 gc->pipe[pn].shader.cur_prog = prog; 2726 gc->pipe[pn].shader.cur_prog = prog;
2657 gc->pipe[pn].shader.smooth = smooth; 2727 gc->pipe[pn].shader.smooth = smooth;
2658 gc->pipe[pn].shader.blend = blend; 2728 gc->pipe[pn].shader.blend = blend;
@@ -2668,13 +2738,13 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
2668 gc->pipe[pn].array.use_texuv = 1; 2738 gc->pipe[pn].array.use_texuv = 1;
2669 gc->pipe[pn].array.use_texuv2 = (utexture || uvtexture) ? 1 : 0; 2739 gc->pipe[pn].array.use_texuv2 = (utexture || uvtexture) ? 1 : 0;
2670 gc->pipe[pn].array.use_texuv3 = (utexture) ? 1 : 0; 2740 gc->pipe[pn].array.use_texuv3 = (utexture) ? 1 : 0;
2671 gc->pipe[pn].array.use_texa = 0; 2741 gc->pipe[pn].array.use_texa = !!mtex;
2672 gc->pipe[pn].array.use_texsam = 0; 2742 gc->pipe[pn].array.use_texsam = 0;
2673 2743
2674 pipe_region_expand(gc, pn, x, y, w, h); 2744 pipe_region_expand(gc, pn, x, y, w, h);
2675 2745
2676 pnum = gc->pipe[pn].array.num; 2746 pnum = gc->pipe[pn].array.num;
2677 nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nu2 = pnum * 2; 2747 nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nu2 = pnum * 2; na = pnum * 2;
2678 nu2 = pnum * 2; nu3 = pnum * 2; 2748 nu2 = pnum * 2; nu3 = pnum * 2;
2679 gc->pipe[pn].array.num += 6; 2749 gc->pipe[pn].array.num += 6;
2680 array_alloc(gc, pn); 2750 array_alloc(gc, pn);
@@ -2733,6 +2803,25 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
2733 B_VAL(&cl), 2803 B_VAL(&cl),
2734 A_VAL(&cl)); 2804 A_VAL(&cl));
2735 } 2805 }
2806
2807 if (mtex)
2808 {
2809 GLfloat t2x1, t2y1, t2x2, t2y2;
2810
2811 t2x1 = (mtex->x + mx) / (double)mtex->pt->w;
2812 t2y1 = (mtex->y + my) / (double)mtex->pt->h;
2813 t2x2 = (mtex->x + mx + mw) / (double)mtex->pt->w;
2814 t2y2 = (mtex->y + my + mh) / (double)mtex->pt->h;
2815
2816 PUSH_TEXA(pn, t2x1, t2y1);
2817 PUSH_TEXA(pn, t2x2, t2y1);
2818 PUSH_TEXA(pn, t2x1, t2y2);
2819
2820 PUSH_TEXA(pn, t2x2, t2y1);
2821 PUSH_TEXA(pn, t2x2, t2y2);
2822 PUSH_TEXA(pn, t2x1, t2y2);
2823 }
2824
2736 if (!flat) 2825 if (!flat)
2737 { 2826 {
2738 shader_array_flush(gc); 2827 shader_array_flush(gc);
diff --git a/src/modules/evas/engines/gl_common/shader/evas_gl_enum.x b/src/modules/evas/engines/gl_common/shader/evas_gl_enum.x
index 29f2e8a182..d1227ef9c6 100644
--- a/src/modules/evas/engines/gl_common/shader/evas_gl_enum.x
+++ b/src/modules/evas/engines/gl_common/shader/evas_gl_enum.x
@@ -49,5 +49,9 @@ typedef enum {
49 SHADER_IMG_MASK_NOMUL, 49 SHADER_IMG_MASK_NOMUL,
50 SHADER_IMG_MASK_BGRA, 50 SHADER_IMG_MASK_BGRA,
51 SHADER_IMG_MASK_BGRA_NOMUL, 51 SHADER_IMG_MASK_BGRA_NOMUL,
52 SHADER_YUV_MASK,
53 SHADER_NV12_MASK,
54 SHADER_YUY2_MASK,
55 SHADER_RGB_A_PAIR_MASK,
52 SHADER_LAST 56 SHADER_LAST
53} Evas_GL_Shader; 57} Evas_GL_Shader;
diff --git a/src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x b/src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x
index 690328a2c7..7f3f53630d 100644
--- a/src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x
+++ b/src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x
@@ -2423,6 +2423,239 @@ Evas_GL_Program_Source shader_img_mask_bgra_nomul_vert_src =
2423 NULL, 0 2423 NULL, 0
2424}; 2424};
2425 2425
2426/* Source: modules/evas/engines/gl_common/shader/yuv_mask_frag.shd */
2427static const char const yuv_mask_frag_glsl[] =
2428 "#ifdef GL_ES\n"
2429 "#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
2430 "precision highp float;\n"
2431 "#else\n"
2432 "precision mediump float;\n"
2433 "#endif\n"
2434 "#endif\n"
2435 "uniform sampler2D tex, texu, texv, texa;\n"
2436 "varying vec4 col;\n"
2437 "varying vec2 tex_c, tex_c2, tex_c3, tex_a;\n"
2438 "void main()\n"
2439 "{\n"
2440 " float r, g, b, y, u, v;\n"
2441 " y = texture2D(tex, tex_c.xy).r;\n"
2442 " u = texture2D(texu, tex_c2.xy).r;\n"
2443 " v = texture2D(texv, tex_c3.xy).r;\n"
2444 " y = (y - 0.0625) * 1.164;\n"
2445 " u = u - 0.5;\n"
2446 " v = v - 0.5;\n"
2447 " r = y + (1.402 * v);\n"
2448 " g = y - (0.34414 * u) - (0.71414 * v);\n"
2449 " b = y + (1.772 * u);\n"
2450 " gl_FragColor = vec4(r, g, b, 1.0) * texture2D(texa, tex_a.xy).a * col;\n"
2451 "}\n";
2452Evas_GL_Program_Source shader_yuv_mask_frag_src =
2453{
2454 yuv_mask_frag_glsl,
2455 NULL, 0
2456};
2457
2458/* Source: modules/evas/engines/gl_common/shader/yuv_mask_vert.shd */
2459static const char const yuv_mask_vert_glsl[] =
2460 "#ifdef GL_ES\n"
2461 "precision highp float;\n"
2462 "#endif\n"
2463 "attribute vec4 vertex;\n"
2464 "attribute vec4 color;\n"
2465 "attribute vec2 tex_coord, tex_coord2, tex_coord3, tex_coorda;\n"
2466 "uniform mat4 mvp;\n"
2467 "varying vec4 col;\n"
2468 "varying vec2 tex_c, tex_c2, tex_c3, tex_a;\n"
2469 "void main()\n"
2470 "{\n"
2471 " gl_Position = mvp * vertex;\n"
2472 " col = color;\n"
2473 " tex_c = tex_coord;\n"
2474 " tex_c2 = tex_coord2;\n"
2475 " tex_c3 = tex_coord3;\n"
2476 " tex_a = tex_coorda;\n"
2477 "}\n";
2478Evas_GL_Program_Source shader_yuv_mask_vert_src =
2479{
2480 yuv_mask_vert_glsl,
2481 NULL, 0
2482};
2483
2484/* Source: modules/evas/engines/gl_common/shader/nv12_mask_frag.shd */
2485static const char const nv12_mask_frag_glsl[] =
2486 "#ifdef GL_ES\n"
2487 "#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
2488 "precision highp float;\n"
2489 "#else\n"
2490 "precision mediump float;\n"
2491 "#endif\n"
2492 "#endif\n"
2493 "uniform sampler2D tex, texuv, texa;\n"
2494 "varying vec4 col;\n"
2495 "varying vec2 tex_c, tex_cuv, tex_a;\n"
2496 "void main()\n"
2497 "{\n"
2498 " float y,u,v,vmu,r,g,b;\n"
2499 " y=texture2D(tex,tex_c).g;\n"
2500 " u=texture2D(texuv,tex_cuv).g;\n"
2501 " v=texture2D(texuv,tex_cuv).a;\n"
2502 " u=u-0.5;\n"
2503 " v=v-0.5;\n"
2504 " vmu=v*0.813+u*0.391;\n"
2505 " u=u*2.018;\n"
2506 " v=v*1.596;\n"
2507 " y=(y-0.062)*1.164;\n"
2508 " r=y+v;\n"
2509 " g=y-vmu;\n"
2510 " b=y+u;\n"
2511 " gl_FragColor = vec4(r,g,b,1.0) * texture2D(texa, tex_a.xy).a * col;\n"
2512 "}\n";
2513Evas_GL_Program_Source shader_nv12_mask_frag_src =
2514{
2515 nv12_mask_frag_glsl,
2516 NULL, 0
2517};
2518
2519/* Source: modules/evas/engines/gl_common/shader/nv12_mask_vert.shd */
2520static const char const nv12_mask_vert_glsl[] =
2521 "#ifdef GL_ES\n"
2522 "precision highp float;\n"
2523 "#endif\n"
2524 "attribute vec4 vertex;\n"
2525 "attribute vec4 color;\n"
2526 "attribute vec2 tex_coord, tex_coord2, tex_coorda;\n"
2527 "uniform mat4 mvp;\n"
2528 "varying vec4 col;\n"
2529 "varying vec2 tex_c, tex_cuv, tex_a;\n"
2530 "void main()\n"
2531 "{\n"
2532 " gl_Position = mvp * vertex;\n"
2533 " col = color;\n"
2534 " tex_c = tex_coord;\n"
2535 " tex_cuv = tex_coord2 * 0.5;\n"
2536 " tex_a = tex_coorda;\n"
2537 "}\n";
2538Evas_GL_Program_Source shader_nv12_mask_vert_src =
2539{
2540 nv12_mask_vert_glsl,
2541 NULL, 0
2542};
2543
2544/* Source: modules/evas/engines/gl_common/shader/yuy2_mask_frag.shd */
2545static const char const yuy2_mask_frag_glsl[] =
2546 "#ifdef GL_ES\n"
2547 "#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
2548 "precision highp float;\n"
2549 "#else\n"
2550 "precision mediump float;\n"
2551 "#endif\n"
2552 "#endif\n"
2553 "uniform sampler2D tex, texuv, texa;\n"
2554 "varying vec4 col;\n"
2555 "varying vec2 tex_c, tex_cuv, tex_a;\n"
2556 "void main()\n"
2557 "{\n"
2558 " float y,u,v,vmu,r,g,b;\n"
2559 " y=texture2D(tex,tex_c).r;\n"
2560 " u=texture2D(texuv,tex_cuv).g;\n"
2561 " v=texture2D(texuv,tex_cuv).a;\n"
2562 " u=u-0.5;\n"
2563 " v=v-0.5;\n"
2564 " vmu=v*0.813+u*0.391;\n"
2565 " u=u*2.018;\n"
2566 " v=v*1.596;\n"
2567 " r=y+v;\n"
2568 " g=y-vmu;\n"
2569 " b=y+u;\n"
2570 " gl_FragColor = vec4(r,g,b,1.0) * texture2D(texa, tex_a.xy).a * col;\n"
2571 "}\n";
2572Evas_GL_Program_Source shader_yuy2_mask_frag_src =
2573{
2574 yuy2_mask_frag_glsl,
2575 NULL, 0
2576};
2577
2578/* Source: modules/evas/engines/gl_common/shader/yuy2_mask_vert.shd */
2579static const char const yuy2_mask_vert_glsl[] =
2580 "#ifdef GL_ES\n"
2581 "precision highp float;\n"
2582 "#endif\n"
2583 "attribute vec4 vertex;\n"
2584 "attribute vec4 color;\n"
2585 "attribute vec2 tex_coord, tex_coord2, tex_coorda;\n"
2586 "uniform mat4 mvp;\n"
2587 "varying vec4 col;\n"
2588 "varying vec2 tex_c, tex_cuv, tex_a;\n"
2589 "void main()\n"
2590 "{\n"
2591 " gl_Position = mvp * vertex;\n"
2592 " col = color;\n"
2593 " tex_c = tex_coord;\n"
2594 " tex_cuv = vec2(tex_coord2.x * 0.5, tex_coord2.y);\n"
2595 " tex_a = tex_coorda;\n"
2596 "}\n";
2597Evas_GL_Program_Source shader_yuy2_mask_vert_src =
2598{
2599 yuy2_mask_vert_glsl,
2600 NULL, 0
2601};
2602
2603/* Source: modules/evas/engines/gl_common/shader/rgb_a_pair_mask_frag.shd */
2604static const char const rgb_a_pair_mask_frag_glsl[] =
2605 "#ifdef GL_ES\n"
2606 "#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
2607 "precision highp float;\n"
2608 "#else\n"
2609 "precision mediump float;\n"
2610 "#endif\n"
2611 "#endif\n"
2612 "uniform sampler2D tex;\n"
2613 "uniform sampler2D texa;\n"
2614 "uniform sampler2D texm;\n"
2615 "varying vec4 col;\n"
2616 "varying vec2 coord_c;\n"
2617 "varying vec2 coord_a;\n"
2618 "varying vec2 coord_m;\n"
2619 "void main()\n"
2620 "{\n"
2621 " gl_FragColor.rgb = texture2D(tex, coord_c.xy).rgb * col.rgb * texture2D(texa, coord_a).g * texture2D(texm, coord_m.xy).a;\n"
2622 " gl_FragColor.a = col.a * texture2D(texa, coord_a).g * texture2D(texm, coord_m.xy).a;\n"
2623 "}\n";
2624Evas_GL_Program_Source shader_rgb_a_pair_mask_frag_src =
2625{
2626 rgb_a_pair_mask_frag_glsl,
2627 NULL, 0
2628};
2629
2630/* Source: modules/evas/engines/gl_common/shader/rgb_a_pair_mask_vert.shd */
2631static const char const rgb_a_pair_mask_vert_glsl[] =
2632 "#ifdef GL_ES\n"
2633 "precision highp float;\n"
2634 "#endif\n"
2635 "attribute vec4 vertex;\n"
2636 "attribute vec4 color;\n"
2637 "attribute vec2 tex_coord;\n"
2638 "attribute vec2 tex_coorda;\n"
2639 "attribute vec2 tex_coordm;\n"
2640 "uniform mat4 mvp;\n"
2641 "varying vec4 col;\n"
2642 "varying vec2 coord_c;\n"
2643 "varying vec2 coord_a;\n"
2644 "varying vec2 coord_m;\n"
2645 "void main()\n"
2646 "{\n"
2647 " gl_Position = mvp * vertex;\n"
2648 " col = color;\n"
2649 " coord_c = tex_coord;\n"
2650 " coord_a = tex_coorda;\n"
2651 " coord_m = tex_coordm;\n"
2652 "}\n";
2653Evas_GL_Program_Source shader_rgb_a_pair_mask_vert_src =
2654{
2655 rgb_a_pair_mask_vert_glsl,
2656 NULL, 0
2657};
2658
2426static const struct { 2659static const struct {
2427 Evas_GL_Shader id; 2660 Evas_GL_Shader id;
2428 Evas_GL_Program_Source *vert; 2661 Evas_GL_Program_Source *vert;
@@ -2476,5 +2709,9 @@ static const struct {
2476 { SHADER_IMG_MASK_NOMUL, &(shader_img_mask_nomul_vert_src), &(shader_img_mask_nomul_frag_src), "img_mask_nomul" }, 2709 { SHADER_IMG_MASK_NOMUL, &(shader_img_mask_nomul_vert_src), &(shader_img_mask_nomul_frag_src), "img_mask_nomul" },
2477 { SHADER_IMG_MASK_BGRA, &(shader_img_mask_bgra_vert_src), &(shader_img_mask_bgra_frag_src), "img_mask_bgra" }, 2710 { SHADER_IMG_MASK_BGRA, &(shader_img_mask_bgra_vert_src), &(shader_img_mask_bgra_frag_src), "img_mask_bgra" },
2478 { SHADER_IMG_MASK_BGRA_NOMUL, &(shader_img_mask_bgra_nomul_vert_src), &(shader_img_mask_bgra_nomul_frag_src), "img_mask_bgra_nomul" }, 2711 { SHADER_IMG_MASK_BGRA_NOMUL, &(shader_img_mask_bgra_nomul_vert_src), &(shader_img_mask_bgra_nomul_frag_src), "img_mask_bgra_nomul" },
2712 { SHADER_YUV_MASK, &(shader_yuv_mask_vert_src), &(shader_yuv_mask_frag_src), "yuv_mask" },
2713 { SHADER_NV12_MASK, &(shader_nv12_mask_vert_src), &(shader_nv12_mask_frag_src), "nv12_mask" },
2714 { SHADER_YUY2_MASK, &(shader_yuy2_mask_vert_src), &(shader_yuy2_mask_frag_src), "yuy2_mask" },
2715 { SHADER_RGB_A_PAIR_MASK, &(shader_rgb_a_pair_mask_vert_src), &(shader_rgb_a_pair_mask_frag_src), "rgb_a_pair_mask" },
2479}; 2716};
2480 2717
diff --git a/src/modules/evas/engines/gl_common/shader/nv12_mask_frag.shd b/src/modules/evas/engines/gl_common/shader/nv12_mask_frag.shd
new file mode 100644
index 0000000000..f78416e355
--- /dev/null
+++ b/src/modules/evas/engines/gl_common/shader/nv12_mask_frag.shd
@@ -0,0 +1,31 @@
1#ifdef GL_ES
2#ifdef GL_FRAGMENT_PRECISION_HIGH
3precision highp float;
4#else
5precision mediump float;
6#endif
7#endif
8uniform sampler2D tex, texuv, texa;
9varying vec4 col;
10varying vec2 tex_c, tex_cuv, tex_a;
11void main()
12{
13 float y,u,v,vmu,r,g,b;
14 y=texture2D(tex,tex_c).g;
15 u=texture2D(texuv,tex_cuv).g;
16 v=texture2D(texuv,tex_cuv).a;
17
18 u=u-0.5;
19 v=v-0.5;
20 vmu=v*0.813+u*0.391;
21 u=u*2.018;
22 v=v*1.596;
23 y=(y-0.062)*1.164;
24
25 r=y+v;
26 g=y-vmu;
27 b=y+u;
28
29 gl_FragColor = vec4(r,g,b,1.0) * texture2D(texa, tex_a.xy).a * col;
30}
31
diff --git a/src/modules/evas/engines/gl_common/shader/nv12_mask_vert.shd b/src/modules/evas/engines/gl_common/shader/nv12_mask_vert.shd
new file mode 100644
index 0000000000..bce12af84c
--- /dev/null
+++ b/src/modules/evas/engines/gl_common/shader/nv12_mask_vert.shd
@@ -0,0 +1,17 @@
1#ifdef GL_ES
2precision highp float;
3#endif
4attribute vec4 vertex;
5attribute vec4 color;
6attribute vec2 tex_coord, tex_coord2, tex_coorda;
7uniform mat4 mvp;
8varying vec4 col;
9varying vec2 tex_c, tex_cuv, tex_a;
10void main()
11{
12 gl_Position = mvp * vertex;
13 col = color;
14 tex_c = tex_coord;
15 tex_cuv = tex_coord2 * 0.5;
16 tex_a = tex_coorda;
17}
diff --git a/src/modules/evas/engines/gl_common/shader/rgb_a_pair_mask_frag.shd b/src/modules/evas/engines/gl_common/shader/rgb_a_pair_mask_frag.shd
new file mode 100644
index 0000000000..2c2ddef015
--- /dev/null
+++ b/src/modules/evas/engines/gl_common/shader/rgb_a_pair_mask_frag.shd
@@ -0,0 +1,19 @@
1#ifdef GL_ES
2#ifdef GL_FRAGMENT_PRECISION_HIGH
3precision highp float;
4#else
5precision mediump float;
6#endif
7#endif
8uniform sampler2D tex;
9uniform sampler2D texa;
10uniform sampler2D texm;
11varying vec4 col;
12varying vec2 coord_c;
13varying vec2 coord_a;
14varying vec2 coord_m;
15void main()
16{
17 gl_FragColor.rgb = texture2D(tex, coord_c.xy).rgb * col.rgb * texture2D(texa, coord_a).g * texture2D(texm, coord_m.xy).a;
18 gl_FragColor.a = col.a * texture2D(texa, coord_a).g * texture2D(texm, coord_m.xy).a;
19}
diff --git a/src/modules/evas/engines/gl_common/shader/rgb_a_pair_mask_vert.shd b/src/modules/evas/engines/gl_common/shader/rgb_a_pair_mask_vert.shd
new file mode 100644
index 0000000000..03f7055260
--- /dev/null
+++ b/src/modules/evas/engines/gl_common/shader/rgb_a_pair_mask_vert.shd
@@ -0,0 +1,21 @@
1#ifdef GL_ES
2precision highp float;
3#endif
4attribute vec4 vertex;
5attribute vec4 color;
6attribute vec2 tex_coord;
7attribute vec2 tex_coorda;
8attribute vec2 tex_coordm;
9uniform mat4 mvp;
10varying vec4 col;
11varying vec2 coord_c;
12varying vec2 coord_a;
13varying vec2 coord_m;
14void main()
15{
16 gl_Position = mvp * vertex;
17 col = color;
18 coord_c = tex_coord;
19 coord_a = tex_coorda;
20 coord_m = tex_coordm;
21}
diff --git a/src/modules/evas/engines/gl_common/shader/yuv_mask_frag.shd b/src/modules/evas/engines/gl_common/shader/yuv_mask_frag.shd
new file mode 100644
index 0000000000..e9e32f5c7f
--- /dev/null
+++ b/src/modules/evas/engines/gl_common/shader/yuv_mask_frag.shd
@@ -0,0 +1,25 @@
1#ifdef GL_ES
2#ifdef GL_FRAGMENT_PRECISION_HIGH
3precision highp float;
4#else
5precision mediump float;
6#endif
7#endif
8uniform sampler2D tex, texu, texv, texa;
9varying vec4 col;
10varying vec2 tex_c, tex_c2, tex_c3, tex_a;
11void main()
12{
13 float r, g, b, y, u, v;
14 y = texture2D(tex, tex_c.xy).r;
15 u = texture2D(texu, tex_c2.xy).r;
16 v = texture2D(texv, tex_c3.xy).r;
17 y = (y - 0.0625) * 1.164;
18 u = u - 0.5;
19 v = v - 0.5;
20 r = y + (1.402 * v);
21 g = y - (0.34414 * u) - (0.71414 * v);
22 b = y + (1.772 * u);
23 gl_FragColor = vec4(r, g, b, 1.0) * texture2D(texa, tex_a.xy).a * col;
24}
25
diff --git a/src/modules/evas/engines/gl_common/shader/yuv_mask_vert.shd b/src/modules/evas/engines/gl_common/shader/yuv_mask_vert.shd
new file mode 100644
index 0000000000..b398515683
--- /dev/null
+++ b/src/modules/evas/engines/gl_common/shader/yuv_mask_vert.shd
@@ -0,0 +1,18 @@
1#ifdef GL_ES
2precision highp float;
3#endif
4attribute vec4 vertex;
5attribute vec4 color;
6attribute vec2 tex_coord, tex_coord2, tex_coord3, tex_coorda;
7uniform mat4 mvp;
8varying vec4 col;
9varying vec2 tex_c, tex_c2, tex_c3, tex_a;
10void main()
11{
12 gl_Position = mvp * vertex;
13 col = color;
14 tex_c = tex_coord;
15 tex_c2 = tex_coord2;
16 tex_c3 = tex_coord3;
17 tex_a = tex_coorda;
18}
diff --git a/src/modules/evas/engines/gl_common/shader/yuy2_mask_frag.shd b/src/modules/evas/engines/gl_common/shader/yuy2_mask_frag.shd
new file mode 100644
index 0000000000..1b295b7e0b
--- /dev/null
+++ b/src/modules/evas/engines/gl_common/shader/yuy2_mask_frag.shd
@@ -0,0 +1,30 @@
1#ifdef GL_ES
2#ifdef GL_FRAGMENT_PRECISION_HIGH
3precision highp float;
4#else
5precision mediump float;
6#endif
7#endif
8uniform sampler2D tex, texuv, texa;
9varying vec4 col;
10varying vec2 tex_c, tex_cuv, tex_a;
11void main()
12{
13 float y,u,v,vmu,r,g,b;
14 y=texture2D(tex,tex_c).r;
15 u=texture2D(texuv,tex_cuv).g;
16 v=texture2D(texuv,tex_cuv).a;
17
18 u=u-0.5;
19 v=v-0.5;
20 vmu=v*0.813+u*0.391;
21 u=u*2.018;
22 v=v*1.596;
23
24 r=y+v;
25 g=y-vmu;
26 b=y+u;
27
28 gl_FragColor = vec4(r,g,b,1.0) * texture2D(texa, tex_a.xy).a * col;
29}
30
diff --git a/src/modules/evas/engines/gl_common/shader/yuy2_mask_vert.shd b/src/modules/evas/engines/gl_common/shader/yuy2_mask_vert.shd
new file mode 100644
index 0000000000..7cafa143bd
--- /dev/null
+++ b/src/modules/evas/engines/gl_common/shader/yuy2_mask_vert.shd
@@ -0,0 +1,17 @@
1#ifdef GL_ES
2precision highp float;
3#endif
4attribute vec4 vertex;
5attribute vec4 color;
6attribute vec2 tex_coord, tex_coord2, tex_coorda;
7uniform mat4 mvp;
8varying vec4 col;
9varying vec2 tex_c, tex_cuv, tex_a;
10void main()
11{
12 gl_Position = mvp * vertex;
13 col = color;
14 tex_c = tex_coord;
15 tex_cuv = vec2(tex_coord2.x * 0.5, tex_coord2.y);
16 tex_a = tex_coorda;
17}