4 # include <EGL/eglplatform.h>
5 # include "../headers/egl.h"
7 typedef void (*_eng_fn) (void);
9 ///////////////////////////////////////
10 // Disable dlog for debugging urgent issues //
11 //#define LOG_TAG "CoreGL_EGL"
13 #define LOGE(...) fprintf(stderr, __VA_ARGS__)
14 #define LOGW(...) fprintf(stderr, __VA_ARGS__)
15 #define LOGD(...) fprintf(stderr, __VA_ARGS__)
16 ///////////////////////////////////////
18 #define COREGL_API __attribute__((visibility("default")))
20 #define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST) COREGL_API extern RET_TYPE FUNC_NAME PARAM_LIST;
21 #define _COREGL_EXT_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)
22 # include "../headers/sym_egl.h"
23 #undef _COREGL_EXT_SYMBOL
26 #define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST) RET_TYPE (*ovr_##FUNC_NAME) PARAM_LIST = NULL;
27 #define _COREGL_EXT_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)
28 # include "../headers/sym_egl.h"
29 #undef _COREGL_EXT_SYMBOL
34 void *lib_handle = NULL;
36 __attribute__((constructor))
40 lib_handle = dlopen("libCOREGL.so", RTLD_NOW);
42 LOGE(" \E[40;31;1m%s\E[0m\n\n", dlerror());
43 LOGE(" \E[40;31;1mInvalid library link! (Check linkage of libEGL -> libCOREGL)\E[0m\n");
47 #define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST) \
48 ovr_##FUNC_NAME = (__typeof__(ovr_##FUNC_NAME))dlsym(lib_handle, "coregl_api_"#FUNC_NAME); \
49 if (ovr_##FUNC_NAME == NULL) \
51 LOGE("\E[40;31;1mCan't find a symbol '%s'!\E[0m\n\n", #FUNC_NAME); \
52 LOGE("\E[40;31;1mInvalid library link! (Check linkage of libEGL -> libCOREGL)\E[0m\n"); \
55 #define _COREGL_EXT_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)
56 #include "../headers/sym_egl.h"
57 #undef _COREGL_EXT_SYMBOL
68 return ovr_eglGetError();
72 eglGetDisplay(EGLNativeDisplayType display_id)
75 return ovr_eglGetDisplay(display_id);
79 eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
82 return ovr_eglInitialize(dpy, major, minor);
86 eglTerminate(EGLDisplay dpy)
89 return ovr_eglTerminate(dpy);
93 eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size,
97 return ovr_eglGetConfigs(dpy, configs, config_size, num_config);
101 eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs,
102 EGLint config_size, EGLint *num_config)
105 return ovr_eglChooseConfig(dpy, attrib_list, configs, config_size, num_config);
109 eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute,
113 return ovr_eglGetConfigAttrib(dpy, config, attribute, value);
118 eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
119 EGLNativeWindowType win, const EGLint *attrib_list)
122 return ovr_eglCreateWindowSurface(dpy, config, win, attrib_list);
126 eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
127 const EGLint *attrib_list)
130 return ovr_eglCreatePbufferSurface(dpy, config, attrib_list);
134 eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
135 EGLNativePixmapType pixmap, const EGLint *attrib_list)
138 return ovr_eglCreatePixmapSurface(dpy, config, pixmap, attrib_list);
142 eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
145 return ovr_eglDestroySurface(dpy, surface);
149 eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute,
153 return ovr_eglQuerySurface(dpy, surface, attribute, value);
157 eglBindAPI(EGLenum api)
160 return ovr_eglBindAPI(api);
167 return ovr_eglQueryAPI();
174 return ovr_eglWaitClient();
178 eglReleaseThread(void)
181 return ovr_eglReleaseThread();
185 eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype,
186 EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list)
189 return ovr_eglCreatePbufferFromClientBuffer(dpy, buftype, buffer, config,
194 eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute,
198 return ovr_eglSurfaceAttrib(dpy, surface, attribute, value);
202 eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
205 return ovr_eglBindTexImage(dpy, surface, buffer);
209 eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
212 return ovr_eglReleaseTexImage(dpy, surface, buffer);
216 eglSwapInterval(EGLDisplay dpy, EGLint interval)
219 return ovr_eglSwapInterval(dpy, interval);
223 eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context,
224 const EGLint *attrib_list)
227 return ovr_eglCreateContext(dpy, config, share_context, attrib_list);
231 eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
234 return ovr_eglDestroyContext(dpy, ctx);
238 eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
241 return ovr_eglMakeCurrent(dpy, draw, read, ctx);
245 eglGetCurrentContext(void)
248 return ovr_eglGetCurrentContext();
252 eglGetCurrentSurface(EGLint readdraw)
255 return ovr_eglGetCurrentSurface(readdraw);
259 eglGetCurrentDisplay(void)
262 return ovr_eglGetCurrentDisplay();
266 eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
269 return ovr_eglQueryContext(dpy, ctx, attribute, value);
276 return ovr_eglWaitGL();
280 eglWaitNative(EGLint engine)
283 return ovr_eglWaitNative(engine);
287 eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
290 return ovr_eglSwapBuffers(dpy, surface);
294 eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
297 return ovr_eglCopyBuffers(dpy, surface, target);
301 eglGetProcAddress(const char *procname)
304 return ovr_eglGetProcAddress(procname);
308 eglQueryString(EGLDisplay dpy, EGLint name)
311 return ovr_eglQueryString(dpy, name);