From 8209db451b878656c1751223fb3d3f4a9df159e4 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 24 Jun 2013 15:44:47 -0700 Subject: [PATCH] EGL: Add wrapper for eglGetProcAddress If an EGL-using program uses eglGetProcAddress to locate functions, we want to intercept that to return our own versions of the functions, (to add out metrics timings, etc.). If the requested function is not implemented in our library, just defer to the real, underlying eglGetProcAddress function to find the symbol. --- eglwrap.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/eglwrap.c b/eglwrap.c index 913fd48..43b07ba 100644 --- a/eglwrap.c +++ b/eglwrap.c @@ -77,6 +77,21 @@ eglSwapBuffers (EGLDisplay dpy, EGLSurface surface) return ret; } +void (*eglGetProcAddress (char const *func))(void) +{ + void *ret; + + /* If our library has this symbol, that's what we want to give. */ + ret = dlwrap_real_dlsym (NULL, (const char *) func); + if (ret) + return ret; + + /* Otherwise, just defer to the real eglGetProcAddress */ + EGLWRAP_DEFER_WITH_RETURN (ret, eglGetProcAddress, func); + + return ret; +} + EGLBoolean eglMakeCurrent (EGLDisplay display, EGLSurface draw, EGLSurface read, EGLContext context) -- 2.43.0