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);
43 LOGE(" \E[40;31;1m%s\E[0m\n\n", dlerror());
44 LOGE(" \E[40;31;1mInvalid library link! (Check linkage of libEGL -> libCOREGL)\E[0m\n");
48 #define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST) \
49 ovr_##FUNC_NAME = (__typeof__(ovr_##FUNC_NAME))dlsym(lib_handle, "coregl_api_"#FUNC_NAME); \
50 if (ovr_##FUNC_NAME == NULL) \
52 LOGE("\E[40;31;1mCan't find a symbol '%s'!\E[0m\n\n", #FUNC_NAME); \
53 LOGE("\E[40;31;1mInvalid library link! (Check linkage of libEGL -> libCOREGL)\E[0m\n"); \
56 #define _COREGL_EXT_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)
57 #include "../headers/sym_egl.h"
58 #undef _COREGL_EXT_SYMBOL
69 return ovr_eglGetError();
73 eglGetDisplay(EGLNativeDisplayType display_id)
76 return ovr_eglGetDisplay(display_id);
80 eglInitialize(EGLDisplay dpy, EGLint* major, EGLint* minor)
83 return ovr_eglInitialize(dpy, major, minor);
87 eglTerminate(EGLDisplay dpy)
90 return ovr_eglTerminate(dpy);
94 eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
97 return ovr_eglGetConfigs(dpy, configs, config_size, num_config);
101 eglChooseConfig(EGLDisplay dpy, const EGLint* attrib_list, EGLConfig* configs, EGLint config_size, EGLint* num_config)
104 return ovr_eglChooseConfig(dpy, attrib_list, configs, config_size, num_config);
108 eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
111 return ovr_eglGetConfigAttrib(dpy, config, attribute, value);
116 eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint* attrib_list)
119 return ovr_eglCreateWindowSurface(dpy, config, win, attrib_list);
123 eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
126 return ovr_eglCreatePbufferSurface(dpy, config, attrib_list);
130 eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint* attrib_list)
133 return ovr_eglCreatePixmapSurface(dpy, config, pixmap, attrib_list);
137 eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
140 return ovr_eglDestroySurface(dpy, surface);
144 eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
147 return ovr_eglQuerySurface(dpy, surface, attribute, value);
151 eglBindAPI(EGLenum api)
154 return ovr_eglBindAPI(api);
161 return ovr_eglQueryAPI();
168 return ovr_eglWaitClient();
172 eglReleaseThread(void)
175 return ovr_eglReleaseThread();
179 eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list)
182 return ovr_eglCreatePbufferFromClientBuffer(dpy, buftype, buffer, config, attrib_list);
186 eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
189 return ovr_eglSurfaceAttrib(dpy, surface, attribute, value);
193 eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
196 return ovr_eglBindTexImage(dpy, surface, buffer);
200 eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
203 return ovr_eglReleaseTexImage(dpy, surface, buffer);
207 eglSwapInterval(EGLDisplay dpy, EGLint interval)
210 return ovr_eglSwapInterval(dpy, interval);
214 eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint* attrib_list)
217 return ovr_eglCreateContext(dpy, config, share_context, attrib_list);
221 eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
224 return ovr_eglDestroyContext(dpy, ctx);
228 eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
231 return ovr_eglMakeCurrent(dpy, draw, read, ctx);
235 eglGetCurrentContext(void)
238 return ovr_eglGetCurrentContext();
242 eglGetCurrentSurface(EGLint readdraw)
245 return ovr_eglGetCurrentSurface(readdraw);
249 eglGetCurrentDisplay(void)
252 return ovr_eglGetCurrentDisplay();
256 eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
259 return ovr_eglQueryContext(dpy, ctx, attribute, value);
266 return ovr_eglWaitGL();
270 eglWaitNative(EGLint engine)
273 return ovr_eglWaitNative(engine);
277 eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
280 return ovr_eglSwapBuffers(dpy, surface);
284 eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
287 return ovr_eglCopyBuffers(dpy, surface, target);
291 eglGetProcAddress(const char* procname)
294 return ovr_eglGetProcAddress(procname);
298 eglQueryString(EGLDisplay dpy, EGLint name)
301 return ovr_eglQueryString(dpy, name);