jpeg pushed a commit to branch master.

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

commit c461c10ff8f09b63a1e0d3c51c7d6e65ff31a8fd
Author: Cedric BAIL <ced...@osg.samsung.com>
Date:   Mon Jan 4 01:10:53 2016 +0100

    evas: add a way to tests Ector_GL.
    
    This is completely not supported/working/useful yet. Please do not
    complain about it ruinning your life.
---
 src/modules/evas/engines/gl_generic/evas_engine.c | 115 +++++++++++++---------
 1 file changed, 69 insertions(+), 46 deletions(-)

diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c 
b/src/modules/evas/engines/gl_generic/evas_engine.c
index a052958..0a9e0bc 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -3,6 +3,7 @@
 
 #include "software/Ector_Software.h"
 #include "cairo/Ector_Cairo.h"
+#include "gl/Ector_GL.h"
 
 #if defined HAVE_DLSYM && ! defined _WIN32
 # include <dlfcn.h>      /* dlopen,dlclose,etc */
@@ -2431,7 +2432,8 @@ eng_texture_image_get(void *data EINA_UNUSED, void 
*texture)
    return e3d_texture_get((E3D_Texture *)texture);
 }
 
-static Eina_Bool use_cairo;
+static Eina_Bool use_cairo = EINA_FALSE;
+static Eina_Bool use_gl = EINA_FALSE;
 
 static Ector_Surface *
 eng_ector_create(void *data EINA_UNUSED)
@@ -2442,7 +2444,11 @@ eng_ector_create(void *data EINA_UNUSED)
    if (ector_backend && !strcasecmp(ector_backend, "default"))
      {
         ector = eo_add(ECTOR_SOFTWARE_SURFACE_CLASS, NULL);
-        use_cairo = EINA_FALSE;
+     }
+   else if (ector_backend && !strcasecmp(ector_backend, "experimental"))
+     {
+        ector = eo_add(ECTOR_GL_SURFACE_CLASS, NULL);
+        use_gl = EINA_TRUE;
      }
    else
      {
@@ -2596,35 +2602,44 @@ eng_ector_begin(void *data, void *context EINA_UNUSED, 
Ector_Surface *ector,
    evas_gl_common_context_target_surface_set(gl_context, surface);
    gl_context->dc = context;
 
-   w = gl_context->w; h = gl_context->h;
-
-   if (!buffer->gl || buffer->gl->w != w || buffer->gl->h != h)
+   if (use_cairo|| !use_gl)
      {
-        int err = EVAS_LOAD_ERROR_NONE;
-
-        if (buffer->gl) evas_gl_common_image_free(buffer->gl);
-        if (buffer->tofree) free(buffer->software);
-        buffer->software = NULL;
+        w = gl_context->w; h = gl_context->h;
 
-        buffer->gl = evas_gl_common_image_new(gl_context, w, h, 1, 
EVAS_COLORSPACE_ARGB8888);
-        if (!buffer->gl)
+        if (!buffer->gl || buffer->gl->w != w || buffer->gl->h != h)
           {
-             ERR("Creation of an image for vector graphics [%i, %i] failed\n", 
w, h);
-             return ;
-          }
-        /* evas_gl_common_image_content_hint_set(buffer->gl, 
EVAS_IMAGE_CONTENT_HINT_DYNAMIC); */
-        buffer->gl = eng_image_data_get(data, buffer->gl, 1, 
&buffer->software, &err, &buffer->tofree);
-        if (!buffer->gl && err != EVAS_LOAD_ERROR_NONE)
-          {
-             ERR("Mapping of an image for vector graphics [%i, %i] failed with 
%i\n", w, h, err);
-             return ;
+             int err = EVAS_LOAD_ERROR_NONE;
+
+             if (buffer->gl) evas_gl_common_image_free(buffer->gl);
+             if (buffer->tofree) free(buffer->software);
+             buffer->software = NULL;
+
+             buffer->gl = evas_gl_common_image_new(gl_context, w, h, 1, 
EVAS_COLORSPACE_ARGB8888);
+             if (!buffer->gl)
+               {
+                  ERR("Creation of an image for vector graphics [%i, %i] 
failed\n", w, h);
+                  return ;
+               }
+             /* evas_gl_common_image_content_hint_set(buffer->gl, 
EVAS_IMAGE_CONTENT_HINT_DYNAMIC); */
+             buffer->gl = eng_image_data_get(data, buffer->gl, 1, 
&buffer->software, &err, &buffer->tofree);
+             if (!buffer->gl && err != EVAS_LOAD_ERROR_NONE)
+               {
+                  ERR("Mapping of an image for vector graphics [%i, %i] failed 
with %i\n", w, h, err);
+                  return ;
+               }
           }
+        memset(buffer->software, 0, sizeof (unsigned int) * w * h);
+        eo_do(ector,
+              ector_buffer_pixels_set(buffer->software, w, h, 0, 
EFL_GFX_COLORSPACE_ARGB8888,
+                                      EINA_TRUE, 0, 0, 0, 0),
+              ector_surface_reference_point_set(x, y));
+     }
+   else
+     {
+        evas_gl_common_context_flush(gl_context);
+
+        eo_do(ector, ector_surface_reference_point_set(x, y));
      }
-   memset(buffer->software, 0, sizeof (unsigned int) * w * h);
-   eo_do(ector,
-         ector_buffer_pixels_set(buffer->software, w, h, 0, 
EFL_GFX_COLORSPACE_ARGB8888,
-                                 EINA_TRUE, 0, 0, 0, 0),
-         ector_surface_reference_point_set(x, y));
 }
 
 static void
@@ -2638,30 +2653,38 @@ eng_ector_end(void *data, void *context EINA_UNUSED, 
Ector_Surface *ector,
    int w, h;
    Eina_Bool mul_use;
 
-   gl_context = re->window_gl_context_get(re->software.ob);
-   w = gl_context->w; h = gl_context->h;
-   mul_use = gl_context->dc->mul.use;
+   if (use_cairo || !use_gl)
+     {
+        gl_context = re->window_gl_context_get(re->software.ob);
+        w = gl_context->w; h = gl_context->h;
+        mul_use = gl_context->dc->mul.use;
 
-   eo_do(ector, ector_buffer_pixels_set(NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0));
-   eng_image_data_put(data, buffer->gl, buffer->software);
+        eo_do(ector, ector_buffer_pixels_set(NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+        eng_image_data_put(data, buffer->gl, buffer->software);
 
-   if (!mul_use)
-     {
-        // @hack as image_draw uses below fields to do colour multiplication.
-        gl_context->dc->mul.col = ector_color_multiply(0xffffffff, 
gl_context->dc->col.col);
-        gl_context->dc->mul.use = EINA_TRUE;
-     }
+        if (!mul_use)
+          {
+             // @hack as image_draw uses below fields to do colour 
multiplication.
+             gl_context->dc->mul.col = ector_color_multiply(0xffffffff, 
gl_context->dc->col.col);
+             gl_context->dc->mul.use = EINA_TRUE;
+          }
 
-   // We actually just bluntly push the pixel all over the
-   // destination surface. We don't have the actual information
-   // of the widget size. This is not a problem.
-   // Later on, we don't want that information and today when
-   // using GL backend, you just need to turn on Evas_Map on
-   // the Evas_Object_VG.
-   evas_gl_common_image_draw(gl_context, buffer->gl, 0, 0, w, h, 0, 0, w, h, 
0);
+        // We actually just bluntly push the pixel all over the
+        // destination surface. We don't have the actual information
+        // of the widget size. This is not a problem.
+        // Later on, we don't want that information and today when
+        // using GL backend, you just need to turn on Evas_Map on
+        // the Evas_Object_VG.
+        evas_gl_common_image_draw(gl_context, buffer->gl, 0, 0, w, h, 0, 0, w, 
h, 0);
 
-   // restore gl state
-   gl_context->dc->mul.use = mul_use;
+        // restore gl state
+        gl_context->dc->mul.use = mul_use;
+     }
+   else if (use_gl)
+     {
+        // FIXME: Need to find a cleaner way to do so (maybe have a reset in 
evas_gl_context)
+        // Force a full pipe reinitialization for now
+     }
 }
 
 static Evas_Func func, pfunc;

-- 


Reply via email to