summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2019-04-18 20:08:16 +0900
committerHermet Park <hermetpark@gmail.com>2019-04-18 20:08:16 +0900
commit3856e1a0026ff2c917b963051949a528db179d13 (patch)
treed8f25358d061983a92de279a724bb9b8c58c27f8
parent9c66a4751ce350d9fa5fce1207b596d21884d859 (diff)
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 Reviewed By: #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.h7
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_context.c75
-rw-r--r--src/modules/evas/engines/gl_generic/evas_engine.c7
-rw-r--r--src/modules/evas/engines/gl_x11/evas_x_main.c1
4 files changed, 46 insertions, 44 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..2c74423f26 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_common.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_common.h
@@ -308,8 +308,6 @@ struct _Evas_Engine_GL_Context
308 Eina_Bool size : 1; 308 Eina_Bool size : 1;
309 } change; 309 } change;
310 310
311 Eina_Bool havestuff : 1;
312
313 struct { 311 struct {
314 struct { 312 struct {
315 int x, y, w, h; 313 int x, y, w, h;
@@ -335,7 +333,7 @@ struct _Evas_Engine_GL_Context
335 } shader; 333 } shader;
336 struct { 334 struct {
337 int num, alloc; 335 int num, alloc;
338 GLshort *vertex; 336 GLfloat *vertex;
339 GLubyte *color; 337 GLubyte *color;
340 GLfloat *texuv; 338 GLfloat *texuv;
341 GLfloat *texuv2; 339 GLfloat *texuv2;
@@ -380,6 +378,9 @@ struct _Evas_Engine_GL_Context
380 378
381 GLuint preserve_bit; 379 GLuint preserve_bit;
382 int gles_version; 380 int gles_version;
381
382 Eina_Bool havestuff : 1;
383 Eina_Bool msaa : 1;
383}; 384};
384 385
385struct _Evas_GL_Texture_Pool 386struct _Evas_GL_Texture_Pool
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)
1403 gc->pipe[n].array.field = _pipebuf_resize(gc->pipe[n].array.field, \ 1403 gc->pipe[n].array.field = _pipebuf_resize(gc->pipe[n].array.field, \
1404 gc->pipe[n].array.alloc * sizeof(type) * size) 1404 gc->pipe[n].array.alloc * sizeof(type) * size)
1405 1405
1406 RALOC(vertex, GLshort, VERTEX_CNT); 1406 RALOC(vertex, GLfloat, VERTEX_CNT);
1407 RALOC(color, GLubyte, COLOR_CNT); 1407 RALOC(color, GLubyte, COLOR_CNT);
1408 RALOC(texuv, GLfloat, TEX_CNT); 1408 RALOC(texuv, GLfloat, TEX_CNT);
1409 RALOC(texa, GLfloat, TEX_CNT); 1409 RALOC(texa, GLfloat, TEX_CNT);
@@ -1778,14 +1778,21 @@ static int
1778pipe_region_intersects(Evas_Engine_GL_Context *gc, int n, 1778pipe_region_intersects(Evas_Engine_GL_Context *gc, int n,
1779 int x, int y, int w, int h) 1779 int x, int y, int w, int h)
1780{ 1780{
1781 int rx, ry, rw, rh, ii, end; 1781#define SPANS_INTERSECT(x1, w1, x2, w2) \
1782 const GLshort *v; 1782(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1)))))
1783 1783
1784#define REGIONS_INTERSECT(x, y, w, h, xx, yy, ww, hh) \
1785((SPANS_COMMON((x), (w), (xx), (ww))) && (SPANS_COMMON((y), (h), (yy), (hh))))
1786
1787 float rx, ry, rw, rh;
1788 int ii, end;
1789 const GLfloat *v;
1790
1784 rx = gc->pipe[n].region.x; 1791 rx = gc->pipe[n].region.x;
1785 ry = gc->pipe[n].region.y; 1792 ry = gc->pipe[n].region.y;
1786 rw = gc->pipe[n].region.w; 1793 rw = gc->pipe[n].region.w;
1787 rh = gc->pipe[n].region.h; 1794 rh = gc->pipe[n].region.h;
1788 if (!RECTS_INTERSECT(x, y, w, h, rx, ry, rw, rh)) return 0; 1795 if (!REGIONS_INTERSECT(x, y, w, h, rx, ry, rw, rh)) return 0;
1789 1796
1790 // a hack for now. map pipes use their whole bounding box for intersects 1797 // a hack for now. map pipes use their whole bounding box for intersects
1791 // which at worst case reduces to old pipeline flushes, but cheaper than 1798 // 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,
1803 ry = v[ii + 1]; 1810 ry = v[ii + 1];
1804 rw = v[ii + 3] - rx; 1811 rw = v[ii + 3] - rx;
1805 rh = v[ii + 7] - ry; 1812 rh = v[ii + 7] - ry;
1806 if (RECTS_INTERSECT(x, y, w, h, rx, ry, rw, rh)) return 1; 1813 if (REGIONS_INTERSECT(x, y, w, h, rx, ry, rw, rh)) return 1;
1807 } 1814 }
1808 return 0; 1815 return 0;
1809} 1816}
@@ -2930,16 +2937,14 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
2930 (A_VAL(&(p[2].col)) < 0xff) || (A_VAL(&(p[3].col)) < 0xff)) 2937 (A_VAL(&(p[2].col)) < 0xff) || (A_VAL(&(p[3].col)) < 0xff))
2931 blend = EINA_TRUE; 2938 blend = EINA_TRUE;
2932 2939
2933 if ((p[0].z == p[1].z) && (p[1].z == p[2].z) && (p[2].z == p[3].z)) 2940 if (((p[0].z == p[1].z) && (p[1].z == p[2].z) && (p[2].z == p[3].z)) ||
2934 flat = EINA_TRUE; 2941 (p[0].foc <= 0))
2935
2936 if (!clip) cx = cy = cw = ch = 0;
2937
2938 if (!flat)
2939 { 2942 {
2940 if (p[0].foc <= 0) flat = EINA_TRUE; 2943 flat = EINA_TRUE;
2941 } 2944 }
2942 2945
2946 if (!clip) cx = cy = cw = ch = 0;
2947
2943 switch (cspace) 2948 switch (cspace)
2944 { 2949 {
2945 case EVAS_COLORSPACE_YCBCR422P601_PL: 2950 case EVAS_COLORSPACE_YCBCR422P601_PL:
@@ -3000,28 +3005,11 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
3000 w = w - x; 3005 w = w - x;
3001 h = h - y; 3006 h = h - y;
3002 3007
3003 if (!flat) 3008 // FUZZZZ!
3004 { 3009 x -= 3;
3005 // FUZZZZ! 3010 y -= 3;
3006 x -= 3; 3011 w += 6;
3007 y -= 3; 3012 h += 6;
3008 w += 6;
3009 h += 6;
3010 }
3011 if (clip)
3012 {
3013 if (flat)
3014 {
3015 int nx = x, ny = y, nw = w, nh = h;
3016
3017 RECTS_CLIP_TO_RECT(nx, ny, nw, nh, cx, cy, cw, ch);
3018 if ((nx == x) && (ny == y) && (nw == w) && (nh == h))
3019 {
3020 clip = 0; cx = 0; cy = 0; cw = 0; ch = 0;
3021 }
3022 x = nx; y = ny; w = nw; h = nh;
3023 }
3024 }
3025 3013
3026 if (!flat) 3014 if (!flat)
3027 { 3015 {
@@ -3033,6 +3021,17 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
3033 gc->change.size = 1; 3021 gc->change.size = 1;
3034 _evas_gl_common_viewport_set(gc); 3022 _evas_gl_common_viewport_set(gc);
3035 } 3023 }
3024 else if (clip)
3025 {
3026 int nx = x, ny = y, nw = w, nh = h;
3027
3028 RECTS_CLIP_TO_RECT(nx, ny, nw, nh, cx, cy, cw, ch);
3029 if ((nx == x) && (ny == y) && (nw == w) && (nh == h))
3030 {
3031 clip = 0; cx = 0; cy = 0; cw = 0; ch = 0;
3032 }
3033 x = nx; y = ny; w = nw; h = nh;
3034 }
3036 3035
3037 pn = _evas_gl_common_context_push(SHD_MAP, 3036 pn = _evas_gl_common_context_push(SHD_MAP,
3038 gc, tex, mtex, 3037 gc, tex, mtex,
@@ -3108,8 +3107,8 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
3108 if (flat) 3107 if (flat)
3109 { 3108 {
3110 PUSH_VERTEX(pn, 3109 PUSH_VERTEX(pn,
3111 (p[points[i]].x >> FP), 3110 p[points[i]].fx,
3112 (p[points[i]].y >> FP), 3111 p[points[i]].fy,
3113 0); 3112 0);
3114 } 3113 }
3115 else 3114 else
@@ -4106,7 +4105,7 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
4106 } 4105 }
4107 4106
4108 // use_vertex is always true 4107 // use_vertex is always true
4109 glVertexAttribPointer(SHAD_VERTEX, VERTEX_CNT, GL_SHORT, GL_FALSE, 0, vertex_ptr); 4108 glVertexAttribPointer(SHAD_VERTEX, VERTEX_CNT, GL_FLOAT, GL_FALSE, 0, vertex_ptr);
4110 4109
4111 if (gc->pipe[i].array.use_color) 4110 if (gc->pipe[i].array.use_color)
4112 { 4111 {
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c
index 2659498611..60301d4283 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -1229,7 +1229,8 @@ eng_image_scale_hint_get(void *engine EINA_UNUSED, void *image)
1229} 1229}
1230 1230
1231static Eina_Bool 1231static Eina_Bool
1232eng_image_map_draw(void *engine, void *data, void *context, void *surface, void *image, RGBA_Map *m, int smooth, int level, Eina_Bool do_async) 1232eng_image_map_draw(void *engine EINA_UNUSED, void *data, void *context, void *surface, void *image,
1233 RGBA_Map *m, int smooth, int level, Eina_Bool do_async EINA_UNUSED)
1233{ 1234{
1234 Evas_Engine_GL_Context *gl_context; 1235 Evas_Engine_GL_Context *gl_context;
1235 Evas_GL_Image *gim = image; 1236 Evas_GL_Image *gim = image;
@@ -1239,7 +1240,8 @@ eng_image_map_draw(void *engine, void *data, void *context, void *surface, void
1239 evas_gl_common_context_target_surface_set(gl_context, surface); 1240 evas_gl_common_context_target_surface_set(gl_context, surface);
1240 gl_context->dc = context; 1241 gl_context->dc = context;
1241 1242
1242 if ((m->pts[0].x == m->pts[3].x) && 1243 if (!gl_context->msaa &&
1244 (m->pts[0].x == m->pts[3].x) &&
1243 (m->pts[1].x == m->pts[2].x) && 1245 (m->pts[1].x == m->pts[2].x) &&
1244 (m->pts[0].y == m->pts[1].y) && 1246 (m->pts[0].y == m->pts[1].y) &&
1245 (m->pts[3].y == m->pts[2].y) && 1247 (m->pts[3].y == m->pts[2].y) &&
@@ -1259,7 +1261,6 @@ eng_image_map_draw(void *engine, void *data, void *context, void *surface, void
1259 (m->pts[3].col == 0xffffffff)) 1261 (m->pts[3].col == 0xffffffff))
1260 { 1262 {
1261 int dx, dy, dw, dh; 1263 int dx, dy, dw, dh;
1262
1263 dx = m->pts[0].x >> FP; 1264 dx = m->pts[0].x >> FP;
1264 dy = m->pts[0].y >> FP; 1265 dy = m->pts[0].y >> FP;
1265 dw = (m->pts[2].x >> FP) - dx; 1266 dw = (m->pts[2].x >> FP) - dx;
diff --git a/src/modules/evas/engines/gl_x11/evas_x_main.c b/src/modules/evas/engines/gl_x11/evas_x_main.c
index 3996f510d0..3543d9390b 100644
--- a/src/modules/evas/engines/gl_x11/evas_x_main.c
+++ b/src/modules/evas/engines/gl_x11/evas_x_main.c
@@ -632,6 +632,7 @@ try_gles2:
632 glXGetFBConfigAttrib(gw->disp, evis->config, GLX_FBCONFIG_ID, &gw->gl_context->glxcfg_rgb); 632 glXGetFBConfigAttrib(gw->disp, evis->config, GLX_FBCONFIG_ID, &gw->gl_context->glxcfg_rgb);
633 glXGetFBConfigAttrib(gw->disp, evis2->config, GLX_FBCONFIG_ID, &gw->gl_context->glxcfg_rgba); 633 glXGetFBConfigAttrib(gw->disp, evis2->config, GLX_FBCONFIG_ID, &gw->gl_context->glxcfg_rgba);
634#endif 634#endif
635 gw->gl_context->msaa = (Eina_Bool) msaa_bits;
635 eng_window_use(gw); 636 eng_window_use(gw);
636 glsym_evas_gl_common_context_resize(gw->gl_context, w, h, rot); 637 glsym_evas_gl_common_context_resize(gw->gl_context, w, h, rot);
637 gw->surf = 1; 638 gw->surf = 1;