4 #include <glvnd/libeglabi.h>
6 #include "eglcurrent.h"
7 #include "egldispatchstubs.h"
8 #include "eglglobals.h"
10 static const __EGLapiExports
*__eglGLVNDApiExports
= NULL
;
12 static const char * EGLAPIENTRY
13 __eglGLVNDQueryString(EGLDisplay dpy
, EGLenum name
)
15 // For client extensions, return the list of non-platform extensions. The
16 // platform extensions are returned by __eglGLVNDGetVendorString.
17 if (dpy
== EGL_NO_DISPLAY
&& name
== EGL_EXTENSIONS
)
18 return _eglGlobal
.ClientOnlyExtensionString
;
20 // For everything else, forward to the normal eglQueryString function.
21 return eglQueryString(dpy
, name
);
25 __eglGLVNDGetVendorString(int name
)
27 if (name
== __EGL_VENDOR_STRING_PLATFORM_EXTENSIONS
)
28 return _eglGlobal
.PlatformExtensionString
;
34 __eglGLVNDGetPlatformDisplay(EGLenum platform
, void *native_display
,
35 const EGLAttrib
*attrib_list
)
37 if (platform
== EGL_NONE
) {
38 assert(native_display
== (void *) EGL_DEFAULT_DISPLAY
);
39 assert(attrib_list
== NULL
);
40 return eglGetDisplay((EGLNativeDisplayType
) native_display
);
42 return eglGetPlatformDisplay(platform
, native_display
, attrib_list
);
47 __eglGLVNDGetProcAddress(const char *procName
)
49 if (strcmp(procName
, "eglQueryString") == 0)
50 return (void *) __eglGLVNDQueryString
;
52 return (void *) eglGetProcAddress(procName
);
56 __egl_Main(uint32_t version
, const __EGLapiExports
*exports
,
57 __EGLvendorInfo
*vendor
, __EGLapiImports
*imports
)
59 if (EGL_VENDOR_ABI_GET_MAJOR_VERSION(version
) !=
60 EGL_VENDOR_ABI_MAJOR_VERSION
)
63 __eglGLVNDApiExports
= exports
;
64 __eglInitDispatchStubs(exports
);
66 imports
->getPlatformDisplay
= __eglGLVNDGetPlatformDisplay
;
67 imports
->getSupportsAPI
= _eglIsApiValid
;
68 imports
->getVendorString
= __eglGLVNDGetVendorString
;
69 imports
->getProcAddress
= __eglGLVNDGetProcAddress
;
70 imports
->getDispatchAddress
= __eglDispatchFindDispatchFunction
;
71 imports
->setDispatchIndex
= __eglSetDispatchIndex
;