1 #include "coregl_export.h"
3 Mutex init_export_mutex = MUTEX_INITIALIZER;
5 #define INIT_EXPORT() \
6 if (unlikely(export_initialized == 0)) \
8 mutex_lock(&init_export_mutex); \
9 if (export_initialized == 0) \
11 if (coregl_initialize() != 0) \
13 export_initialized = 1; \
16 mutex_unlock(&init_export_mutex); \
20 coregl_api_eglGetError(void)
23 if (!export_initialized)
24 return EGL_NOT_INITIALIZED;
26 return ovr_eglGetError();
30 coregl_api_eglGetDisplay(EGLNativeDisplayType display_id)
33 if (!export_initialized)
36 return ovr_eglGetDisplay(display_id);
40 coregl_api_eglInitialize(EGLDisplay dpy, EGLint* major, EGLint* minor)
43 if (!export_initialized)
46 return ovr_eglInitialize(dpy, major, minor);
50 coregl_api_eglTerminate(EGLDisplay dpy)
53 if (!export_initialized)
56 return ovr_eglTerminate(dpy);
60 coregl_api_eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
63 if (!export_initialized)
66 return ovr_eglGetConfigs(dpy, configs, config_size, num_config);
70 coregl_api_eglChooseConfig(EGLDisplay dpy, const EGLint* attrib_list, EGLConfig* configs, EGLint config_size, EGLint* num_config)
73 if (!export_initialized)
76 return ovr_eglChooseConfig(dpy, attrib_list, configs, config_size, num_config);
80 coregl_api_eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
83 if (!export_initialized)
86 return ovr_eglGetConfigAttrib(dpy, config, attribute, value);
91 coregl_api_eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint* attrib_list)
94 if (!export_initialized)
95 return EGL_NO_SURFACE;
97 return ovr_eglCreateWindowSurface(dpy, config, win, attrib_list);
101 coregl_api_eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
104 if (!export_initialized)
105 return EGL_NO_SURFACE;
107 return ovr_eglCreatePbufferSurface(dpy, config, attrib_list);
111 coregl_api_eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint* attrib_list)
114 if (!export_initialized)
115 return EGL_NO_SURFACE;
117 return ovr_eglCreatePixmapSurface(dpy, config, pixmap, attrib_list);
121 coregl_api_eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
124 if (!export_initialized)
127 return ovr_eglDestroySurface(dpy, surface);
131 coregl_api_eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
134 if (!export_initialized)
137 return ovr_eglQuerySurface(dpy, surface, attribute, value);
141 coregl_api_eglBindAPI(EGLenum api)
144 if (!export_initialized)
147 return ovr_eglBindAPI(api);
151 coregl_api_eglQueryAPI(void)
154 if (!export_initialized)
157 return ovr_eglQueryAPI();
161 coregl_api_eglWaitClient(void)
164 if (!export_initialized)
167 return ovr_eglWaitClient();
171 coregl_api_eglReleaseThread(void)
174 if (!export_initialized)
177 return ovr_eglReleaseThread();
181 coregl_api_eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list)
184 if (!export_initialized)
185 return EGL_NO_SURFACE;
187 return ovr_eglCreatePbufferFromClientBuffer(dpy, buftype, buffer, config, attrib_list);
191 coregl_api_eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
194 if (!export_initialized)
197 return ovr_eglSurfaceAttrib(dpy, surface, attribute, value);
201 coregl_api_eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
204 if (!export_initialized)
207 return ovr_eglBindTexImage(dpy, surface, buffer);
211 coregl_api_eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
214 if (!export_initialized)
217 return ovr_eglReleaseTexImage(dpy, surface, buffer);
221 coregl_api_eglSwapInterval(EGLDisplay dpy, EGLint interval)
224 if (!export_initialized)
227 return ovr_eglSwapInterval(dpy, interval);
231 coregl_api_eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint* attrib_list)
234 if (!export_initialized)
235 return EGL_NO_CONTEXT;
237 return ovr_eglCreateContext(dpy, config, share_context, attrib_list);
241 coregl_api_eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
244 if (!export_initialized)
247 return ovr_eglDestroyContext(dpy, ctx);
251 coregl_api_eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
254 if (!export_initialized)
257 return ovr_eglMakeCurrent(dpy, draw, read, ctx);
261 coregl_api_eglGetCurrentContext(void)
264 if (!export_initialized)
265 return EGL_NO_CONTEXT;
267 return ovr_eglGetCurrentContext();
271 coregl_api_eglGetCurrentSurface(EGLint readdraw)
274 if (!export_initialized)
275 return EGL_NO_SURFACE;
277 return ovr_eglGetCurrentSurface(readdraw);
281 coregl_api_eglGetCurrentDisplay(void)
284 if (!export_initialized)
285 return EGL_NO_DISPLAY;
287 return ovr_eglGetCurrentDisplay();
291 coregl_api_eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
294 if (!export_initialized)
296 return ovr_eglQueryContext(dpy, ctx, attribute, value);
300 coregl_api_eglWaitGL(void)
303 if (!export_initialized)
306 return ovr_eglWaitGL();
310 coregl_api_eglWaitNative(EGLint engine)
313 if (!export_initialized)
316 return ovr_eglWaitNative(engine);
320 coregl_api_eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
323 if (!export_initialized)
326 return ovr_eglSwapBuffers(dpy, surface);
330 coregl_api_eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
333 if (!export_initialized)
336 return ovr_eglCopyBuffers(dpy, surface, target);
340 coregl_api_eglGetProcAddress(const char* procname)
343 if (!export_initialized)
346 return ovr_eglGetProcAddress(procname);
350 coregl_api_eglQueryString(EGLDisplay dpy, EGLint name)
353 if (!export_initialized)
355 return ovr_eglQueryString(dpy, name);