From 9061d733d3f31293c145cf3b7a0f71c1bfd31989 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 15 Aug 2009 22:44:46 +0800 Subject: egl: Remove core functions from eglGetProcAddress. eglGetProcAddress may not be used to query core (non-extension) functions. Signed-off-by: Chia-I Wu --- src/egl/main/eglapi.c | 61 ++++++++++++++------------------------------------- 1 file changed, 16 insertions(+), 45 deletions(-) (limited to 'src/egl') diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 29617b7afff..82ee9d9bcdf 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -586,43 +586,11 @@ eglGetError(void) void (* EGLAPIENTRY eglGetProcAddress(const char *procname))() { - typedef void (*genericFunc)(); - struct name_function { + static const struct { const char *name; _EGLProc function; - }; - static struct name_function egl_functions[] = { - /* alphabetical order */ - { "eglBindTexImage", (_EGLProc) eglBindTexImage }, - { "eglChooseConfig", (_EGLProc) eglChooseConfig }, - { "eglCopyBuffers", (_EGLProc) eglCopyBuffers }, - { "eglCreateContext", (_EGLProc) eglCreateContext }, - { "eglCreatePbufferSurface", (_EGLProc) eglCreatePbufferSurface }, - { "eglCreatePixmapSurface", (_EGLProc) eglCreatePixmapSurface }, - { "eglCreateWindowSurface", (_EGLProc) eglCreateWindowSurface }, - { "eglDestroyContext", (_EGLProc) eglDestroyContext }, - { "eglDestroySurface", (_EGLProc) eglDestroySurface }, - { "eglGetConfigAttrib", (_EGLProc) eglGetConfigAttrib }, - { "eglGetConfigs", (_EGLProc) eglGetConfigs }, - { "eglGetCurrentContext", (_EGLProc) eglGetCurrentContext }, - { "eglGetCurrentDisplay", (_EGLProc) eglGetCurrentDisplay }, - { "eglGetCurrentSurface", (_EGLProc) eglGetCurrentSurface }, - { "eglGetDisplay", (_EGLProc) eglGetDisplay }, - { "eglGetError", (_EGLProc) eglGetError }, - { "eglGetProcAddress", (_EGLProc) eglGetProcAddress }, - { "eglInitialize", (_EGLProc) eglInitialize }, - { "eglMakeCurrent", (_EGLProc) eglMakeCurrent }, - { "eglQueryContext", (_EGLProc) eglQueryContext }, - { "eglQueryString", (_EGLProc) eglQueryString }, - { "eglQuerySurface", (_EGLProc) eglQuerySurface }, - { "eglReleaseTexImage", (_EGLProc) eglReleaseTexImage }, - { "eglSurfaceAttrib", (_EGLProc) eglSurfaceAttrib }, - { "eglSwapBuffers", (_EGLProc) eglSwapBuffers }, - { "eglSwapInterval", (_EGLProc) eglSwapInterval }, - { "eglTerminate", (_EGLProc) eglTerminate }, - { "eglWaitGL", (_EGLProc) eglWaitGL }, - { "eglWaitNative", (_EGLProc) eglWaitNative }, - /* Extensions */ + } egl_functions[] = { + /* extensions only */ #ifdef EGL_MESA_screen_surface { "eglChooseModeMESA", (_EGLProc) eglChooseModeMESA }, { "eglGetModesMESA", (_EGLProc) eglGetModesMESA }, @@ -637,19 +605,16 @@ void (* EGLAPIENTRY eglGetProcAddress(const char *procname))() { "eglQueryScreenModeMESA", (_EGLProc) eglQueryScreenModeMESA }, { "eglQueryModeStringMESA", (_EGLProc) eglQueryModeStringMESA }, #endif /* EGL_MESA_screen_surface */ -#ifdef EGL_VERSION_1_2 - { "eglBindAPI", (_EGLProc) eglBindAPI }, - { "eglCreatePbufferFromClientBuffer", (_EGLProc) eglCreatePbufferFromClientBuffer }, - { "eglQueryAPI", (_EGLProc) eglQueryAPI }, - { "eglReleaseThread", (_EGLProc) eglReleaseThread }, - { "eglWaitClient", (_EGLProc) eglWaitClient }, -#endif /* EGL_VERSION_1_2 */ { NULL, NULL } }; EGLint i; - for (i = 0; egl_functions[i].name; i++) { - if (strcmp(egl_functions[i].name, procname) == 0) { - return (genericFunc) egl_functions[i].function; + + if (!procname) + return NULL; + if (strncmp(procname, "egl", 3) == 0) { + for (i = 0; egl_functions[i].name; i++) { + if (strcmp(egl_functions[i].name, procname) == 0) + return egl_functions[i].function; } } @@ -664,6 +629,9 @@ void (* EGLAPIENTRY eglGetProcAddress(const char *procname))() } +#ifdef EGL_MESA_screen_surface + + /* * EGL_MESA_screen extension */ @@ -838,6 +806,9 @@ eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode) } +#endif /* EGL_MESA_screen_surface */ + + /** ** EGL 1.2 **/ -- cgit v1.2.3