hermet pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=3856e1a0026ff2c917b963051949a528db179d13

commit 3856e1a0026ff2c917b963051949a528db179d13
Author: Hermet Park <[email protected]>
Date:   Thu Apr 18 20:08:16 2019 +0900

    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
---
 .../evas/engines/gl_common/evas_gl_common.h        |  7 +-
 .../evas/engines/gl_common/evas_gl_context.c       | 75 +++++++++++-----------
 src/modules/evas/engines/gl_generic/evas_engine.c  |  7 +-
 src/modules/evas/engines/gl_x11/evas_x_main.c      |  1 +
 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
       Eina_Bool          size       : 1;
    } change;
 
-   Eina_Bool             havestuff  : 1;
-
    struct {
       struct {
          int              x, y, w, h;
@@ -335,7 +333,7 @@ struct _Evas_Engine_GL_Context
       } shader;
       struct {
          int            num, alloc;
-         GLshort       *vertex;
+         GLfloat       *vertex;
          GLubyte       *color;
          GLfloat       *texuv;
          GLfloat       *texuv2;
@@ -380,6 +378,9 @@ struct _Evas_Engine_GL_Context
 
    GLuint preserve_bit;
    int    gles_version;
+
+   Eina_Bool havestuff : 1;
+   Eina_Bool msaa : 1;
 };
 
 struct _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)
       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..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)
 }
 
 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;
@@ -1239,7 +1240,8 @@ eng_image_map_draw(void *engine, void *data, void 
*context, void *surface, void
    evas_gl_common_context_target_surface_set(gl_context, surface);
    gl_context->dc = context;
 
-   if ((m->pts[0].x == m->pts[3].x) &&
+   if (!gl_context->msaa &&
+       (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) &&
@@ -1259,7 +1261,6 @@ eng_image_map_draw(void *engine, void *data, void 
*context, void *surface, void
        (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;
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:
    glXGetFBConfigAttrib(gw->disp, evis->config, GLX_FBCONFIG_ID, 
&gw->gl_context->glxcfg_rgb);
    glXGetFBConfigAttrib(gw->disp, evis2->config, GLX_FBCONFIG_ID, 
&gw->gl_context->glxcfg_rgba);
 #endif
+   gw->gl_context->msaa = (Eina_Bool) msaa_bits;
    eng_window_use(gw);
    glsym_evas_gl_common_context_resize(gw->gl_context, w, h, rot);
    gw->surf = 1;

-- 


Reply via email to