forked from enlightenment/efl
evas: provide GetProcAddress by the engine.
This commit is contained in:
parent
3636f5c9a8
commit
9a9d78dfcb
|
@ -750,6 +750,7 @@ EAPI int evas_gl_common_buffer_dump(Evas_Engine_GL_Context *gc, const c
|
|||
EAPI void evas_gl_preload_render_lock(evas_gl_make_current_cb make_current, void *engine_data);
|
||||
EAPI void evas_gl_preload_render_unlock(evas_gl_make_current_cb make_current, void *engine_data);
|
||||
EAPI void evas_gl_preload_render_relax(evas_gl_make_current_cb make_current, void *engine_data);
|
||||
EAPI void evas_gl_symbols(void *(*GetProcAddress)(const char *name));
|
||||
|
||||
typedef int (*Evas_GL_Preload)(void);
|
||||
typedef void (*Evas_GL_Common_Image_Call)(Evas_GL_Image *im);
|
||||
|
@ -759,6 +760,7 @@ typedef void (*Evas_GL_Preload_Render_Call)(evas_gl_make_current_cb make_current
|
|||
typedef Evas_Engine_GL_Context *(*Evas_GL_Common_Context_New)(void);
|
||||
typedef void (*Evas_GL_Common_Context_Resize_Call)(Evas_Engine_GL_Context *gc, int w, int h, int rot);
|
||||
typedef int (*Evas_GL_Common_Buffer_Dump_Call)(Evas_Engine_GL_Context *gc,const char* dname, const char* fname, int frame, const char* suffix);
|
||||
typedef void (*Evas_Gl_Symbols)(void *(*GetProcAddress)(const char *sym));
|
||||
|
||||
void glerr(int err, const char *file, const char *func, int line, const char *op);
|
||||
|
||||
|
|
|
@ -38,8 +38,6 @@ typedef _eng_fn (*glsym_func_eng_fn) ();
|
|||
typedef unsigned int (*secsym_func_uint) ();
|
||||
typedef void *(*secsym_func_void_ptr) ();
|
||||
|
||||
static _eng_fn (*glsym_eglGetProcAddress) (const char *a) = NULL;
|
||||
|
||||
void *(*secsym_eglCreateImage) (void *a, void *b, GLenum c, void *d, const int *e) = NULL;
|
||||
unsigned int (*secsym_eglDestroyImage) (void *a, void *b) = NULL;
|
||||
void (*secsym_glEGLImageTargetTexture2DOES) (int a, void *b) = NULL;
|
||||
|
@ -50,7 +48,6 @@ unsigned int (*secsym_eglGetImageAttribSEC) (void *a, void *b, int c,
|
|||
typedef void (*_eng_fn) (void);
|
||||
|
||||
typedef _eng_fn (*glsym_func_eng_fn) ();
|
||||
static _eng_fn (*glsym_glXGetProcAddress) (const char *a) = NULL;
|
||||
#endif
|
||||
|
||||
static int dbgflushnum = -1;
|
||||
|
@ -61,38 +58,18 @@ sym_missing(void)
|
|||
ERR("GL symbols missing!");
|
||||
}
|
||||
|
||||
static void
|
||||
gl_symbols(void)
|
||||
EAPI void
|
||||
evas_gl_symbols(void *(*GetProcAddress)(const char *name))
|
||||
{
|
||||
if (sym_done) return;
|
||||
sym_done = 1;
|
||||
|
||||
/* FIXME: If using the SDL engine, we should use SDL_GL_GetProcAddress
|
||||
* instead of dlsym
|
||||
* if (!dst) dst = (typ)SDL_GL_GetProcAddress(sym)
|
||||
*/
|
||||
#ifdef GL_GLES
|
||||
#define FINDSYM(dst, sym, typ) \
|
||||
if (glsym_eglGetProcAddress) { \
|
||||
if (!dst) dst = (typ)glsym_eglGetProcAddress(sym); \
|
||||
if (GetProcAddress) { \
|
||||
if (!dst) dst = (typ)GetProcAddress(sym); \
|
||||
} else { \
|
||||
if (!dst) dst = (typ)dlsym(RTLD_DEFAULT, sym); \
|
||||
}
|
||||
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddressKHR", glsym_func_eng_fn);
|
||||
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddressEXT", glsym_func_eng_fn);
|
||||
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddressARB", glsym_func_eng_fn);
|
||||
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddress", glsym_func_eng_fn);
|
||||
#else
|
||||
#define FINDSYM(dst, sym, typ) \
|
||||
if (glsym_glXGetProcAddress) { \
|
||||
if (!dst) dst = (typ)glsym_glXGetProcAddress(sym); \
|
||||
} else { \
|
||||
if (!dst) dst = (typ)dlsym(RTLD_DEFAULT, sym); \
|
||||
}
|
||||
FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddressEXT", glsym_func_eng_fn);
|
||||
FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddressARB", glsym_func_eng_fn);
|
||||
FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddress", glsym_func_eng_fn);
|
||||
#endif
|
||||
#define FINDSYM2(dst, sym, typ) if (!dst) dst = (typ)dlsym(RTLD_DEFAULT, sym)
|
||||
#define FALLBAK(dst, typ) if (!dst) dst = (typ)sym_missing
|
||||
|
||||
|
@ -565,8 +542,6 @@ evas_gl_common_context_new(void)
|
|||
gc = calloc(1, sizeof(Evas_Engine_GL_Context));
|
||||
if (!gc) return NULL;
|
||||
|
||||
gl_symbols();
|
||||
|
||||
gc->references = 1;
|
||||
|
||||
_evas_gl_common_context = gc;
|
||||
|
|
|
@ -61,6 +61,7 @@ Evas_GL_Common_Context_Call glsym_evas_gl_common_image_all_unload = NULL;
|
|||
Evas_GL_Preload glsym_evas_gl_preload_init = NULL;
|
||||
Evas_GL_Preload glsym_evas_gl_preload_shutdown = NULL;
|
||||
EVGL_Engine_Call glsym_evgl_engine_shutdown = NULL;
|
||||
Evas_Gl_Symbols glsym_evas_gl_symbols = NULL;
|
||||
|
||||
Evas_GL_Common_Context_New glsym_evas_gl_common_context_new = NULL;
|
||||
Evas_GL_Common_Context_Call glsym_evas_gl_common_context_flush = NULL;
|
||||
|
@ -629,6 +630,7 @@ gl_symbols(void)
|
|||
LINK2GENERIC(evas_gl_preload_init);
|
||||
LINK2GENERIC(evas_gl_preload_shutdown);
|
||||
LINK2GENERIC(evgl_engine_shutdown);
|
||||
LINK2GENERIC(evas_gl_symbols);
|
||||
|
||||
#ifdef GL_GLES
|
||||
#define FINDSYM(dst, sym, typ) \
|
||||
|
@ -643,6 +645,8 @@ gl_symbols(void)
|
|||
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddressARB", glsym_func_eng_fn);
|
||||
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddress", glsym_func_eng_fn);
|
||||
|
||||
glsym_evas_gl_symbols((void*)glsym_eglGetProcAddress);
|
||||
|
||||
FINDSYM(glsym_eglCreateImage, "eglCreateImageKHR", glsym_func_void_ptr);
|
||||
FINDSYM(glsym_eglCreateImage, "eglCreateImageEXT", glsym_func_void_ptr);
|
||||
FINDSYM(glsym_eglCreateImage, "eglCreateImageARB", glsym_func_void_ptr);
|
||||
|
@ -672,6 +676,8 @@ gl_symbols(void)
|
|||
FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddressARB", glsym_func_eng_fn);
|
||||
FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddress", glsym_func_eng_fn);
|
||||
|
||||
glsym_evas_gl_symbols((void*)glsym_glXGetProcAddress);
|
||||
|
||||
FINDSYM(glsym_glXBindTexImage, "glXBindTexImageEXT", glsym_func_void);
|
||||
FINDSYM(glsym_glXBindTexImage, "glXBindTexImageARB", glsym_func_void);
|
||||
FINDSYM(glsym_glXBindTexImage, "glXBindTexImage", glsym_func_void);
|
||||
|
@ -958,8 +964,6 @@ eng_setup(Evas *eo_e, void *in)
|
|||
|
||||
if (!initted)
|
||||
{
|
||||
gl_symbols();
|
||||
|
||||
evas_common_cpu_init();
|
||||
evas_common_blend_init();
|
||||
evas_common_image_init();
|
||||
|
@ -1846,7 +1850,6 @@ module_open(Evas_Module *em)
|
|||
xrm_inited = EINA_TRUE;
|
||||
XrmInitialize();
|
||||
}
|
||||
|
||||
if (!em) return 0;
|
||||
/* get whatever engine module we inherit from */
|
||||
if (!_evas_module_engine_inherit(&pfunc, "gl_generic")) return 0;
|
||||
|
@ -1878,6 +1881,8 @@ module_open(Evas_Module *em)
|
|||
|
||||
ORD(image_native_set);
|
||||
|
||||
gl_symbols();
|
||||
|
||||
/* now advertise out own api */
|
||||
em->functions = (void *)(&func);
|
||||
return 1;
|
||||
|
|
Loading…
Reference in New Issue