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
This commit is contained in:
Kyle Brenneman 2017-04-16 17:11:27 -06:00
parent d433d592e1
commit 7baa75bee0

View File

@ -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