#define SHAD_TEXUV3 4
#define SHAD_TEXA 5
#define SHAD_TEXSAM 6
-#define SHAD_TEXM 7
+#define SHAD_MASK 7
typedef struct _Evas_GL_Program Evas_GL_Program;
typedef struct _Evas_GL_Program_Source Evas_GL_Program_Source;
GLfloat *texuv3;
GLfloat *texa;
GLfloat *texsam;
- GLfloat *texm;
+ GLfloat *mask;
Eina_Bool line: 1;
Eina_Bool use_vertex : 1;
Eina_Bool use_color : 1;
Eina_Bool use_texuv3 : 1;
Eina_Bool use_texa : 1;
Eina_Bool use_texsam : 1;
- Eina_Bool use_texm : 1;
+ Eina_Bool use_mask : 1;
Eina_Bool anti_alias : 1;
Evas_GL_Image *im;
GLuint buffer;
void evas_gl_common_context_rectangle_push(Evas_Engine_GL_Context *gc,
int x, int y, int w, int h,
int r, int g, int b, int a,
- Evas_GL_Texture *mtex, double mx, double my, double mw, double mh, Eina_Bool mask_smooth);
+ Evas_GL_Texture *mtex, int mx, int my, int mw, int mh, Eina_Bool mask_smooth);
void evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc,
Evas_GL_Texture *tex,
double sx, double sy, double sw, double sh,
int x, int y, int w, int h,
- Evas_GL_Texture *mtex, double mx, double my, double mw, double mh, Eina_Bool mask_smooth,
+ Evas_GL_Texture *mtex, int mx, int my, int mw, int mh, Eina_Bool mask_smooth,
int r, int g, int b, int a,
Eina_Bool smooth, Eina_Bool tex_only);
void evas_gl_common_context_font_push(Evas_Engine_GL_Context *gc,
Evas_GL_Texture *tex,
double sx, double sy, double sw, double sh,
int x, int y, int w, int h,
- Evas_GL_Texture *mtex, double mx, double my, double mw, double mh, Eina_Bool mask_smooth,
+ Evas_GL_Texture *mtex, int mx, int my, int mw, int mh, Eina_Bool mask_smooth,
int r, int g, int b, int a);
void evas_gl_common_context_yuv_push(Evas_Engine_GL_Context *gc,
Evas_GL_Texture *tex,
double sx, double sy, double sw, double sh,
int x, int y, int w, int h,
- Evas_GL_Texture *mtex, double mx, double my, double mw, double mh, Eina_Bool mask_smooth,
+ Evas_GL_Texture *mtex, int mx, int my, int mw, int mh, Eina_Bool mask_smooth,
int r, int g, int b, int a,
Eina_Bool smooth);
void evas_gl_common_context_yuy2_push(Evas_Engine_GL_Context *gc,
Evas_GL_Texture *tex,
double sx, double sy, double sw, double sh,
int x, int y, int w, int h,
- Evas_GL_Texture *mtex, double mx, double my, double mw, double mh, Eina_Bool mask_smooth,
+ Evas_GL_Texture *mtex, int mx, int my, int mw, int mh, Eina_Bool mask_smooth,
int r, int g, int b, int a,
Eina_Bool smooth);
void evas_gl_common_context_nv12_push(Evas_Engine_GL_Context *gc,
Evas_GL_Texture *tex,
double sx, double sy, double sw, double sh,
int x, int y, int w, int h,
- Evas_GL_Texture *mtex, double mx, double my, double mw, double mh, Eina_Bool mask_smooth,
+ Evas_GL_Texture *mtex, int mx, int my, int mw, int mh, Eina_Bool mask_smooth,
int r, int g, int b, int a,
Eina_Bool smooth);
void evas_gl_common_context_rgb_a_pair_push(Evas_Engine_GL_Context *gc,
Evas_GL_Texture *tex,
double sx, double sy, double sw, double sh,
int x, int y, int w, int h,
- Evas_GL_Texture *mtex, double mx, double my, double mw, double mh, Eina_Bool mask_smooth,
+ Evas_GL_Texture *mtex, int mx, int my, int mw, int mh, Eina_Bool mask_smooth,
int r, int g, int b, int a,
Eina_Bool smooth);
void evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
if (gc->pipe[i].array.texuv2) free(gc->pipe[i].array.texuv2);
if (gc->pipe[i].array.texuv3) free(gc->pipe[i].array.texuv3);
if (gc->pipe[i].array.texsam) free(gc->pipe[i].array.texsam);
- if (gc->pipe[i].array.texm) free(gc->pipe[i].array.texm);
+ if (gc->pipe[i].array.mask) free(gc->pipe[i].array.mask);
}
}
_evas_gl_common_viewport_set(gc);
}
+#define VERTEX_CNT 3
+#define COLOR_CNT 4
+#define TEX_CNT 2
+#define MASK_CNT 4
+
#define PUSH_VERTEX(n, x, y, z) do { \
gc->pipe[n].array.vertex[nv++] = x; \
gc->pipe[n].array.vertex[nv++] = y; \
#define PUSH_TEXA(n, u, v) do { \
gc->pipe[n].array.texa[na++] = u; \
gc->pipe[n].array.texa[na++] = v; } while(0)
-#define PUSH_TEXM(n, u, v) do { \
- gc->pipe[n].array.texm[nm++] = u; \
- gc->pipe[n].array.texm[nm++] = v; } while(0)
+#define PUSH_TEXM(n, u, v, w, z) do { \
+ gc->pipe[n].array.mask[nm++] = u; \
+ gc->pipe[n].array.mask[nm++] = v; \
+ gc->pipe[n].array.mask[nm++] = w; \
+ gc->pipe[n].array.mask[nm++] = z; } while(0)
#define PUSH_TEXSAM(n, x, y) do { \
gc->pipe[n].array.texsam[ns++] = x; \
gc->pipe[n].array.texsam[ns++] = y; } while(0)
#define PUSH_6_COLORS(pn, r, g, b, a) \
do { int i; for (i = 0; i < 6; i++) PUSH_COLOR(pn, r, g, b, a); } while(0)
+static inline Eina_Bool
+_push_mask(Evas_Engine_GL_Context *gc, int pn, int nm, Evas_GL_Texture *mtex,
+ int mx, int my, int mw, int mh)
+{
+ double glmx, glmy, glmw, glmh, yinv = -1.f;
+ double gw = gc->w, gh = gc->h;
+
+ if (!((gc->pipe[0].shader.surface == gc->def_surface) ||
+ (!gc->pipe[0].shader.surface)))
+ {
+ gw = gc->pipe[0].shader.surface->w;
+ gh = gc->pipe[0].shader.surface->h;
+ yinv = 1.f;
+ }
+
+ if (!gw || !gh || !mw || !mh || !mtex->pt->w || !mtex->pt->h)
+ return EINA_FALSE;
+
+ /* vertex shader:
+ * vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);
+ * tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;
+ */
+ glmx = (double)((mtex->x * mw) - (mtex->w * mx)) / (double)(mw * mtex->pt->w);
+ glmy = (double)((mtex->y * mh) - (mtex->h * my)) / (double)(mh * mtex->pt->h);
+ glmw = (double)(gw * mtex->w) / (double)(mw * mtex->pt->w);
+ glmh = (double)(gh * mtex->h) / (double)(mh * mtex->pt->h);
+ glmh *= yinv;
+ PUSH_TEXM(pn, glmx, glmy, glmw, glmh);
+ PUSH_TEXM(pn, glmx, glmy, glmw, glmh);
+ PUSH_TEXM(pn, glmx, glmy, glmw, glmh);
+ PUSH_TEXM(pn, glmx, glmy, glmw, glmh);
+ PUSH_TEXM(pn, glmx, glmy, glmw, glmh);
+ PUSH_TEXM(pn, glmx, glmy, glmw, glmh);
+
+ DBG("%d,%d %dx%d --> %f , %f - %f x %f [gc %dx%d, tex %d,%d %dx%d, pt %dx%d]",
+ mx, my, mw, mh,
+ glmx, glmy, glmw, glmh,
+ gc->w, gc->h, mtex->x, mtex->y, mtex->w, mtex->h, mtex->pt->w, mtex->pt->h);
+
+ return EINA_TRUE;
+}
+
#define PUSH_MASK(pn, mtex, mx, my, mw, mh) if (mtex) do { \
- GLfloat tmx1, tmx2, tmy1, tmy2; \
- tmx1 = mx; \
- tmy1 = my; \
- tmx2 = mx + mw; \
- tmy2 = my + mh; \
- PUSH_TEXM(pn, tmx1, tmy1); \
- PUSH_TEXM(pn, tmx2, tmy1); \
- PUSH_TEXM(pn, tmx1, tmy2); \
- PUSH_TEXM(pn, tmx2, tmy1); \
- PUSH_TEXM(pn, tmx2, tmy2); \
- PUSH_TEXM(pn, tmx1, tmy2); \
- } while(0)
+ _push_mask(gc, pn, nm, mtex, mx, my, mw, mh); \
+ } while(0)
#define PIPE_GROW(gc, pn, inc) \
- int nv = gc->pipe[pn].array.num * 3; (void) nv; \
- int nc = gc->pipe[pn].array.num * 4; (void) nc; \
- int nu = gc->pipe[pn].array.num * 2; (void) nu; \
- int nu2 = gc->pipe[pn].array.num * 2; (void) nu2; \
- int nu3 = gc->pipe[pn].array.num * 2; (void) nu3; \
- int na = gc->pipe[pn].array.num * 2; (void) na; \
- int ns = gc->pipe[pn].array.num * 2; (void) ns; \
- int nm = gc->pipe[pn].array.num * 2; (void) nm; \
+ int nv = gc->pipe[pn].array.num * VERTEX_CNT; (void) nv; \
+ int nc = gc->pipe[pn].array.num * COLOR_CNT; (void) nc; \
+ int nu = gc->pipe[pn].array.num * TEX_CNT; (void) nu; \
+ int nu2 = gc->pipe[pn].array.num * TEX_CNT; (void) nu2; \
+ int nu3 = gc->pipe[pn].array.num * TEX_CNT; (void) nu3; \
+ int na = gc->pipe[pn].array.num * TEX_CNT; (void) na; \
+ int ns = gc->pipe[pn].array.num * TEX_CNT; (void) ns; \
+ int nm = gc->pipe[pn].array.num * MASK_CNT; (void) nm; \
gc->pipe[pn].array.num += inc; \
array_alloc(gc, pn);
if ((gc->pipe[n].array.use_##field) && (!gc->pipe[n].array.field)) \
gc->pipe[n].array.field = \
malloc(gc->pipe[n].array.alloc * sizeof(type) * size)
- ALOC(vertex, GLshort, 3);
- ALOC(color, GLubyte, 4);
- ALOC(texuv, GLfloat, 2);
- ALOC(texa, GLfloat, 2);
- ALOC(texuv2, GLfloat, 2);
- ALOC(texuv3, GLfloat, 2);
- ALOC(texsam, GLfloat, 2);
- ALOC(texm, GLfloat, 2);
+ ALOC(vertex, GLshort, VERTEX_CNT);
+ ALOC(color, GLubyte, COLOR_CNT);
+ ALOC(texuv, GLfloat, TEX_CNT);
+ ALOC(texa, GLfloat, TEX_CNT);
+ ALOC(texuv2, GLfloat, TEX_CNT);
+ ALOC(texuv3, GLfloat, TEX_CNT);
+ ALOC(texsam, GLfloat, TEX_CNT);
+ ALOC(mask, GLfloat, MASK_CNT);
return;
}
gc->pipe[n].array.alloc += 6 * 1024;
gc->pipe[n].array.field = realloc \
(gc->pipe[n].array.field, \
gc->pipe[n].array.alloc * sizeof(type) * size)
- RALOC(vertex, GLshort, 3);
- RALOC(color, GLubyte, 4);
- RALOC(texuv, GLfloat, 2);
- RALOC(texa, GLfloat, 2);
- RALOC(texuv2, GLfloat, 2);
- RALOC(texuv3, GLfloat, 2);
- RALOC(texsam, GLfloat, 2);
- RALOC(texm, GLfloat, 2);
+ RALOC(vertex, GLshort, VERTEX_CNT);
+ RALOC(color, GLubyte, COLOR_CNT);
+ RALOC(texuv, GLfloat, TEX_CNT);
+ RALOC(texa, GLfloat, TEX_CNT);
+ RALOC(texuv2, GLfloat, TEX_CNT);
+ RALOC(texuv3, GLfloat, TEX_CNT);
+ RALOC(texsam, GLfloat, TEX_CNT);
+ RALOC(mask, GLfloat, MASK_CNT);
}
#ifdef GLPIPES
gc->pipe[pn].array.use_texuv3 = 0;
gc->pipe[pn].array.use_texa = 0;
gc->pipe[pn].array.use_texsam = 0;
- gc->pipe[pn].array.use_texm = 0;
+ gc->pipe[pn].array.use_mask = 0;
PIPE_GROW(gc, pn, 2);
PUSH_VERTEX(pn, x1, y1, 0);
gc->pipe[pn].array.use_texuv3 = 0;
gc->pipe[pn].array.use_texa = 0;
gc->pipe[pn].array.use_texsam = 0;
- gc->pipe[pn].array.use_texm = 0;
+ gc->pipe[pn].array.use_mask = 0;
}
void
int x, int y, int w, int h,
int r, int g, int b, int a,
Evas_GL_Texture *mtex,
- double mx, double my, double mw, double mh,
+ int mx, int my, int mw, int mh,
Eina_Bool mask_smooth)
{
Eina_Bool blend = EINA_FALSE;
gc->pipe[pn].array.use_texuv3 = 0;
gc->pipe[pn].array.use_texa = 0;
gc->pipe[pn].array.use_texsam = 0;
- gc->pipe[pn].array.use_texm = !!mtex;
+ gc->pipe[pn].array.use_mask = !!mtex;
}
else
{
gc->pipe[pn].array.use_texuv3 = 0;
gc->pipe[pn].array.use_texa = 0;
gc->pipe[pn].array.use_texsam = 0;
- gc->pipe[pn].array.use_texm = !!mtex;
+ gc->pipe[pn].array.use_mask = !!mtex;
}
}
#else
Evas_GL_Texture *tex,
double sx, double sy, double sw, double sh,
int x, int y, int w, int h,
- Evas_GL_Texture *mtex, double mx, double my, double mw, double mh, Eina_Bool mask_smooth,
+ Evas_GL_Texture *mtex, int mx, int my, int mw, int mh, Eina_Bool mask_smooth,
int r, int g, int b, int a,
Eina_Bool smooth, Eina_Bool tex_only)
{
gc->pipe[pn].array.use_texuv = 1;
gc->pipe[pn].array.use_texuv2 = 0;
gc->pipe[pn].array.use_texuv3 = 0;
- gc->pipe[pn].array.use_texm = !!mtex;
+ gc->pipe[pn].array.use_mask = !!mtex;
gc->pipe[pn].array.use_texsam = sam;
pipe_region_expand(gc, pn, x, y, w, h);
Evas_GL_Texture *tex,
double sx, double sy, double sw, double sh,
int x, int y, int w, int h,
- Evas_GL_Texture *mtex, double mx, double my, double mw, double mh, Eina_Bool mask_smooth,
+ Evas_GL_Texture *mtex, int mx, int my, int mw, int mh, Eina_Bool mask_smooth,
int r, int g, int b, int a)
{
GLfloat tx1, tx2, ty1, ty2;
gc->pipe[pn].array.use_texuv = 1;
gc->pipe[pn].array.use_texuv2 = 0;
gc->pipe[pn].array.use_texuv3 = 0;
- gc->pipe[pn].array.use_texm = !!mtex;
+ gc->pipe[pn].array.use_mask = !!mtex;
gc->pipe[pn].array.use_texsam = 0;
pipe_region_expand(gc, pn, x, y, w, h);
Evas_GL_Texture *tex,
double sx, double sy, double sw, double sh,
int x, int y, int w, int h,
- Evas_GL_Texture *mtex, double mx, double my, double mw, double mh, Eina_Bool mask_smooth,
+ Evas_GL_Texture *mtex, int mx, int my, int mw, int mh, Eina_Bool mask_smooth,
int r, int g, int b, int a,
Eina_Bool smooth)
{
gc->pipe[pn].array.use_texuv = 1;
gc->pipe[pn].array.use_texuv2 = 1;
gc->pipe[pn].array.use_texuv3 = 1;
- gc->pipe[pn].array.use_texm = !!mtex;
+ gc->pipe[pn].array.use_mask = !!mtex;
gc->pipe[pn].array.use_texsam = 0;
pipe_region_expand(gc, pn, x, y, w, h);
Evas_GL_Texture *tex,
double sx, double sy, double sw, double sh,
int x, int y, int w, int h,
- Evas_GL_Texture *mtex, double mx, double my, double mw, double mh, Eina_Bool mask_smooth,
+ Evas_GL_Texture *mtex, int mx, int my, int mw, int mh, Eina_Bool mask_smooth,
int r, int g, int b, int a,
Eina_Bool smooth)
{
gc->pipe[pn].array.use_texuv = 1;
gc->pipe[pn].array.use_texuv2 = 1;
gc->pipe[pn].array.use_texuv3 = 0;
- gc->pipe[pn].array.use_texm = !!mtex;
+ gc->pipe[pn].array.use_mask = !!mtex;
gc->pipe[pn].array.use_texsam = 0;
pipe_region_expand(gc, pn, x, y, w, h);
Evas_GL_Texture *tex,
double sx, double sy, double sw, double sh,
int x, int y, int w, int h,
- Evas_GL_Texture *mtex, double mx, double my, double mw, double mh, Eina_Bool mask_smooth,
+ Evas_GL_Texture *mtex, int mx, int my, int mw, int mh, Eina_Bool mask_smooth,
int r, int g, int b, int a,
Eina_Bool smooth)
{
gc->pipe[pn].array.use_texuv = 1;
gc->pipe[pn].array.use_texuv2 = 1;
gc->pipe[pn].array.use_texuv3 = 0;
- gc->pipe[pn].array.use_texm = !!mtex;
+ gc->pipe[pn].array.use_mask = !!mtex;
gc->pipe[pn].array.use_texsam = 0;
pipe_region_expand(gc, pn, x, y, w, h);
double sx, double sy,
double sw, double sh,
int x, int y, int w, int h,
- Evas_GL_Texture *mtex, double mx, double my, double mw, double mh, Eina_Bool mask_smooth,
+ Evas_GL_Texture *mtex, int mx, int my, int mw, int mh, Eina_Bool mask_smooth,
int r, int g, int b, int a,
Eina_Bool smooth)
gc->pipe[pn].array.use_texuv3 = 0;
gc->pipe[pn].array.use_texa = EINA_TRUE;
gc->pipe[pn].array.use_texsam = 0;
- gc->pipe[pn].array.use_texm = !!mtex;
+ gc->pipe[pn].array.use_mask = !!mtex;
pipe_region_expand(gc, pn, x, y, w, h);
PIPE_GROW(gc, pn, 6);
gc->pipe[pn].array.use_texuv = 1;
gc->pipe[pn].array.use_texuv2 = (utexture || uvtexture) ? 1 : 0;
gc->pipe[pn].array.use_texuv3 = (utexture) ? 1 : 0;
- gc->pipe[pn].array.use_texm = !!mtex;
- gc->pipe[pn].array.use_texa = !!mtex;
- gc->pipe[pn].array.use_texsam = gc->pipe[pn].array.use_texm;
+ gc->pipe[pn].array.use_mask = !!mtex;
+ gc->pipe[pn].array.use_texa = 0;
+ gc->pipe[pn].array.use_texsam = 0;
pipe_region_expand(gc, pn, x, y, w, h);
PIPE_GROW(gc, pn, 6);
A_VAL(&cl));
}
- if (mtex)
- {
- double glmx, glmy, glmw, glmh, yinv = -1.f;
- double gw = gc->w, gh = gc->h;
+ PUSH_MASK(pn, mtex, mx, my, mw, mh);
- if (!((gc->pipe[0].shader.surface == gc->def_surface) ||
- (!gc->pipe[0].shader.surface)))
- {
- gw = gc->pipe[0].shader.surface->w;
- gh = gc->pipe[0].shader.surface->h;
- yinv = 1.f;
- }
- if (!gw || !gh || !mw || !mh || !mtex->pt->w || !mtex->pt->h)
- goto mask_error;
-
- // vertex shader: tex_m = (X,Y) * tex_coordm + tex_sample
- // tex_coordm
- glmx = (double)((mtex->x * mw) - (mtex->w * mx)) / (double)(mw * mtex->pt->w);
- glmy = (double)((mtex->y * mh) - (mtex->h * my)) / (double)(mh * mtex->pt->h);
- PUSH_TEXM(pn, glmx, glmy);
- PUSH_TEXM(pn, glmx, glmy);
- PUSH_TEXM(pn, glmx, glmy);
- PUSH_TEXM(pn, glmx, glmy);
- PUSH_TEXM(pn, glmx, glmy);
- PUSH_TEXM(pn, glmx, glmy);
-
- // tex_sample
- glmw = (double)(gw * mtex->w) / (double)(mw * mtex->pt->w);
- glmh = (double)(gh * mtex->h) / (double)(mh * mtex->pt->h);
- PUSH_TEXSAM(pn, glmw, glmh);
- PUSH_TEXSAM(pn, glmw, glmh);
- PUSH_TEXSAM(pn, glmw, glmh);
- PUSH_TEXSAM(pn, glmw, glmh);
- PUSH_TEXSAM(pn, glmw, glmh);
- PUSH_TEXSAM(pn, glmw, glmh);
-
- // tex_coorda: Y-invert flag
- PUSH_TEXA(pn, 1.0, yinv);
- PUSH_TEXA(pn, 1.0, yinv);
- PUSH_TEXA(pn, 1.0, yinv);
- PUSH_TEXA(pn, 1.0, yinv);
- PUSH_TEXA(pn, 1.0, yinv);
- PUSH_TEXA(pn, 1.0, yinv);
-
- /*
- DBG("Map mask: %d,%d %dx%d --> %f , %f - %f x %f @ %f %f [gc %dx%d, tex %d,%d %dx%d, pt %dx%d]",
- mx, my, mw, mh,
- glmx, glmy, glmw, glmh, 1.0, yinv,
- gc->w, gc->h, mtex->x, mtex->y, mtex->w, mtex->h, mtex->pt->w, mtex->pt->h);
- */
- }
-
-mask_error:
if (!flat)
{
shader_array_flush(gc);
unsigned char *texuv3_ptr = NULL;
unsigned char *texa_ptr = NULL;
unsigned char *texsam_ptr = NULL;
- unsigned char *texm_ptr = NULL;
+ unsigned char *mask_ptr = NULL;
if (glsym_glMapBuffer && glsym_glUnmapBuffer)
{
unsigned char *x;
-# define VERTEX_SIZE (gc->pipe[i].array.num * sizeof(GLshort) * 3)
-# define COLOR_SIZE (gc->pipe[i].array.num * sizeof(GLubyte) * 4)
-# define TEX_SIZE (gc->pipe[i].array.num * sizeof(GLfloat) * 2)
+# define VERTEX_SIZE (gc->pipe[i].array.num * sizeof(GLshort) * VERTEX_CNT)
+# define COLOR_SIZE (gc->pipe[i].array.num * sizeof(GLubyte) * COLOR_CNT)
+# define TEX_SIZE (gc->pipe[i].array.num * sizeof(GLfloat) * TEX_CNT)
+# define MASK_SIZE (gc->pipe[i].array.num * sizeof(GLubyte) * MASK_CNT)
vertex_ptr = NULL;
color_ptr = vertex_ptr + VERTEX_SIZE;
texuv_ptr = color_ptr + COLOR_SIZE;
texuv3_ptr = texuv2_ptr + TEX_SIZE;
texa_ptr = texuv3_ptr + TEX_SIZE;
texsam_ptr = texa_ptr + TEX_SIZE;
- texm_ptr = texsam_ptr + TEX_SIZE;
-# define END_POINTER (texm_ptr + TEX_SIZE)
+ mask_ptr = texsam_ptr + TEX_SIZE;
+# define END_POINTER (mask_ptr + TEX_SIZE)
glBindBuffer(GL_ARRAY_BUFFER, gc->pipe[i].array.buffer);
if ((gc->pipe[i].array.buffer_alloc < (long)END_POINTER) ||
memcpy(x + (unsigned long)texa_ptr, gc->pipe[i].array.texa, TEX_SIZE);
if (gc->pipe[i].array.use_texsam)
memcpy(x + (unsigned long)texsam_ptr, gc->pipe[i].array.texsam, TEX_SIZE);
- if (gc->pipe[i].array.use_texm)
- memcpy(x + (unsigned long)texm_ptr, gc->pipe[i].array.texm, TEX_SIZE);
+ if (gc->pipe[i].array.use_mask)
+ memcpy(x + (unsigned long)mask_ptr, gc->pipe[i].array.mask, MASK_SIZE);
/*
fprintf(stderr, "copy %i bytes [%i/%i slots] [%i + %i + %i + %i + %i + %i + %i] <%i %i %i %i %i %i %i>\n",
(int)((unsigned char *)END_POINTER),
texuv3_ptr = (unsigned char *)gc->pipe[i].array.texuv3;
texa_ptr = (unsigned char *)gc->pipe[i].array.texa;
texsam_ptr = (unsigned char *)gc->pipe[i].array.texsam;
- texm_ptr = (unsigned char *)gc->pipe[i].array.texm;
+ mask_ptr = (unsigned char *)gc->pipe[i].array.mask;
}
- glVertexAttribPointer(SHAD_VERTEX, 3, GL_SHORT, GL_FALSE, 0, (void *)vertex_ptr);
- glVertexAttribPointer(SHAD_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, (void *)color_ptr);
+ glVertexAttribPointer(SHAD_VERTEX, VERTEX_CNT, GL_SHORT, GL_FALSE, 0, vertex_ptr);
+ glVertexAttribPointer(SHAD_COLOR, COLOR_CNT, GL_UNSIGNED_BYTE, GL_TRUE, 0, color_ptr);
if (gc->pipe[i].array.line)
{
glDisableVertexAttribArray(SHAD_TEXUV3);
glDisableVertexAttribArray(SHAD_TEXA);
glDisableVertexAttribArray(SHAD_TEXSAM);
- glDisableVertexAttribArray(SHAD_TEXM);
+ glDisableVertexAttribArray(SHAD_MASK);
glDrawArrays(GL_LINES, 0, gc->pipe[i].array.num);
}
else
if (gc->pipe[i].array.use_texuv)
{
glEnableVertexAttribArray(SHAD_TEXUV);
- glVertexAttribPointer(SHAD_TEXUV, 2, GL_FLOAT, GL_FALSE, 0,
- (void *)texuv_ptr);
+ glVertexAttribPointer(SHAD_TEXUV, TEX_CNT, GL_FLOAT, GL_FALSE, 0, texuv_ptr);
MASK_TEXTURE += 1;
}
}
/* Alpha plane */
- if (gc->pipe[i].array.use_texa && (gc->pipe[i].region.type != RTYPE_MAP))
+ if (gc->pipe[i].array.use_texa)
{
glEnableVertexAttribArray(SHAD_TEXA);
- glVertexAttribPointer(SHAD_TEXA, 2, GL_FLOAT, GL_FALSE, 0, (void *)texa_ptr);
+ glVertexAttribPointer(SHAD_TEXA, TEX_CNT, GL_FLOAT, GL_FALSE, 0, texa_ptr);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texa);
#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT
MASK_TEXTURE += 1;
}
- else if (gc->pipe[i].array.use_texa && (gc->pipe[i].region.type == RTYPE_MAP))
- {
- /* For map masking, we (ab)use 3 texture vertex pointers
- * (namely tex_coordm, tex_coorda and tex_sample).
- * We could probably pack them into an array or something. */
- glEnableVertexAttribArray(SHAD_TEXA);
- glVertexAttribPointer(SHAD_TEXA, 2, GL_FLOAT, GL_FALSE, 0, (void *)texa_ptr);
- }
else
{
glDisableVertexAttribArray(SHAD_TEXA);
if (gc->pipe[i].array.use_texsam)
{
glEnableVertexAttribArray(SHAD_TEXSAM);
- glVertexAttribPointer(SHAD_TEXSAM, 2, GL_FLOAT, GL_FALSE, 0, (void *)texsam_ptr);
+ glVertexAttribPointer(SHAD_TEXSAM, TEX_CNT, GL_FLOAT, GL_FALSE, 0, texsam_ptr);
}
else
{
{
glEnableVertexAttribArray(SHAD_TEXUV2);
glEnableVertexAttribArray(SHAD_TEXUV3);
- glVertexAttribPointer(SHAD_TEXUV2, 2, GL_FLOAT, GL_FALSE, 0, (void *)texuv2_ptr);
- glVertexAttribPointer(SHAD_TEXUV3, 2, GL_FLOAT, GL_FALSE, 0, (void *)texuv3_ptr);
+ glVertexAttribPointer(SHAD_TEXUV2, TEX_CNT, GL_FLOAT, GL_FALSE, 0, texuv2_ptr);
+ glVertexAttribPointer(SHAD_TEXUV3, TEX_CNT, GL_FLOAT, GL_FALSE, 0, texuv3_ptr);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu);
else if (gc->pipe[i].array.use_texuv2)
{
glEnableVertexAttribArray(SHAD_TEXUV2);
- glVertexAttribPointer(SHAD_TEXUV2, 2, GL_FLOAT, GL_FALSE, 0, (void *)texuv2_ptr);
+ glVertexAttribPointer(SHAD_TEXUV2, TEX_CNT, GL_FLOAT, GL_FALSE, 0, texuv2_ptr);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu);
}
/* Mask surface */
- if (gc->pipe[i].array.use_texm)
+ if (gc->pipe[i].array.use_mask)
{
- glEnableVertexAttribArray(SHAD_TEXM);
- glVertexAttribPointer(SHAD_TEXM, 2, GL_FLOAT, GL_FALSE, 0, (void *)texm_ptr);
+ glEnableVertexAttribArray(SHAD_MASK);
+ glVertexAttribPointer(SHAD_MASK, MASK_CNT, GL_FLOAT, GL_FALSE, 0, mask_ptr);
glActiveTexture(MASK_TEXTURE);
glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texm);
#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT
}
else
{
- glDisableVertexAttribArray(SHAD_TEXM);
+ glDisableVertexAttribArray(SHAD_MASK);
}
if (dbgflushnum == 1)
if (gc->pipe[i].array.texuv2) free(gc->pipe[i].array.texuv2);
if (gc->pipe[i].array.texuv3) free(gc->pipe[i].array.texuv3);
if (gc->pipe[i].array.texsam) free(gc->pipe[i].array.texsam);
- if (gc->pipe[i].array.texm) free(gc->pipe[i].array.texm);
+ if (gc->pipe[i].array.mask) free(gc->pipe[i].array.mask);
gc->pipe[i].array.line = 0;
gc->pipe[i].array.use_vertex = 0;
gc->pipe[i].array.use_texuv3 = 0;
gc->pipe[i].array.use_texa = 0;
gc->pipe[i].array.use_texsam = 0;
- gc->pipe[i].array.use_texm = 0;
+ gc->pipe[i].array.use_mask = 0;
gc->pipe[i].array.vertex = NULL;
gc->pipe[i].array.color = NULL;
gc->pipe[i].array.texuv2 = NULL;
gc->pipe[i].array.texuv3 = NULL;
gc->pipe[i].array.texsam = NULL;
- gc->pipe[i].array.texm = NULL;
+ gc->pipe[i].array.mask = NULL;
gc->pipe[i].array.num = 0;
gc->pipe[i].array.alloc = 0;
b = (dc->col.col ) & 0xff;
sx = 0; sy = 0; sw = tex->w, sh = tex->h;
- if (gc->dc->clip.mask && (sw > 0) && (sh > 0))
+ if (mtex && mtex->pt && mtex->pt->w && mtex->pt->h)
{
- double nx, ny, nw, nh, dx, dy, dw, dh;
- const double mask_x = gc->dc->clip.mask_x;
- const double mask_y = gc->dc->clip.mask_y;
- const double tmw = mtex->pt->w;
- const double tmh = mtex->pt->h;
- double scalex = 1.0;
- double scaley = 1.0;
-
// canvas coords
- nx = x; ny = y; nw = tex->w; nh = tex->h;
- RECTS_CLIP_TO_RECT(nx, ny, nw, nh,
- gc->dc->clip.x, gc->dc->clip.y,
- gc->dc->clip.w, gc->dc->clip.h);
- if ((nw < 1) || (nh < 1)) return;
- dx = x; dy = y; dw = sw; dh = sh;
- mx = mask_x; my = mask_y;
- if (mask->scaled.origin && mask->scaled.w && mask->scaled.h)
+ mx = dc->clip.mask_x;
+ my = dc->clip.mask_y;
+ if (mask->scaled.origin)
{
mw = mask->scaled.w;
mh = mask->scaled.h;
- scalex = mask->w / (double)mask->scaled.w;
- scaley = mask->h / (double)mask->scaled.h;
mask_smooth = mask->scaled.smooth;
}
else
mw = mask->w;
mh = mask->h;
}
- //RECTS_CLIP_TO_RECT(mx, my, mw, mh, cx, cy, cw, ch);
- RECTS_CLIP_TO_RECT(mx, my, mw, mh, dx, dy, dw, dh);
-
- // convert to tex coords
- mx = (mtex->x / tmw) + ((mx - mask_x + (mw * (nx - dx)) / dw) * scalex / tmw);
- my = (mtex->y / tmh) + ((my - mask_y + (mh * (ny - dy)) / dy) * scaley / tmh);
- mw = (mw * nw * scalex / dw) / tmw;
- mh = (mh * nh * scaley / dh) / tmh;
}
+ else mtex = NULL;
if ((!gc->dc->cutout.rects) ||
((gc->shared->info.tune.cutout.max > 0) &&
//mx = mx - dc->clip.mask_x;
//my = my - dc->clip.mask_y;
}
+ else mtex = NULL;
evas_gl_common_context_image_map_push(gc, im->tex, npoints, p,
c, cx, cy, cw, ch,
int sx, int sy, int sw, int sh,
int cx, int cy, int cw, int ch,
int r, int g, int b, int a,
- Evas_GL_Image *mask, int mask_x, int mask_y,
+ Evas_GL_Image *mask,
Eina_Bool smooth,
Eina_Bool yuv, Eina_Bool yuy2, Eina_Bool nv12,
Eina_Bool rgb_a_pair)
{
- double mx = 0, my = 0, mw = 0, mh = 0;
+ int mx = 0, my = 0, mw = 0, mh = 0;
double ssx, ssy, ssw, ssh;
Evas_GL_Texture *mtex = mask ? mask->tex : NULL;
Eina_Bool mask_smooth = EINA_FALSE;
if (mtex && mtex->pt && mtex->pt->w && mtex->pt->h)
{
- const double tmw = mtex->pt->w;
- const double tmh = mtex->pt->h;
- double scalex = 1.0;
- double scaley = 1.0;
-
// canvas coords
- mx = mask_x; my = mask_y;
+ mx = gc->dc->clip.mask_x;
+ my = gc->dc->clip.mask_y;
if (mask->scaled.origin)
{
mw = mask->scaled.w;
mh = mask->scaled.h;
- scalex = mask->w / (double)mask->scaled.w;
- scaley = mask->h / (double)mask->scaled.h;
mask_smooth = mask->scaled.smooth;
}
else
mw = mask->w;
mh = mask->h;
}
- RECTS_CLIP_TO_RECT(mx, my, mw, mh, cx, cy, cw, ch);
- RECTS_CLIP_TO_RECT(mx, my, mw, mh, dx, dy, dw, dh);
-
- // convert to tex coords
- mx = (mtex->x / tmw) + ((mx - mask_x) * scalex / tmw);
- my = (mtex->y / tmh) + ((my - mask_y) * scaley / tmh);
- mw = mw * scalex / tmw;
- mh = mh * scaley / tmh;
}
+ else mtex = NULL;
if ((nx == dx) && (ny == dy) && (nw == dw) && (nh == dh))
{
Eina_Bool nv12 = EINA_FALSE;
Eina_Bool rgb_a_pair = EINA_FALSE;
Evas_GL_Image *mask;
- int mask_x, mask_y;
if (sw < 1) sw = 1;
if (sh < 1) sh = 1;
// Prepare mask image, if there is one
mask = dc->clip.mask;
- mask_x = dc->clip.mask_x;
- mask_y = dc->clip.mask_y;
if (mask)
{
evas_gl_common_image_update(gc, mask);
{
ERR("Failed to apply mask image");
mask = NULL;
- mask_x = 0;
- mask_y = 0;
}
}
gc->dc->clip.x, gc->dc->clip.y,
gc->dc->clip.w, gc->dc->clip.h,
r, g, b, a,
- mask, mask_x, mask_y,
+ mask,
smooth,
yuv, yuy2, nv12, rgb_a_pair);
}
sx, sy, sw, sh,
dx, dy, dw, dh,
r, g, b, a,
- mask, mask_x, mask_y,
+ mask,
smooth,
yuv, yuy2, nv12, rgb_a_pair);
}
sx, sy, sw, sh,
rct->x, rct->y, rct->w, rct->h,
r, g, b, a,
- mask, mask_x, mask_y,
+ mask,
smooth,
yuv, yuy2, nv12, rgb_a_pair);
}
{
Cutout_Rect *r;
int c, cx, cy, cw, ch, cr, cg, cb, ca, i;
- double mx = 0, my = 0, mw = 0, mh = 0;
+ int mx = 0, my = 0, mw = 0, mh = 0;
Eina_Bool mask_smooth = EINA_FALSE;
Evas_GL_Image *mask = gc->dc->clip.mask;
Evas_GL_Texture *mtex = mask ? mask->tex : NULL;
gc->dc->clip.w, gc->dc->clip.h);
}
- if (mtex)
+ if (mtex && mtex->pt && mtex->pt->w && mtex->pt->h)
{
- const double mask_x = gc->dc->clip.mask_x;
- const double mask_y = gc->dc->clip.mask_y;
- const double tmw = mtex->pt->w;
- const double tmh = mtex->pt->h;
- double scalex = 1.0;
- double scaley = 1.0;
-
// canvas coords
- mx = mask_x; my = mask_y;
- if (mask->scaled.origin && mask->scaled.w && mask->scaled.h)
+ mx = gc->dc->clip.mask_x;
+ my = gc->dc->clip.mask_y;
+ if (mask->scaled.origin)
{
mw = mask->scaled.w;
mh = mask->scaled.h;
- scalex = mask->w / (double)mask->scaled.w;
- scaley = mask->h / (double)mask->scaled.h;
mask_smooth = mask->scaled.smooth;
}
else
mw = mask->w;
mh = mask->h;
}
- RECTS_CLIP_TO_RECT(mx, my, mw, mh, cx, cy, cw, ch);
- mx -= gc->dc->clip.mask_x;
- my -= gc->dc->clip.mask_y;
-
- // convert to tex coords
- mx = (mtex->x / tmw) + ((mx - mask_x) * scalex / tmw);
- my = (mtex->y / tmh) + ((my - mask_y) * scaley / tmh);
- mw = mw * scalex / tmw;
- mh = mh * scaley / tmh;
}
+ else mtex = NULL;
if (!gc->dc->cutout.rects)
{
glBindAttribLocation(p->prog, SHAD_TEXUV3, "tex_coord3");
glBindAttribLocation(p->prog, SHAD_TEXA, "tex_coorda");
glBindAttribLocation(p->prog, SHAD_TEXSAM, "tex_sample");
- glBindAttribLocation(p->prog, SHAD_TEXM, "tex_coordm");
+ glBindAttribLocation(p->prog, SHAD_MASK, "mask_coord");
glGetProgramiv(p->prog, GL_LINK_STATUS, &ok);
if (!ok)
glBindAttribLocation(p->prog, SHAD_TEXUV, "tex_coord");
glBindAttribLocation(p->prog, SHAD_TEXUV2, "tex_coord2");
glBindAttribLocation(p->prog, SHAD_TEXUV3, "tex_coord3");
- glBindAttribLocation(p->prog, SHAD_TEXA, "tex_coorda");
+ glBindAttribLocation(p->prog, SHAD_TEXA, "tex_coorda");
glBindAttribLocation(p->prog, SHAD_TEXSAM, "tex_sample");
- glBindAttribLocation(p->prog, SHAD_TEXM, "tex_coordm");
+ glBindAttribLocation(p->prog, SHAD_MASK, "mask_coord");
glLinkProgram(p->prog);
ok = 0;
"attribute vec4 vertex;\n"
"attribute vec4 color;\n"
"attribute vec2 tex_coord;\n"
- "attribute vec2 tex_coordm;\n"
+ "attribute vec4 mask_coord;\n"
"uniform mat4 mvp;\n"
"varying vec4 col;\n"
"varying vec2 tex_c;\n"
" gl_Position = mvp * vertex;\n"
" col = color;\n"
" tex_c = tex_coord;\n"
- " tex_m = tex_coordm;\n"
+ " // mask_coord.w contains the Y-invert flag\n"
+ " // position on screen in [0..1] range of current pixel\n"
+ " vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
+ " tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"
"}\n";
Evas_GL_Program_Source shader_font_mask_vert_src =
{
"uniform sampler2D texm;\n"
"varying vec4 col;\n"
"varying vec2 coord_c;\n"
- "varying vec2 coord_m;\n"
+ "varying vec2 tex_m;\n"
"void main()\n"
"{\n"
- " gl_FragColor = texture2D(texm, coord_m.xy).a * texture2D(tex, coord_c.xy).bgra * col;\n"
+ " gl_FragColor = texture2D(texm, tex_m.xy).a * texture2D(tex, coord_c.xy).bgra * col;\n"
"}\n";
Evas_GL_Program_Source shader_img_mask_frag_src =
{
"attribute vec4 vertex;\n"
"attribute vec4 color;\n"
"attribute vec2 tex_coord;\n"
- "attribute vec2 tex_coordm;\n"
+ "attribute vec4 mask_coord;\n"
"uniform mat4 mvp;\n"
"varying vec4 col;\n"
"varying vec2 coord_c;\n"
- "varying vec2 coord_m;\n"
+ "varying vec2 tex_m;\n"
"void main()\n"
"{\n"
" gl_Position = mvp * vertex;\n"
" col = color;\n"
" coord_c = tex_coord;\n"
- " coord_m = tex_coordm;\n"
+ " // mask_coord.w contains the Y-invert flag\n"
+ " // position on screen in [0..1] range of current pixel\n"
+ " vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
+ " tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"
"}\n";
Evas_GL_Program_Source shader_img_mask_vert_src =
{
"uniform sampler2D tex;\n"
"uniform sampler2D texm;\n"
"varying vec2 coord_c;\n"
- "varying vec2 coord_m;\n"
+ "varying vec2 tex_m;\n"
"void main()\n"
"{\n"
- " gl_FragColor = texture2D(tex, coord_c.xy) * texture2D(texm, coord_m).a;\n"
+ " gl_FragColor = texture2D(tex, coord_c.xy) * texture2D(texm, tex_m).a;\n"
"}\n";
Evas_GL_Program_Source shader_img_mask_nomul_frag_src =
{
"#endif\n"
"attribute vec4 vertex;\n"
"attribute vec2 tex_coord;\n"
- "attribute vec2 tex_coordm;\n"
+ "attribute vec4 mask_coord;\n"
"uniform mat4 mvp;\n"
"varying vec2 coord_c;\n"
- "varying vec2 coord_m;\n"
+ "varying vec2 tex_m;\n"
"void main()\n"
"{\n"
" gl_Position = mvp * vertex;\n"
" coord_c = tex_coord;\n"
- " coord_m = tex_coordm;\n"
+ " // mask_coord.w contains the Y-invert flag\n"
+ " // position on screen in [0..1] range of current pixel\n"
+ " vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
+ " tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"
"}\n";
Evas_GL_Program_Source shader_img_mask_nomul_vert_src =
{
"uniform sampler2D texm;\n"
"varying vec4 col;\n"
"varying vec2 coord_c;\n"
- "varying vec2 coord_m;\n"
+ "varying vec2 tex_m;\n"
"void main()\n"
"{\n"
- " gl_FragColor = texture2D(texm, coord_m.xy).a * texture2D(tex, coord_c.xy) * col;\n"
+ " gl_FragColor = texture2D(texm, tex_m.xy).a * texture2D(tex, coord_c.xy) * col;\n"
"}\n";
Evas_GL_Program_Source shader_img_mask_bgra_frag_src =
{
"attribute vec4 vertex;\n"
"attribute vec4 color;\n"
"attribute vec2 tex_coord;\n"
- "attribute vec2 tex_coordm;\n"
+ "attribute vec4 mask_coord;\n"
"uniform mat4 mvp;\n"
"varying vec4 col;\n"
"varying vec2 coord_c;\n"
- "varying vec2 coord_m;\n"
+ "varying vec2 tex_m;\n"
"void main()\n"
"{\n"
" gl_Position = mvp * vertex;\n"
" col = color;\n"
" coord_c = tex_coord;\n"
- " coord_m = tex_coordm;\n"
+ " // mask_coord.w contains the Y-invert flag\n"
+ " // position on screen in [0..1] range of current pixel\n"
+ " vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
+ " tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"
"}\n";
Evas_GL_Program_Source shader_img_mask_bgra_vert_src =
{
"uniform sampler2D tex;\n"
"uniform sampler2D texm;\n"
"varying vec2 coord_c;\n"
- "varying vec2 coord_m;\n"
+ "varying vec2 tex_m;\n"
"void main()\n"
"{\n"
- " gl_FragColor = texture2D(texm, coord_m.xy).a * texture2D(tex, coord_c.xy);\n"
+ " gl_FragColor = texture2D(texm, tex_m.xy).a * texture2D(tex, coord_c.xy);\n"
"}\n";
Evas_GL_Program_Source shader_img_mask_bgra_nomul_frag_src =
{
"#endif\n"
"attribute vec4 vertex;\n"
"attribute vec2 tex_coord;\n"
- "attribute vec2 tex_coordm;\n"
+ "attribute vec4 mask_coord;\n"
"uniform mat4 mvp;\n"
"varying vec2 coord_c;\n"
- "varying vec2 coord_m;\n"
+ "varying vec2 tex_m;\n"
"void main()\n"
"{\n"
" gl_Position = mvp * vertex;\n"
" coord_c = tex_coord;\n"
- " coord_m = tex_coordm;\n"
+ " // mask_coord.w contains the Y-invert flag\n"
+ " // position on screen in [0..1] range of current pixel\n"
+ " vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
+ " tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"
"}\n";
Evas_GL_Program_Source shader_img_mask_bgra_nomul_vert_src =
{
"#endif\n"
"attribute vec4 vertex;\n"
"attribute vec4 color;\n"
- "attribute vec2 tex_coord, tex_coord2, tex_coord3, tex_coordm;\n"
+ "attribute vec4 mask_coord;\n"
+ "attribute vec2 tex_coord, tex_coord2, tex_coord3;\n"
"uniform mat4 mvp;\n"
"varying vec4 col;\n"
"varying vec2 tex_c, tex_c2, tex_c3, tex_m;\n"
" tex_c = tex_coord;\n"
" tex_c2 = tex_coord2;\n"
" tex_c3 = tex_coord3;\n"
- " tex_m = tex_coordm;\n"
+ " // mask_coord.w contains the Y-invert flag\n"
+ " // position on screen in [0..1] range of current pixel\n"
+ " vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
+ " tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"
"}\n";
Evas_GL_Program_Source shader_yuv_mask_vert_src =
{
"#endif\n"
"attribute vec4 vertex;\n"
"attribute vec4 color;\n"
- "attribute vec2 tex_coord, tex_coord2, tex_coordm;\n"
+ "attribute vec4 mask_coord;\n"
+ "attribute vec2 tex_coord, tex_coord2;\n"
"uniform mat4 mvp;\n"
"varying vec4 col;\n"
"varying vec2 tex_c, tex_cuv, tex_m;\n"
" col = color;\n"
" tex_c = tex_coord;\n"
" tex_cuv = tex_coord2 * 0.5;\n"
- " tex_m = tex_coordm;\n"
+ " // mask_coord.w contains the Y-invert flag\n"
+ " // position on screen in [0..1] range of current pixel\n"
+ " vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
+ " tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"
"}\n";
Evas_GL_Program_Source shader_nv12_mask_vert_src =
{
"#endif\n"
"attribute vec4 vertex;\n"
"attribute vec4 color;\n"
- "attribute vec2 tex_coord, tex_coord2, tex_coordm;\n"
+ "attribute vec4 mask_coord;\n"
+ "attribute vec2 tex_coord, tex_coord2;\n"
"uniform mat4 mvp;\n"
"varying vec4 col;\n"
"varying vec2 tex_c, tex_cuv, tex_m;\n"
" col = color;\n"
" tex_c = tex_coord;\n"
" tex_cuv = vec2(tex_coord2.x * 0.5, tex_coord2.y);\n"
- " tex_m = tex_coordm;\n"
+ " // mask_coord.w contains the Y-invert flag\n"
+ " // position on screen in [0..1] range of current pixel\n"
+ " vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
+ " tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"
"}\n";
Evas_GL_Program_Source shader_yuy2_mask_vert_src =
{
"varying vec4 col;\n"
"varying vec2 coord_c;\n"
"varying vec2 coord_a;\n"
- "varying vec2 coord_m;\n"
+ "varying vec2 tex_m;\n"
"void main()\n"
"{\n"
- " gl_FragColor.rgb = texture2D(tex, coord_c.xy).rgb * col.rgb * texture2D(texa, coord_a).g * texture2D(texm, coord_m.xy).a;\n"
- " gl_FragColor.a = col.a * texture2D(texa, coord_a).g * texture2D(texm, coord_m.xy).a;\n"
+ " gl_FragColor.rgb = texture2D(tex, coord_c.xy).rgb * col.rgb * texture2D(texa, coord_a).g * texture2D(texm, tex_m.xy).a;\n"
+ " gl_FragColor.a = col.a * texture2D(texa, coord_a).g * texture2D(texm, tex_m.xy).a;\n"
"}\n";
Evas_GL_Program_Source shader_rgb_a_pair_mask_frag_src =
{
"attribute vec4 color;\n"
"attribute vec2 tex_coord;\n"
"attribute vec2 tex_coorda;\n"
- "attribute vec2 tex_coordm;\n"
+ "attribute vec4 mask_coord;\n"
"uniform mat4 mvp;\n"
"varying vec4 col;\n"
"varying vec2 coord_c;\n"
"varying vec2 coord_a;\n"
- "varying vec2 coord_m;\n"
+ "varying vec2 tex_m;\n"
"void main()\n"
"{\n"
" gl_Position = mvp * vertex;\n"
" col = color;\n"
" coord_c = tex_coord;\n"
" coord_a = tex_coorda;\n"
- " coord_m = tex_coordm;\n"
+ " // mask_coord.w contains the Y-invert flag\n"
+ " // position on screen in [0..1] range of current pixel\n"
+ " vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
+ " tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"
"}\n";
Evas_GL_Program_Source shader_rgb_a_pair_mask_vert_src =
{
"#endif\n"
"uniform sampler2D texm;\n"
"varying vec4 col;\n"
- "varying vec4 coord_m;\n"
+ "varying vec2 tex_m;\n"
"void main()\n"
"{\n"
- " gl_FragColor = texture2D(texm, coord_m.xy).a * col;\n"
+ " gl_FragColor = texture2D(texm, tex_m.xy).a * col;\n"
"}\n";
Evas_GL_Program_Source shader_rect_mask_frag_src =
{
"#endif\n"
"attribute vec4 vertex;\n"
"attribute vec4 color;\n"
- "attribute vec4 tex_coordm;\n"
+ "attribute vec4 mask_coord;\n"
"uniform mat4 mvp;\n"
"varying vec4 col;\n"
- "varying vec4 coord_m;\n"
+ "varying vec2 tex_m;\n"
"void main()\n"
"{\n"
" gl_Position = mvp * vertex;\n"
" col = color;\n"
- " coord_m = tex_coordm;\n"
+ " // mask_coord.w contains the Y-invert flag\n"
+ " // position on screen in [0..1] range of current pixel\n"
+ " vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
+ " tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"
"}\n";
Evas_GL_Program_Source shader_rect_mask_vert_src =
{
"#ifdef GL_ES\n"
"precision highp float;\n"
"#endif\n"
- "attribute vec4 vertex, color;\n"
- "attribute vec2 tex_coord, tex_coordm, tex_sample, tex_coorda;\n"
+ "attribute vec4 vertex, color, mask_coord;\n"
+ "attribute vec2 tex_coord;\n"
"uniform mat4 mvp;\n"
"varying vec2 tex_c, tex_m;\n"
"varying vec4 col;\n"
" gl_Position = mvp * vertex;\n"
" tex_c = tex_coord;\n"
" col = color;\n"
- " // tex_coorda contains the Y-invert flag\n"
+ " // mask_coord.w contains the Y-invert flag\n"
" // position on screen in [0..1] range of current pixel\n"
- " vec4 mask_Position = mvp * vertex * vec4(0.5, sign(tex_coorda.y) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
- " tex_m = mask_Position.xy * tex_sample + tex_coordm;\n"
+ " vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
+ " tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"
"}\n";
Evas_GL_Program_Source shader_map_mask_vert_src =
{
"#ifdef GL_ES\n"
"precision highp float;\n"
"#endif\n"
- "attribute vec4 vertex;\n"
- "attribute vec2 tex_coord, tex_coordm, tex_sample, tex_coorda;\n"
+ "attribute vec4 vertex, mask_coord;\n"
+ "attribute vec2 tex_coord;\n"
"uniform mat4 mvp;\n"
"varying vec2 tex_c, tex_m;\n"
"void main()\n"
"{\n"
" gl_Position = mvp * vertex;\n"
" tex_c = tex_coord;\n"
- " // tex_coorda contains the Y-invert flag\n"
+ " // mask_coord.w contains the Y-invert flag\n"
" // position on screen in [0..1] range of current pixel\n"
- " vec4 mask_Position = mvp * vertex * vec4(0.5, sign(tex_coorda.y) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
- " tex_m = mask_Position.xy * tex_sample + tex_coordm;\n"
+ " vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
+ " tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"
"}\n";
Evas_GL_Program_Source shader_map_mask_nomul_vert_src =
{
"#ifdef GL_ES\n"
"precision highp float;\n"
"#endif\n"
- "attribute vec4 vertex, color;\n"
- "attribute vec2 tex_coord, tex_coordm, tex_sample, tex_coorda;\n"
+ "attribute vec4 vertex, color, mask_coord;\n"
+ "attribute vec2 tex_coord;\n"
"uniform mat4 mvp;\n"
"varying vec2 tex_c, tex_m;\n"
"varying vec4 col;\n"
" gl_Position = mvp * vertex;\n"
" tex_c = tex_coord;\n"
" col = color;\n"
- " // tex_coorda contains the Y-invert flag\n"
+ " // mask_coord.w contains the Y-invert flag\n"
" // position on screen in [0..1] range of current pixel\n"
- " vec4 mask_Position = mvp * vertex * vec4(0.5, sign(tex_coorda.y) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
- " tex_m = mask_Position.xy * tex_sample + tex_coordm;\n"
+ " vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
+ " tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"
"}\n";
Evas_GL_Program_Source shader_map_mask_bgra_vert_src =
{
"#ifdef GL_ES\n"
"precision highp float;\n"
"#endif\n"
- "attribute vec4 vertex;\n"
- "attribute vec2 tex_coord, tex_coordm, tex_sample, tex_coorda;\n"
+ "attribute vec4 vertex, mask_coord;\n"
+ "attribute vec2 tex_coord;\n"
"uniform mat4 mvp;\n"
"varying vec2 tex_c, tex_m;\n"
"void main()\n"
"{\n"
" gl_Position = mvp * vertex;\n"
" tex_c = tex_coord;\n"
- " // tex_coorda contains the Y-invert flag\n"
+ " // mask_coord.w contains the Y-invert flag\n"
" // position on screen in [0..1] range of current pixel\n"
- " vec4 mask_Position = mvp * vertex * vec4(0.5, sign(tex_coorda.y) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
- " tex_m = mask_Position.xy * tex_sample + tex_coordm;\n"
+ " vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
+ " tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"
"}\n";
Evas_GL_Program_Source shader_map_mask_bgra_nomul_vert_src =
{
attribute vec4 vertex;
attribute vec4 color;
attribute vec2 tex_coord;
-attribute vec2 tex_coordm;
+attribute vec4 mask_coord;
uniform mat4 mvp;
varying vec4 col;
varying vec2 tex_c;
gl_Position = mvp * vertex;
col = color;
tex_c = tex_coord;
- tex_m = tex_coordm;
+
+ // mask_coord.w contains the Y-invert flag
+ // position on screen in [0..1] range of current pixel
+ vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);
+ tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;
}
uniform sampler2D texm;
varying vec4 col;
varying vec2 coord_c;
-varying vec2 coord_m;
+varying vec2 tex_m;
void main()
{
- gl_FragColor = texture2D(texm, coord_m.xy).a * texture2D(tex, coord_c.xy) * col;
+ gl_FragColor = texture2D(texm, tex_m.xy).a * texture2D(tex, coord_c.xy) * col;
}
uniform sampler2D tex;
uniform sampler2D texm;
varying vec2 coord_c;
-varying vec2 coord_m;
+varying vec2 tex_m;
void main()
{
- gl_FragColor = texture2D(texm, coord_m.xy).a * texture2D(tex, coord_c.xy);
+ gl_FragColor = texture2D(texm, tex_m.xy).a * texture2D(tex, coord_c.xy);
}
#endif
attribute vec4 vertex;
attribute vec2 tex_coord;
-attribute vec2 tex_coordm;
+attribute vec4 mask_coord;
uniform mat4 mvp;
varying vec2 coord_c;
-varying vec2 coord_m;
+varying vec2 tex_m;
void main()
{
gl_Position = mvp * vertex;
coord_c = tex_coord;
- coord_m = tex_coordm;
+
+ // mask_coord.w contains the Y-invert flag
+ // position on screen in [0..1] range of current pixel
+ vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);
+ tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;
}
attribute vec4 vertex;
attribute vec4 color;
attribute vec2 tex_coord;
-attribute vec2 tex_coordm;
+attribute vec4 mask_coord;
uniform mat4 mvp;
varying vec4 col;
varying vec2 coord_c;
-varying vec2 coord_m;
+varying vec2 tex_m;
void main()
{
gl_Position = mvp * vertex;
col = color;
coord_c = tex_coord;
- coord_m = tex_coordm;
+
+ // mask_coord.w contains the Y-invert flag
+ // position on screen in [0..1] range of current pixel
+ vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);
+ tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;
}
uniform sampler2D texm;
varying vec4 col;
varying vec2 coord_c;
-varying vec2 coord_m;
+varying vec2 tex_m;
void main()
{
- gl_FragColor = texture2D(texm, coord_m.xy).a * texture2D(tex, coord_c.xy).bgra * col;
+ gl_FragColor = texture2D(texm, tex_m.xy).a * texture2D(tex, coord_c.xy).bgra * col;
}
uniform sampler2D tex;
uniform sampler2D texm;
varying vec2 coord_c;
-varying vec2 coord_m;
+varying vec2 tex_m;
void main()
{
- gl_FragColor = texture2D(tex, coord_c.xy) * texture2D(texm, coord_m).a;
+ gl_FragColor = texture2D(tex, coord_c.xy) * texture2D(texm, tex_m).a;
}
#endif
attribute vec4 vertex;
attribute vec2 tex_coord;
-attribute vec2 tex_coordm;
+attribute vec4 mask_coord;
uniform mat4 mvp;
varying vec2 coord_c;
-varying vec2 coord_m;
+varying vec2 tex_m;
void main()
{
gl_Position = mvp * vertex;
coord_c = tex_coord;
- coord_m = tex_coordm;
+
+ // mask_coord.w contains the Y-invert flag
+ // position on screen in [0..1] range of current pixel
+ vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);
+ tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;
}
attribute vec4 vertex;
attribute vec4 color;
attribute vec2 tex_coord;
-attribute vec2 tex_coordm;
+attribute vec4 mask_coord;
uniform mat4 mvp;
varying vec4 col;
varying vec2 coord_c;
-varying vec2 coord_m;
+varying vec2 tex_m;
void main()
{
gl_Position = mvp * vertex;
col = color;
coord_c = tex_coord;
- coord_m = tex_coordm;
+
+ // mask_coord.w contains the Y-invert flag
+ // position on screen in [0..1] range of current pixel
+ vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);
+ tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;
}
#ifdef GL_ES
precision highp float;
#endif
-attribute vec4 vertex;
-attribute vec2 tex_coord, tex_coordm, tex_sample, tex_coorda;
+attribute vec4 vertex, mask_coord;
+attribute vec2 tex_coord;
uniform mat4 mvp;
varying vec2 tex_c, tex_m;
void main()
gl_Position = mvp * vertex;
tex_c = tex_coord;
- // tex_coorda contains the Y-invert flag
+ // mask_coord.w contains the Y-invert flag
// position on screen in [0..1] range of current pixel
- vec4 mask_Position = mvp * vertex * vec4(0.5, sign(tex_coorda.y) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);
- tex_m = mask_Position.xy * tex_sample + tex_coordm;
+ vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);
+ tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;
}
#ifdef GL_ES
precision highp float;
#endif
-attribute vec4 vertex, color;
-attribute vec2 tex_coord, tex_coordm, tex_sample, tex_coorda;
+attribute vec4 vertex, color, mask_coord;
+attribute vec2 tex_coord;
uniform mat4 mvp;
varying vec2 tex_c, tex_m;
varying vec4 col;
tex_c = tex_coord;
col = color;
- // tex_coorda contains the Y-invert flag
+ // mask_coord.w contains the Y-invert flag
// position on screen in [0..1] range of current pixel
- vec4 mask_Position = mvp * vertex * vec4(0.5, sign(tex_coorda.y) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);
- tex_m = mask_Position.xy * tex_sample + tex_coordm;
+ vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);
+ tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;
}
#ifdef GL_ES
precision highp float;
#endif
-attribute vec4 vertex;
-attribute vec2 tex_coord, tex_coordm, tex_sample, tex_coorda;
+attribute vec4 vertex, mask_coord;
+attribute vec2 tex_coord;
uniform mat4 mvp;
varying vec2 tex_c, tex_m;
void main()
gl_Position = mvp * vertex;
tex_c = tex_coord;
- // tex_coorda contains the Y-invert flag
+ // mask_coord.w contains the Y-invert flag
// position on screen in [0..1] range of current pixel
- vec4 mask_Position = mvp * vertex * vec4(0.5, sign(tex_coorda.y) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);
- tex_m = mask_Position.xy * tex_sample + tex_coordm;
+ vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);
+ tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;
}
#ifdef GL_ES
precision highp float;
#endif
-attribute vec4 vertex, color;
-attribute vec2 tex_coord, tex_coordm, tex_sample, tex_coorda;
+attribute vec4 vertex, color, mask_coord;
+attribute vec2 tex_coord;
uniform mat4 mvp;
varying vec2 tex_c, tex_m;
varying vec4 col;
tex_c = tex_coord;
col = color;
- // tex_coorda contains the Y-invert flag
+ // mask_coord.w contains the Y-invert flag
// position on screen in [0..1] range of current pixel
- vec4 mask_Position = mvp * vertex * vec4(0.5, sign(tex_coorda.y) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);
- tex_m = mask_Position.xy * tex_sample + tex_coordm;
+ vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);
+ tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;
}
#endif
attribute vec4 vertex;
attribute vec4 color;
-attribute vec2 tex_coord, tex_coord2, tex_coordm;
+attribute vec4 mask_coord;
+attribute vec2 tex_coord, tex_coord2;
uniform mat4 mvp;
varying vec4 col;
varying vec2 tex_c, tex_cuv, tex_m;
col = color;
tex_c = tex_coord;
tex_cuv = tex_coord2 * 0.5;
- tex_m = tex_coordm;
+
+ // mask_coord.w contains the Y-invert flag
+ // position on screen in [0..1] range of current pixel
+ vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);
+ tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;
}
#endif
uniform sampler2D texm;
varying vec4 col;
-varying vec4 coord_m;
+varying vec2 tex_m;
void main()
{
- gl_FragColor = texture2D(texm, coord_m.xy).a * col;
+ gl_FragColor = texture2D(texm, tex_m.xy).a * col;
}
#endif
attribute vec4 vertex;
attribute vec4 color;
-attribute vec4 tex_coordm;
+attribute vec4 mask_coord;
uniform mat4 mvp;
varying vec4 col;
-varying vec4 coord_m;
+varying vec2 tex_m;
void main()
{
gl_Position = mvp * vertex;
col = color;
- coord_m = tex_coordm;
+
+ // mask_coord.w contains the Y-invert flag
+ // position on screen in [0..1] range of current pixel
+ vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);
+ tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;
}
varying vec4 col;
varying vec2 coord_c;
varying vec2 coord_a;
-varying vec2 coord_m;
+varying vec2 tex_m;
void main()
{
- gl_FragColor.rgb = texture2D(tex, coord_c.xy).rgb * col.rgb * texture2D(texa, coord_a).g * texture2D(texm, coord_m.xy).a;
- gl_FragColor.a = col.a * texture2D(texa, coord_a).g * texture2D(texm, coord_m.xy).a;
+ gl_FragColor.rgb = texture2D(tex, coord_c.xy).rgb * col.rgb * texture2D(texa, coord_a).g * texture2D(texm, tex_m.xy).a;
+ gl_FragColor.a = col.a * texture2D(texa, coord_a).g * texture2D(texm, tex_m.xy).a;
}
attribute vec4 color;
attribute vec2 tex_coord;
attribute vec2 tex_coorda;
-attribute vec2 tex_coordm;
+attribute vec4 mask_coord;
uniform mat4 mvp;
varying vec4 col;
varying vec2 coord_c;
varying vec2 coord_a;
-varying vec2 coord_m;
+varying vec2 tex_m;
void main()
{
gl_Position = mvp * vertex;
col = color;
coord_c = tex_coord;
coord_a = tex_coorda;
- coord_m = tex_coordm;
+
+ // mask_coord.w contains the Y-invert flag
+ // position on screen in [0..1] range of current pixel
+ vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);
+ tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;
}
#endif
attribute vec4 vertex;
attribute vec4 color;
-attribute vec2 tex_coord, tex_coord2, tex_coord3, tex_coordm;
+attribute vec4 mask_coord;
+attribute vec2 tex_coord, tex_coord2, tex_coord3;
uniform mat4 mvp;
varying vec4 col;
varying vec2 tex_c, tex_c2, tex_c3, tex_m;
tex_c = tex_coord;
tex_c2 = tex_coord2;
tex_c3 = tex_coord3;
- tex_m = tex_coordm;
+
+ // mask_coord.w contains the Y-invert flag
+ // position on screen in [0..1] range of current pixel
+ vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);
+ tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;
}
#endif
attribute vec4 vertex;
attribute vec4 color;
-attribute vec2 tex_coord, tex_coord2, tex_coordm;
+attribute vec4 mask_coord;
+attribute vec2 tex_coord, tex_coord2;
uniform mat4 mvp;
varying vec4 col;
varying vec2 tex_c, tex_cuv, tex_m;
col = color;
tex_c = tex_coord;
tex_cuv = vec2(tex_coord2.x * 0.5, tex_coord2.y);
- tex_m = tex_coordm;
+
+ // mask_coord.w contains the Y-invert flag
+ // position on screen in [0..1] range of current pixel
+ vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);
+ tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;
}