forked from enlightenment/efl
Evas GL: Fix internal function pointer
evas_gl_native_context_get is an internal function passed around from an evas engine to evas_gl so that we can implement evasglCreateImageForContext without exposing any evas engine internal structure to evas_gl. It's all a ittle bit ugly but the previous solution with dlsym(DEFAULT) didn't work.
This commit is contained in:
parent
c7e0c1b340
commit
b439fafa17
|
@ -326,6 +326,15 @@ evas_gl_surface_destroy(Evas_GL *evas_gl, Evas_GL_Surface *surf)
|
|||
surf = NULL;
|
||||
}
|
||||
|
||||
// Internal function - called from evas_gl_core.c
|
||||
static void *
|
||||
evas_gl_native_context_get(void *context)
|
||||
{
|
||||
Evas_GL_Context *ctx = context;
|
||||
if (!ctx) return NULL;
|
||||
return ctx->data;
|
||||
}
|
||||
|
||||
EAPI Evas_GL_Context *
|
||||
evas_gl_context_version_create(Evas_GL *evas_gl, Evas_GL_Context *share_ctx,
|
||||
Evas_GL_Context_Version version)
|
||||
|
@ -356,10 +365,9 @@ evas_gl_context_version_create(Evas_GL *evas_gl, Evas_GL_Context *share_ctx,
|
|||
|
||||
// Call engine->gl_create_context
|
||||
ctx->version = version;
|
||||
if (share_ctx)
|
||||
ctx->data = evas_gl->evas->engine.func->gl_context_create(evas_gl->evas->engine.data.output, share_ctx->data, version);
|
||||
else
|
||||
ctx->data = evas_gl->evas->engine.func->gl_context_create(evas_gl->evas->engine.data.output, NULL, version);
|
||||
ctx->data = evas_gl->evas->engine.func->gl_context_create
|
||||
(evas_gl->evas->engine.data.output, share_ctx ? share_ctx->data : NULL,
|
||||
version, &evas_gl_native_context_get);
|
||||
|
||||
// Set a few variables
|
||||
if (!ctx->data)
|
||||
|
@ -644,11 +652,3 @@ evas_gl_surface_query(Evas_GL *evas_gl, Evas_GL_Surface *surface, int attribute,
|
|||
return evas_gl->evas->engine.func->gl_surface_query
|
||||
(evas_gl->evas->engine.data.output, surface->data, attribute, value);
|
||||
}
|
||||
|
||||
// Internal function - called from evas_gl_core.c
|
||||
EAPI void *
|
||||
_evas_gl_native_context_get(Evas_GL_Context *ctx)
|
||||
{
|
||||
if (!ctx) return NULL;
|
||||
return ctx->data;
|
||||
}
|
||||
|
|
|
@ -1370,7 +1370,7 @@ struct _Evas_Func
|
|||
void *(*gl_surface_create) (void *data, void *config, int w, int h);
|
||||
void *(*gl_pbuffer_surface_create) (void *data, void *config, int w, int h, int const *attrib_list);
|
||||
int (*gl_surface_destroy) (void *data, void *surface);
|
||||
void *(*gl_context_create) (void *data, void *share_context, int version);
|
||||
void *(*gl_context_create) (void *data, void *share_context, int version, void *(*native_context_get)(void *ctx));
|
||||
int (*gl_context_destroy) (void *data, void *context);
|
||||
int (*gl_make_current) (void *data, void *surface, void *context);
|
||||
const char *(*gl_string_query) (void *data, int name);
|
||||
|
|
|
@ -1681,9 +1681,6 @@ evgl_engine_init(void *eng_data, const EVGL_Interface *efunc)
|
|||
}
|
||||
DBG("TLS KEY created: %d", evgl_engine->resource_key);
|
||||
|
||||
// Link to evas_gl.c (this doesn't look great)
|
||||
glsym_evas_gl_native_context_get = dlsym(RTLD_DEFAULT, "_evas_gl_native_context_get");
|
||||
|
||||
evgl_engine->safe_extensions = eina_hash_string_small_new(NULL);
|
||||
|
||||
// Surface Caps
|
||||
|
@ -2073,11 +2070,15 @@ evgl_surface_destroy(void *eng_data, EVGL_Surface *sfc)
|
|||
|
||||
void *
|
||||
evgl_context_create(void *eng_data, EVGL_Context *share_ctx,
|
||||
Evas_GL_Context_Version version)
|
||||
Evas_GL_Context_Version version,
|
||||
void *(*native_context_get)(void *))
|
||||
{
|
||||
EVGL_Context *ctx = NULL;
|
||||
EVGL_Resource *rsc = NULL;
|
||||
|
||||
// A little bit ugly. But it works even when dlsym(DEFAULT) doesn't work.
|
||||
glsym_evas_gl_native_context_get = native_context_get;
|
||||
|
||||
// Check the input
|
||||
if (!evgl_engine)
|
||||
{
|
||||
|
|
|
@ -58,7 +58,7 @@ EVGL_Engine *evgl_engine_init(void *eng_data, const EVGL_Interface *efunc);
|
|||
void *evgl_surface_create(void *eng_data, Evas_GL_Config *cfg, int w, int h);
|
||||
void *evgl_pbuffer_surface_create(void *eng_data, Evas_GL_Config *cfg, int w, int h, const int *attrib_list);
|
||||
int evgl_surface_destroy(void *eng_data, EVGL_Surface *sfc);
|
||||
void *evgl_context_create(void *eng_data, EVGL_Context *share_ctx, Evas_GL_Context_Version version);
|
||||
void *evgl_context_create(void *eng_data, EVGL_Context *share_ctx, Evas_GL_Context_Version version, void *(*native_context_get)(void *));
|
||||
int evgl_context_destroy(void *eng_data, EVGL_Context *ctx);
|
||||
int evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx);
|
||||
|
||||
|
|
|
@ -1423,12 +1423,13 @@ eng_gl_surface_destroy(void *data, void *surface)
|
|||
}
|
||||
|
||||
static void *
|
||||
eng_gl_context_create(void *data, void *share_context, int version)
|
||||
eng_gl_context_create(void *data, void *share_context, int version,
|
||||
void *(*native_context_get)(void *))
|
||||
{
|
||||
EVGL_Context *sctx = (EVGL_Context *)share_context;
|
||||
|
||||
EVGLINIT(data, NULL);
|
||||
return evgl_context_create(data, sctx, version);
|
||||
return evgl_context_create(data, sctx, version, native_context_get);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
@ -2937,8 +2937,8 @@ eng_gl_surface_destroy(void *data EINA_UNUSED, void *surface)
|
|||
}
|
||||
|
||||
static void *
|
||||
eng_gl_context_create(void *data EINA_UNUSED, void *share_context,
|
||||
int version)
|
||||
eng_gl_context_create(void *data EINA_UNUSED, void *share_context, int version,
|
||||
void *(*native_context_get)(void *) EINA_UNUSED)
|
||||
{
|
||||
#ifdef EVAS_GL
|
||||
Render_Engine_GL_Context *ctx;
|
||||
|
|
Loading…
Reference in New Issue