Skip to content

Commit def1681

Browse files
committed
egl.h: define EGL 1.5 function types ourselves if not defined by EGL/egl.h
1 parent f72a27a commit def1681

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/egl.h

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#if defined(HAVE_EGL) && defined(LINT_EGL_HEADERS)
1515

1616
// This makes sure we only use EGL 1.4 definitions and prototypes.
17-
#define EGL_EGL_PROTOTYPES 1
1817
#define EGL_VERSION_1_5 1
1918
#include <EGL/egl.h>
2019
#undef EGL_VERSION_1_5
@@ -395,6 +394,27 @@
395394

396395
#endif
397396

397+
// Older egl.h doesn't define typedefs for standard EGL functions, for example on debian buster.
398+
// Define them ourselves if necessary.
399+
//
400+
// We don't use the function typedefs for functions part of 1.4, since
401+
// those should be present at all times and we just statically use them.
402+
//
403+
// For functions part of EGL 1.5 we dynamically resolve the functions at
404+
// runtime, since we can't be sure they're actually present.
405+
#if defined(EGL_VERSION_1_5) && !defined(EGL_EGL_PROTOTYPES)
406+
typedef EGLSync (EGLAPIENTRYP PFNEGLCREATESYNCPROC) (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
407+
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCPROC) (EGLDisplay dpy, EGLSync sync);
408+
typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCPROC) (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
409+
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBPROC) (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value);
410+
typedef EGLImage (EGLAPIENTRYP PFNEGLCREATEIMAGEPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list);
411+
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEPROC) (EGLDisplay dpy, EGLImage image);
412+
typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYPROC) (EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
413+
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list);
414+
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list);
415+
typedef EGLBoolean (EGLAPIENTRYP PFNEGLWAITSYNCPROC) (EGLDisplay dpy, EGLSync sync, EGLint flags);
416+
#endif
417+
398418
static inline bool check_egl_extension(const char *client_ext_string, const char *display_ext_string, const char *extension) {
399419
size_t len = strlen(extension);
400420

0 commit comments

Comments
 (0)