The version field was not properly set for GLES 1 and 3 (but not tested),
double free() could happen on the API structs, and empty API structs
could be returned.
From
cc4b54ec0a69c43f5163addbb6a4f4a6615cb8c0 Mon Sep 17 00:00:00 2001
From: Jean-Philippe Andre <jp.andre@samsung.com>
Change-Id: Ic4944f5b87743fd0e4f2a8a37a87a4e3df69dd5e
static void
_normal_gles3_api_get(Evas_GL_API *funcs)
{
+ if (!funcs) return;
+ funcs->version = EVAS_GL_API_VERSION;
+
#define ORD(f) EVAS_API_OVERRIDE(f, funcs, evgl_)
// GLES 3.0 APIs that are same as GLES 2.0
ORD(glActiveTexture);
static void
_debug_gles3_api_get(Evas_GL_API *funcs)
{
+ if (!funcs) return;
+ funcs->version = EVAS_GL_API_VERSION;
#define ORD(f) EVAS_API_OVERRIDE(f, funcs, _evgld_)
// GLES 3.0 APIs that are same as GLES 2.0
_debug_gles1_api_get(Evas_GL_API *funcs)
{
if (!funcs) return;
+ funcs->version = EVAS_GL_API_VERSION;
#define ORD(name) EVAS_API_OVERRIDE(name, funcs, _evgld_gles1_)
/* Available only in Common profile */
_normal_gles1_api_get(Evas_GL_API *funcs)
{
if (!funcs) return;
+ funcs->version = EVAS_GL_API_VERSION;
#define ORD(name) EVAS_API_OVERRIDE(name, funcs, _evgl_gles1_)
/* Available only in Common profile */
if (gles1_funcs) free(gles1_funcs);
if (gles2_funcs) free(gles2_funcs);
if (gles3_funcs) free(gles3_funcs);
+ gles1_funcs = NULL;
+ gles2_funcs = NULL;
+ gles3_funcs = NULL;
// Destroy internal resources
_evgl_tls_resource_destroy(eng_data);
api = gles3_funcs;
}
else return NULL;
- if (alloc_only) return api;
+ if (alloc_only && (api->version == EVAS_GL_API_VERSION))
+ return api;
#ifdef GL_GLES
if (!evgl_api_egl_ext_init(evgl_engine->funcs->proc_address_get, evgl_engine->funcs->ext_string_get(eng_data)))
/* static void (*_sym_glGetProgramBinary) (GLuint a, GLsizei b, GLsizei* c, GLenum* d, void* e) = NULL; */
/* static void (*_sym_glProgramBinary) (GLuint a, GLenum b, const void* c, GLint d) = NULL; */
/* static void (*_sym_glProgramParameteri) (GLuint a, GLuint b, GLint d) = NULL; */
+
+static int gl_lib_init(void);
#endif
// Threaded Render
Render_Engine_GL_Context *ctx;
Render_Engine_GL_Context *share_ctx;
+ if (!_tls_check() && !gl_lib_init())
+ {
+ WRN("Failed to initialize Evas GL (with OSMesa)");
+ return NULL;
+ }
+
if (version != EVAS_GL_GLES_2_X)
{
ERR("This engine only supports OpenGL-ES 2.0 contexts for now!");
return NULL;
#ifdef EVAS_GL
+ if (!_tls_init)
+ gl_lib_init();
+
return &gl_funcs;
#else
return NULL;
static void
override_gl_apis(Evas_GL_API *api)
{
- memset(&gl_funcs, 0, sizeof(gl_funcs));
+ memset(api, 0, sizeof(*api));
api->version = EVAS_GL_API_VERSION;
#define ORD(f) EVAS_API_OVERRIDE(f, api, _sym_)