aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2019-04-15 17:53:22 +0900
committerHermet Park <hermetpark@gmail.com>2019-04-15 17:53:22 +0900
commit2ac93b5005e0693c5d84df71b4aa1c5a4b6baa80 (patch)
treefd3072f4da3043fc534344710bb50bde3edc0a05
parentMerge branch 'master' into devs/hermet/lottie (diff)
downloadefl-2ac93b5005e0693c5d84df71b4aa1c5a4b6baa80.tar.gz
evas gl: move to floating point coordinate system.
Summary: GL engine has used integer coordinates system since it's born though OpenGL basically uses floating point vertex coordinates system. There were many dissatisfaction, complaints about this since object's transition is jiggled, not perfectly smooth. It's obvious because Positioning must be stepping with integer units without any subpixel rendering. Our gl engine currently supports msaa options and evas map allows to have double precivion coordinates system, our engine must do handle this over as well, to work together. If you don't like change, We could switch behaviors optionally (turn on, only when msaa is enabled) But I think it's pointless using integer coordinates system in GL thesedays. It just make code complex to maintain. There will be an additional patch coming for SW backend map behavior soon. Left: before patch Right: after patch {F3694624} Reviewers: #committers, raster Subscribers: raster, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8552
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_common.h2
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_context.c75
-rw-r--r--src/modules/evas/engines/gl_generic/evas_engine.c40
3 files changed, 42 insertions, 75 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_common.h b/src/modules/evas/engines/gl_common/evas_gl_common.h
index ab9a54948d..3cc750bd89 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_common.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_common.h
@@ -335,7 +335,7 @@ struct _Evas_Engine_GL_Context
} shader;
struct {
int num, alloc;
- GLshort *vertex;
+ GLfloat *vertex;
GLubyte *color;
GLfloat *texuv;
GLfloat *texuv2;
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 2877007f42..c1f7d985b6 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_context.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_context.c
@@ -1403,7 +1403,7 @@ array_alloc(Evas_Engine_GL_Context *gc, int n)
gc->pipe[n].array.field = _pipebuf_resize(gc->pipe[n].array.field, \
gc->pipe[n].array.alloc * sizeof(type) * size)
- RALOC(vertex, GLshort, VERTEX_CNT);
+ RALOC(vertex, GLfloat, VERTEX_CNT);
RALOC(color, GLubyte, COLOR_CNT);
RALOC(texuv, GLfloat, TEX_CNT);
RALOC(texa, GLfloat, TEX_CNT);
@@ -1778,14 +1778,21 @@ static int
pipe_region_intersects(Evas_Engine_GL_Context *gc, int n,
int x, int y, int w, int h)
{
- int rx, ry, rw, rh, ii, end;
- const GLshort *v;
-
+#define SPANS_INTERSECT(x1, w1, x2, w2) \
+(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1)))))
+
+#define REGIONS_INTERSECT(x, y, w, h, xx, yy, ww, hh) \
+((SPANS_COMMON((x), (w), (xx), (ww))) && (SPANS_COMMON((y), (h), (yy), (hh))))
+
+ float rx, ry, rw, rh;
+ int ii, end;
+ const GLfloat *v;
+
rx = gc->pipe[n].region.x;
ry = gc->pipe[n].region.y;
rw = gc->pipe[n].region.w;
rh = gc->pipe[n].region.h;
- if (!RECTS_INTERSECT(x, y, w, h, rx, ry, rw, rh)) return 0;
+ if (!REGIONS_INTERSECT(x, y, w, h, rx, ry, rw, rh)) return 0;
// a hack for now. map pipes use their whole bounding box for intersects
// which at worst case reduces to old pipeline flushes, but cheaper than
@@ -1803,7 +1810,7 @@ pipe_region_intersects(Evas_Engine_GL_Context *gc, int n,
ry = v[ii + 1];
rw = v[ii + 3] - rx;
rh = v[ii + 7] - ry;
- if (RECTS_INTERSECT(x, y, w, h, rx, ry, rw, rh)) return 1;
+ if (REGIONS_INTERSECT(x, y, w, h, rx, ry, rw, rh)) return 1;
}
return 0;
}
@@ -2930,16 +2937,14 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
(A_VAL(&(p[2].col)) < 0xff) || (A_VAL(&(p[3].col)) < 0xff))
blend = EINA_TRUE;
- if ((p[0].z == p[1].z) && (p[1].z == p[2].z) && (p[2].z == p[3].z))
- flat = EINA_TRUE;
-
- if (!clip) cx = cy = cw = ch = 0;
-
- if (!flat)
+ if (((p[0].z == p[1].z) && (p[1].z == p[2].z) && (p[2].z == p[3].z)) ||
+ (p[0].foc <= 0))
{
- if (p[0].foc <= 0) flat = EINA_TRUE;
+ flat = EINA_TRUE;
}
+ if (!clip) cx = cy = cw = ch = 0;
+
switch (cspace)
{
case EVAS_COLORSPACE_YCBCR422P601_PL:
@@ -3000,28 +3005,11 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
w = w - x;
h = h - y;
- if (!flat)
- {
- // FUZZZZ!
- x -= 3;
- y -= 3;
- w += 6;
- h += 6;
- }
- if (clip)
- {
- if (flat)
- {
- int nx = x, ny = y, nw = w, nh = h;
-
- RECTS_CLIP_TO_RECT(nx, ny, nw, nh, cx, cy, cw, ch);
- if ((nx == x) && (ny == y) && (nw == w) && (nh == h))
- {
- clip = 0; cx = 0; cy = 0; cw = 0; ch = 0;
- }
- x = nx; y = ny; w = nw; h = nh;
- }
- }
+ // FUZZZZ!
+ x -= 3;
+ y -= 3;
+ w += 6;
+ h += 6;
if (!flat)
{
@@ -3033,6 +3021,17 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
gc->change.size = 1;
_evas_gl_common_viewport_set(gc);
}
+ else if (clip)
+ {
+ int nx = x, ny = y, nw = w, nh = h;
+
+ RECTS_CLIP_TO_RECT(nx, ny, nw, nh, cx, cy, cw, ch);
+ if ((nx == x) && (ny == y) && (nw == w) && (nh == h))
+ {
+ clip = 0; cx = 0; cy = 0; cw = 0; ch = 0;
+ }
+ x = nx; y = ny; w = nw; h = nh;
+ }
pn = _evas_gl_common_context_push(SHD_MAP,
gc, tex, mtex,
@@ -3108,8 +3107,8 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
if (flat)
{
PUSH_VERTEX(pn,
- (p[points[i]].x >> FP),
- (p[points[i]].y >> FP),
+ p[points[i]].fx,
+ p[points[i]].fy,
0);
}
else
@@ -4106,7 +4105,7 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
}
// use_vertex is always true
- glVertexAttribPointer(SHAD_VERTEX, VERTEX_CNT, GL_SHORT, GL_FALSE, 0, vertex_ptr);
+ glVertexAttribPointer(SHAD_VERTEX, VERTEX_CNT, GL_FLOAT, GL_FALSE, 0, vertex_ptr);
if (gc->pipe[i].array.use_color)
{
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c
index 2659498611..c76ada3d5b 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -1229,49 +1229,17 @@ eng_image_scale_hint_get(void *engine EINA_UNUSED, void *image)
}
static Eina_Bool
-eng_image_map_draw(void *engine, void *data, void *context, void *surface, void *image, RGBA_Map *m, int smooth, int level, Eina_Bool do_async)
+eng_image_map_draw(void *engine EINA_UNUSED, void *data, void *context, void *surface, void *image,
+ RGBA_Map *m, int smooth, int level, Eina_Bool do_async EINA_UNUSED)
{
Evas_Engine_GL_Context *gl_context;
- Evas_GL_Image *gim = image;
-
if (!image) return EINA_FALSE;
gl_context = gl_generic_context_get(data, 1);
evas_gl_common_context_target_surface_set(gl_context, surface);
gl_context->dc = context;
- if ((m->pts[0].x == m->pts[3].x) &&
- (m->pts[1].x == m->pts[2].x) &&
- (m->pts[0].y == m->pts[1].y) &&
- (m->pts[3].y == m->pts[2].y) &&
- (m->pts[0].x <= m->pts[1].x) &&
- (m->pts[0].y <= m->pts[2].y) &&
- (m->pts[0].u == 0) &&
- (m->pts[0].v == 0) &&
- (m->pts[1].u == (gim->w << FP)) &&
- (m->pts[1].v == 0) &&
- (m->pts[2].u == (gim->w << FP)) &&
- (m->pts[2].v == (gim->h << FP)) &&
- (m->pts[3].u == 0) &&
- (m->pts[3].v == (gim->h << FP)) &&
- (m->pts[0].col == 0xffffffff) &&
- (m->pts[1].col == 0xffffffff) &&
- (m->pts[2].col == 0xffffffff) &&
- (m->pts[3].col == 0xffffffff))
- {
- int dx, dy, dw, dh;
-
- dx = m->pts[0].x >> FP;
- dy = m->pts[0].y >> FP;
- dw = (m->pts[2].x >> FP) - dx;
- dh = (m->pts[2].y >> FP) - dy;
- eng_image_draw(engine, data, context, surface, image,
- 0, 0, gim->w, gim->h, dx, dy, dw, dh, smooth, do_async);
- }
- else
- {
- evas_gl_common_image_map_draw(gl_context, image, m->count, &m->pts[0],
- smooth, level);
- }
+ evas_gl_common_image_map_draw(gl_context, image, m->count, &m->pts[0],
+ smooth, level);
return EINA_FALSE;
}