summaryrefslogtreecommitdiff
path: root/src/modules/evas/engines/gl_common/evas_gl_context.c
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 /src/modules/evas/engines/gl_common/evas_gl_context.c
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
Diffstat (limited to '')
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_context.c75
1 files changed, 37 insertions, 38 deletions
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 {