summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-11-06 14:53:33 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-11-06 17:16:28 +0900
commitb78c218522ac14166ee8e077e596e7032747ddb0 (patch)
tree61127c82c9c8c084e914edc05a25b66bd5fdfeed
parentf113f333be5db491262ebcabc609a1d901636a57 (diff)
downloadefl-b78c218522ac14166ee8e077e596e7032747ddb0.tar.gz
Evas GL: Release shader compiler during evas_render_idle_flush
It is safe to release the compiler at any time since the next call to glCompileShader will restore it. This may even be a no-op for all we know (this is driver-dependent).
-rw-r--r--src/modules/evas/engines/gl_cocoa/evas_engine.c5
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_common.h2
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_context.c1
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_shader.c11
-rw-r--r--src/modules/evas/engines/gl_x11/evas_engine.c15
5 files changed, 20 insertions, 14 deletions
diff --git a/src/modules/evas/engines/gl_cocoa/evas_engine.c b/src/modules/evas/engines/gl_cocoa/evas_engine.c
index 00e670ac22..a354655da3 100644
--- a/src/modules/evas/engines/gl_cocoa/evas_engine.c
+++ b/src/modules/evas/engines/gl_cocoa/evas_engine.c
@@ -309,11 +309,6 @@ eng_output_flush(void *data, Evas_Render_Mode render_mode)
}
static void
-eng_output_idle_flush(void *data EINA_UNUSED)
-{
-}
-
-static void
eng_context_cutout_add(void *data EINA_UNUSED, void *context, int x, int y, int w, int h)
{
evas_common_draw_context_add_cutout(context, x, y, w, h);
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 c1435843c3..118bf9f5e3 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_common.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_common.h
@@ -593,8 +593,8 @@ void evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *g
Evas_Colorspace cspace);
int evas_gl_common_shader_program_init(Evas_GL_Shared *shared);
-void evas_gl_common_shader_program_init_done(void);
void evas_gl_common_shader_program_shutdown(Evas_GL_Shared *shared);
+EAPI void evas_gl_common_shaders_flush(void);
Evas_GL_Program *evas_gl_common_shader_program_get(Evas_Engine_GL_Context *gc,
Shader_Type type,
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 58ec6fe173..d39be5ae77 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_context.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_context.c
@@ -933,7 +933,6 @@ evas_gl_common_context_new(void)
if (gc->state.current.prog)
glUseProgram(gc->state.current.prog->prog);
- evas_gl_common_shader_program_init_done();
// in shader:
// uniform sampler2D tex[8];
//
diff --git a/src/modules/evas/engines/gl_common/evas_gl_shader.c b/src/modules/evas/engines/gl_common/evas_gl_shader.c
index 1d6484cea0..e45110b8d0 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_shader.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_shader.c
@@ -60,6 +60,8 @@ static const char *_shader_flags[SHADER_FLAG_COUNT] = {
"RGB_A_PAIR"
};
+static Eina_Bool compiler_released = EINA_FALSE;
+
static inline unsigned int
evas_gl_common_shader_flags_get(Evas_GL_Shared *shared, Shader_Type type,
RGBA_Map_Point *map_points, int npoints,
@@ -373,11 +375,11 @@ evas_gl_common_shader_program_init(Evas_GL_Shared *shared)
return 1;
}
-void
-evas_gl_common_shader_program_init_done(void)
+EAPI void
+evas_gl_common_shaders_flush(void)
{
-#warning FIXME: Disabled compiler unload for now.
- return;
+ if (compiler_released) return;
+ compiler_released = EINA_TRUE;
#ifdef GL_GLES
glReleaseShaderCompiler();
#else
@@ -560,6 +562,7 @@ evas_gl_common_shader_compile(unsigned int flags, const char *vertex,
GLuint vtx, frg, prg;
GLint ok = 0;
+ compiler_released = EINA_FALSE;
vtx = glCreateShader(GL_VERTEX_SHADER);
frg = glCreateShader(GL_FRAGMENT_SHADER);
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c b/src/modules/evas/engines/gl_x11/evas_engine.c
index 7713c210ab..d0a7de7b30 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -71,6 +71,7 @@ Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_lock = NULL;
Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_unlock = NULL;
Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_relax = NULL;
+glsym_func_void glsym_evas_gl_common_shaders_flush = NULL;
glsym_func_void glsym_evas_gl_common_error_set = NULL;
glsym_func_int glsym_evas_gl_common_error_get = NULL;
glsym_func_void_ptr glsym_evas_gl_common_current_context_get = NULL;
@@ -1200,7 +1201,8 @@ gl_symbols(void)
if (done) return;
#define LINK2GENERIC(sym) \
- glsym_##sym = dlsym(RTLD_DEFAULT, #sym);
+ glsym_##sym = dlsym(RTLD_DEFAULT, #sym); \
+ if (!glsym_##sym) ERR("Could not find function '%s'", #sym);
// Get function pointer to evas_gl_common that is now provided through the link of GL_Generic.
LINK2GENERIC(evas_gl_common_image_all_unload);
@@ -1232,7 +1234,7 @@ gl_symbols(void)
LINK2GENERIC(evas_gl_common_error_set);
LINK2GENERIC(evas_gl_common_current_context_get);
LINK2GENERIC(evas_gl_context_restore_set);
-
+ LINK2GENERIC(evas_gl_common_shaders_flush);
#ifdef GL_GLES
#define FINDSYM(dst, sym, typ) \
@@ -1485,6 +1487,13 @@ eng_info_free(Evas *eo_e EINA_UNUSED, void *info)
}
static void
+eng_outbuf_idle_flush(Outbuf *ob EINA_UNUSED)
+{
+ if (glsym_evas_gl_common_shaders_flush)
+ glsym_evas_gl_common_shaders_flush();
+}
+
+static void
_re_winfree(Render_Engine *re)
{
if (!eng_get_ob(re)->surf) return;
@@ -1632,7 +1641,7 @@ eng_setup(Evas *eo_e, void *in)
eng_outbuf_new_region_for_update,
eng_outbuf_push_updated_region,
eng_outbuf_push_free_region_for_update,
- NULL,
+ eng_outbuf_idle_flush,
eng_outbuf_flush,
eng_window_free,
eng_window_use,