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.
This commit is contained in:
Cedric BAIL 2016-01-04 01:10:53 +01:00 committed by Jean-Philippe Andre
parent fc40f905eb
commit c461c10ff8
1 changed files with 71 additions and 48 deletions

View File

@ -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,6 +2602,8 @@ 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;
if (use_cairo|| !use_gl)
{
w = gl_context->w; h = gl_context->h;
if (!buffer->gl || buffer->gl->w != w || buffer->gl->h != h)
@ -2626,6 +2634,13 @@ eng_ector_begin(void *data, void *context EINA_UNUSED, Ector_Surface *ector,
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));
}
}
static void
eng_ector_end(void *data, void *context EINA_UNUSED, Ector_Surface *ector,
@ -2638,6 +2653,8 @@ eng_ector_end(void *data, void *context EINA_UNUSED, Ector_Surface *ector,
int w, h;
Eina_Bool 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;
@ -2663,6 +2680,12 @@ eng_ector_end(void *data, void *context EINA_UNUSED, Ector_Surface *ector,
// 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;