jpeg pushed a commit to branch efl-1.12. http://git.enlightenment.org/core/efl.git/commit/?id=4a5f8d6ac9746ef0c237242619e95aa233af2373
commit 4a5f8d6ac9746ef0c237242619e95aa233af2373 Author: Jean-Philippe Andre <jp.an...@samsung.com> Date: Wed Dec 3 11:44:09 2014 +0900 Evas GL: Add preventive padding after Evas_GL_API Since this struct is likely to grow in size over time, client apps built against future versions of EFL might start indexing fields that are not present in the current form. Also, don't reset the struct memory as this would break multithreaded GL applications. While this is not exactly a fix, I'll backport this. @fix --- src/modules/evas/engines/gl_common/evas_gl_api.c | 2 -- .../evas/engines/gl_common/evas_gl_api_gles1.c | 2 -- src/modules/evas/engines/gl_common/evas_gl_core.c | 19 +++++++++++-------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/modules/evas/engines/gl_common/evas_gl_api.c b/src/modules/evas/engines/gl_common/evas_gl_api.c index 477e831..2bf6485 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_api.c +++ b/src/modules/evas/engines/gl_common/evas_gl_api.c @@ -2767,8 +2767,6 @@ _debug_gl_api_get(Evas_GL_API *funcs) void _evgl_api_get(Evas_GL_API *funcs, int debug) { - memset(funcs, 0, sizeof(Evas_GL_API)); - if (debug) _debug_gl_api_get(funcs); else diff --git a/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c b/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c index f03d731..0363bec 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c +++ b/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c @@ -4263,8 +4263,6 @@ _normal_gles1_api_get(Evas_GL_API *funcs) void _evgl_api_gles1_get(Evas_GL_API *funcs, Eina_Bool debug) { - memset(funcs, 0, sizeof(Evas_GL_API)); - if (!_evgl_gles1_api_init()) return; diff --git a/src/modules/evas/engines/gl_common/evas_gl_core.c b/src/modules/evas/engines/gl_common/evas_gl_core.c index fb56d00..7956a1e 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_core.c +++ b/src/modules/evas/engines/gl_common/evas_gl_core.c @@ -8,9 +8,11 @@ typedef struct _GL_Format GLenum fmt; } GL_Format; -// Globals -static Evas_GL_API gl_funcs; -static Evas_GL_API gles1_funcs; +// Extended struct size based on the 314 functions found in gl31.h +#define EVAS_GL_API_STRUCT_SIZE (sizeof(Evas_GL_API) + 300 * sizeof(void*)) +static Evas_GL_API *gl_funcs = NULL; +static Evas_GL_API *gles1_funcs = NULL; + EVGL_Engine *evgl_engine = NULL; int _evas_gl_log_dom = -1; int _evas_gl_log_level = -1; @@ -1450,7 +1452,8 @@ evgl_engine_init(void *eng_data, const EVGL_Interface *efunc) evgl_engine->main_tid = 0; // Clear Function Pointers - memset(&gl_funcs, 0, sizeof(Evas_GL_API)); + if (!gl_funcs) gl_funcs = calloc(1, EVAS_GL_API_STRUCT_SIZE); + if (!gles1_funcs) gles1_funcs = calloc(1, EVAS_GL_API_STRUCT_SIZE); return evgl_engine; @@ -2309,13 +2312,13 @@ evgl_api_get(Evas_GL_Context_Version version) { if (version == EVAS_GL_GLES_2_X) { - _evgl_api_get(&gl_funcs, evgl_engine->api_debug_mode); - return &gl_funcs; + _evgl_api_get(gl_funcs, evgl_engine->api_debug_mode); + return gl_funcs; } else if (version == EVAS_GL_GLES_1_X) { - _evgl_api_gles1_get(&gles1_funcs, evgl_engine->api_debug_mode); - return &gles1_funcs; + _evgl_api_gles1_get(gles1_funcs, evgl_engine->api_debug_mode); + return gles1_funcs; } else return NULL; } --