forked from enlightenment/efl
Small adjustment to gl engines to use procaddress if found and NOT
fall back to dlsym if such a "getprocaddress" is around.
This commit is contained in:
parent
a7425900e1
commit
4eed45ae88
|
@ -122,12 +122,14 @@ evgl_api_ext_init(void *getproc, const char *glueexts)
|
||||||
|
|
||||||
fp_getproc gp = (fp_getproc)getproc;
|
fp_getproc gp = (fp_getproc)getproc;
|
||||||
|
|
||||||
memset(_gl_ext_string, 0x00, MAX_EXTENSION_STRING_BUFFER);
|
memset(_gl_ext_string, 0x00, MAX_EXTENSION_STRING_BUFFER);
|
||||||
|
|
||||||
|
|
||||||
#define FINDSYM(getproc, dst, sym) \
|
#define FINDSYM(getproc, dst, sym) \
|
||||||
if ((!dst) && (getproc)) dst = (__typeof__(dst))getproc(sym); \
|
if (getproc) { \
|
||||||
if (!dst) dst = (__typeof__(dst))dlsym(RTLD_DEFAULT, sym);
|
if (!dst) dst = (__typeof__(dst))getproc(sym); \
|
||||||
|
} else { \
|
||||||
|
if (!dst) dst = (__typeof__(dst))dlsym(RTLD_DEFAULT, sym); \
|
||||||
|
}
|
||||||
|
|
||||||
// GLES Extensions
|
// GLES Extensions
|
||||||
glexts = (const char*)glGetString(GL_EXTENSIONS);
|
glexts = (const char*)glGetString(GL_EXTENSIONS);
|
||||||
|
|
|
@ -31,11 +31,11 @@ GLboolean (*glsym_glUnmapBuffer) (GLenum a) = NULL;
|
||||||
// just used for finding symbols :)
|
// just used for finding symbols :)
|
||||||
typedef void (*_eng_fn) (void);
|
typedef void (*_eng_fn) (void);
|
||||||
|
|
||||||
typedef _eng_fn (*secsym_func_eng_fn) ();
|
typedef _eng_fn (*glsym_func_eng_fn) ();
|
||||||
typedef unsigned int (*secsym_func_uint) ();
|
typedef unsigned int (*secsym_func_uint) ();
|
||||||
typedef void *(*secsym_func_void_ptr) ();
|
typedef void *(*secsym_func_void_ptr) ();
|
||||||
|
|
||||||
static _eng_fn (*secsym_eglGetProcAddress) (const char *a) = NULL;
|
static _eng_fn (*glsym_eglGetProcAddress) (const char *a) = NULL;
|
||||||
|
|
||||||
void *(*secsym_eglCreateImage) (void *a, void *b, GLenum c, void *d, const int *e) = 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;
|
unsigned int (*secsym_eglDestroyImage) (void *a, void *b) = NULL;
|
||||||
|
@ -43,6 +43,11 @@ void (*secsym_glEGLImageTargetTexture2DOES) (int a, void *b) = NULL;
|
||||||
void *(*secsym_eglMapImageSEC) (void *a, void *b) = NULL;
|
void *(*secsym_eglMapImageSEC) (void *a, void *b) = NULL;
|
||||||
unsigned int (*secsym_eglUnmapImageSEC) (void *a, void *b) = NULL;
|
unsigned int (*secsym_eglUnmapImageSEC) (void *a, void *b) = NULL;
|
||||||
unsigned int (*secsym_eglGetImageAttribSEC) (void *a, void *b, int c, int *d) = NULL;
|
unsigned int (*secsym_eglGetImageAttribSEC) (void *a, void *b, int c, int *d) = NULL;
|
||||||
|
#else
|
||||||
|
typedef void (*_eng_fn) (void);
|
||||||
|
|
||||||
|
typedef _eng_fn (*glsym_func_eng_fn) ();
|
||||||
|
static _eng_fn (*glsym_glXGetProcAddress) (const char *a) = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int dbgflushnum = -1;
|
static int dbgflushnum = -1;
|
||||||
|
@ -63,7 +68,28 @@ gl_symbols(void)
|
||||||
* instead of dlsym
|
* instead of dlsym
|
||||||
* if (!dst) dst = (typ)SDL_GL_GetProcAddress(sym)
|
* if (!dst) dst = (typ)SDL_GL_GetProcAddress(sym)
|
||||||
*/
|
*/
|
||||||
#define FINDSYM(dst, sym, typ) if (!dst) dst = (typ)dlsym(RTLD_DEFAULT, sym)
|
#ifdef GL_GLES
|
||||||
|
#define FINDSYM(dst, sym, typ) \
|
||||||
|
if (glsym_eglGetProcAddress) { \
|
||||||
|
if (!dst) dst = (typ)glsym_eglGetProcAddress(sym); \
|
||||||
|
} else { \
|
||||||
|
if (!dst) dst = (typ)dlsym(RTLD_DEFAULT, sym); \
|
||||||
|
}
|
||||||
|
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddress", glsym_func_eng_fn);
|
||||||
|
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddressEXT", glsym_func_eng_fn);
|
||||||
|
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddressARB", glsym_func_eng_fn);
|
||||||
|
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddressKHR", 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, "glXGetProcAddress", glsym_func_eng_fn);
|
||||||
|
FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddressEXT", glsym_func_eng_fn);
|
||||||
|
FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddressARB", glsym_func_eng_fn);
|
||||||
|
#endif
|
||||||
#define FALLBAK(dst, typ) if (!dst) dst = (typ)sym_missing;
|
#define FALLBAK(dst, typ) if (!dst) dst = (typ)sym_missing;
|
||||||
|
|
||||||
FINDSYM(glsym_glGenFramebuffers, "glGenFramebuffers", glsym_func_void);
|
FINDSYM(glsym_glGenFramebuffers, "glGenFramebuffers", glsym_func_void);
|
||||||
|
@ -119,21 +145,12 @@ gl_symbols(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GL_GLES
|
#ifdef GL_GLES
|
||||||
#undef FINDSYM
|
|
||||||
#define FINDSYM(dst, sym, typ) \
|
|
||||||
if ((!dst) && (secsym_eglGetProcAddress)) dst = (typ)secsym_eglGetProcAddress(sym); \
|
|
||||||
if (!dst) dst = (typ)dlsym(RTLD_DEFAULT, sym)
|
|
||||||
// yes - gl core looking for egl stuff. i know it's odd. a reverse-layer thing
|
// yes - gl core looking for egl stuff. i know it's odd. a reverse-layer thing
|
||||||
// but it will work as the egl/glx layer calls gl core common stuff and thus
|
// but it will work as the egl/glx layer calls gl core common stuff and thus
|
||||||
// these symbols will work. making the glx/egl + x11 layer do this kind-of is
|
// these symbols will work. making the glx/egl + x11 layer do this kind-of is
|
||||||
// wrong as this is not x11 (output) layer specific like the native surface
|
// wrong as this is not x11 (output) layer specific like the native surface
|
||||||
// stuff. this is generic zero-copy textures for gl
|
// stuff. this is generic zero-copy textures for gl
|
||||||
|
|
||||||
FINDSYM(secsym_eglGetProcAddress, "eglGetProcAddress", secsym_func_eng_fn);
|
|
||||||
FINDSYM(secsym_eglGetProcAddress, "eglGetProcAddressEXT", secsym_func_eng_fn);
|
|
||||||
FINDSYM(secsym_eglGetProcAddress, "eglGetProcAddressARB", secsym_func_eng_fn);
|
|
||||||
FINDSYM(secsym_eglGetProcAddress, "eglGetProcAddressKHR", secsym_func_eng_fn);
|
|
||||||
|
|
||||||
FINDSYM(secsym_eglCreateImage, "eglCreateImage", secsym_func_void_ptr);
|
FINDSYM(secsym_eglCreateImage, "eglCreateImage", secsym_func_void_ptr);
|
||||||
FINDSYM(secsym_eglCreateImage, "eglCreateImageEXT", secsym_func_void_ptr);
|
FINDSYM(secsym_eglCreateImage, "eglCreateImageEXT", secsym_func_void_ptr);
|
||||||
FINDSYM(secsym_eglCreateImage, "eglCreateImageARB", secsym_func_void_ptr);
|
FINDSYM(secsym_eglCreateImage, "eglCreateImageARB", secsym_func_void_ptr);
|
||||||
|
|
|
@ -520,8 +520,11 @@ gl_symbols(void)
|
||||||
|
|
||||||
#ifdef GL_GLES
|
#ifdef GL_GLES
|
||||||
#define FINDSYM(dst, sym, typ) \
|
#define FINDSYM(dst, sym, typ) \
|
||||||
if ((!dst) && (glsym_eglGetProcAddress)) dst = (typ)glsym_eglGetProcAddress(sym); \
|
if (glsym_eglGetProcAddress) { \
|
||||||
if (!dst) dst = (typ)dlsym(RTLD_DEFAULT, sym)
|
if (!dst) dst = (typ)glsym_eglGetProcAddress(sym); \
|
||||||
|
} else { \
|
||||||
|
if (!dst) dst = (typ)dlsym(RTLD_DEFAULT, sym); \
|
||||||
|
}
|
||||||
|
|
||||||
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddress", glsym_func_eng_fn);
|
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddress", glsym_func_eng_fn);
|
||||||
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddressEXT", glsym_func_eng_fn);
|
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddressEXT", glsym_func_eng_fn);
|
||||||
|
@ -546,8 +549,11 @@ gl_symbols(void)
|
||||||
FINDSYM(glsym_eglQueryString, "eglQueryString", glsym_func_const_char_ptr);
|
FINDSYM(glsym_eglQueryString, "eglQueryString", glsym_func_const_char_ptr);
|
||||||
#else
|
#else
|
||||||
#define FINDSYM(dst, sym, typ) \
|
#define FINDSYM(dst, sym, typ) \
|
||||||
if ((!dst) && (glsym_glXGetProcAddress)) dst = (typ)glsym_glXGetProcAddress(sym); \
|
if (glsym_glXGetProcAddress) { \
|
||||||
if (!dst) dst = (typ)dlsym(RTLD_DEFAULT, sym)
|
if (!dst) dst = (typ)glsym_glXGetProcAddress(sym); \
|
||||||
|
} else { \
|
||||||
|
if (!dst) dst = (typ)dlsym(RTLD_DEFAULT, sym); \
|
||||||
|
}
|
||||||
|
|
||||||
FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddress", glsym_func_eng_fn);
|
FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddress", glsym_func_eng_fn);
|
||||||
FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddressEXT", glsym_func_eng_fn);
|
FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddressEXT", glsym_func_eng_fn);
|
||||||
|
|
|
@ -274,8 +274,11 @@ _sym_init(void)
|
||||||
if (done) return;
|
if (done) return;
|
||||||
|
|
||||||
#define FINDSYM(dst, sym, typ) \
|
#define FINDSYM(dst, sym, typ) \
|
||||||
if ((!dst) && (glsym_eglGetProcAddress)) dst = (typ)glsym_eglGetProcAddress(sym); \
|
if (glsym_eglGetProcAddress) { \
|
||||||
if (!dst) dst = (typ)dlsym(RTLD_DEFAULT, sym)
|
if (!dst) dst = (typ)glsym_eglGetProcAddress(sym); \
|
||||||
|
} else { \
|
||||||
|
if (!dst) dst = (typ)dlsym(RTLD_DEFAULT, sym); \
|
||||||
|
}
|
||||||
|
|
||||||
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddress", glsym_func_eng_fn);
|
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddress", glsym_func_eng_fn);
|
||||||
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddressEXT", glsym_func_eng_fn);
|
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddressEXT", glsym_func_eng_fn);
|
||||||
|
|
Loading…
Reference in New Issue