From 7baa75bee01e47b0d1de98deb0828cfb31aa0e1c Mon Sep 17 00:00:00 2001 From: Kyle Brenneman Date: Sun, 16 Apr 2017 17:11:27 -0600 Subject: [PATCH] Add #ifdefs for trying to use eglGetPlatformDisplay. Add #ifdefs for EGL_VERSION_1_5 and EGL_EXT_platform_base around the calls to eglGetPlatformDisplay and eglGetPlatformDisplayEXT, respectively. This avoids compiler errors when the EGL header files don't have the necessary declarations for EGL 1.5 or EGL_EXT_platform_base. Follow-up fix for https://github.com/libretro/RetroArch/issues/4790 --- gfx/common/egl_common.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gfx/common/egl_common.c b/gfx/common/egl_common.c index 7cf64587ac..24395a5769 100644 --- a/gfx/common/egl_common.c +++ b/gfx/common/egl_common.c @@ -208,7 +208,7 @@ void egl_get_video_size(egl_ctx_data_t *egl, unsigned *width, unsigned *height) } } -static bool check_egl_version(int minMajorVersion, int minMinorVersion) +bool check_egl_version(int minMajorVersion, int minMinorVersion) { int count; int major, minor; @@ -233,7 +233,7 @@ static bool check_egl_version(int minMajorVersion, int minMinorVersion) return false; } -static bool check_egl_client_extension(const char *name) +bool check_egl_client_extension(const char *name) { size_t nameLen; const char *str = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); @@ -260,12 +260,12 @@ static bool check_egl_client_extension(const char *name) static EGLDisplay get_egl_display(EGLenum platform, void *native) { -#if !defined(ANDROID) && !defined(EMSCRIPTEN) if (platform != EGL_NONE) { /* If the client library supports at least EGL 1.5, then we can call * eglGetPlatformDisplay. Otherwise, see if eglGetPlatformDisplayEXT * is available. */ +#if defined(EGL_VERSION_1_5) if (check_egl_version(1, 5)) { typedef EGLDisplay (EGLAPIENTRY * pfn_eglGetPlatformDisplay) @@ -282,7 +282,9 @@ static EGLDisplay get_egl_display(EGLenum platform, void *native) return dpy; } } +#endif // defined(EGL_VERSION_1_5) +#if defined(EGL_EXT_platform_base) if (check_egl_client_extension("EGL_EXT_platform_base")) { PFNEGLGETPLATFORMDISPLAYEXTPROC ptr_eglGetPlatformDisplayEXT; @@ -297,8 +299,8 @@ static EGLDisplay get_egl_display(EGLenum platform, void *native) return dpy; } } +#endif // defined(EGL_EXT_platform_base) } -#endif /* Either the caller didn't provide a platform type, or the EGL * implementation doesn't support eglGetPlatformDisplay. In this case, try