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 const char *str
= _eglGlobal
.PlatformExtensionString
;
29 // The platform extension string may have a leading space. If it does,
41 __eglGLVNDGetPlatformDisplay(EGLenum platform
, void *native_display
,
42 const EGLAttrib
*attrib_list
)
44 if (platform
== EGL_NONE
) {
45 assert(native_display
== (void *) EGL_DEFAULT_DISPLAY
);
46 assert(attrib_list
== NULL
);
47 return eglGetDisplay((EGLNativeDisplayType
) native_display
);
49 return eglGetPlatformDisplay(platform
, native_display
, attrib_list
);
54 __eglGLVNDGetProcAddress(const char *procName
)
56 if (strcmp(procName
, "eglQueryString") == 0)
57 return (void *) __eglGLVNDQueryString
;
59 return (void *) eglGetProcAddress(procName
);
63 __egl_Main(uint32_t version
, const __EGLapiExports
*exports
,
64 __EGLvendorInfo
*vendor
, __EGLapiImports
*imports
)
66 if (EGL_VENDOR_ABI_GET_MAJOR_VERSION(version
) !=
67 EGL_VENDOR_ABI_MAJOR_VERSION
)
70 __eglGLVNDApiExports
= exports
;
71 __eglInitDispatchStubs(exports
);
73 imports
->getPlatformDisplay
= __eglGLVNDGetPlatformDisplay
;
74 imports
->getSupportsAPI
= _eglIsApiValid
;
75 imports
->getVendorString
= __eglGLVNDGetVendorString
;
76 imports
->getProcAddress
= __eglGLVNDGetProcAddress
;
77 imports
->getDispatchAddress
= __eglDispatchFindDispatchFunction
;
78 imports
->setDispatchIndex
= __eglSetDispatchIndex
;