Commit 2a1feab2 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

EGL: add CheckClientExt() helper

Checks support for a EGL client extension.
parent e1cdb462
......@@ -79,27 +79,35 @@ static void ReleaseCurrent (vlc_gl_t *);
static void SwapBuffers (vlc_gl_t *);
static void *GetSymbol(vlc_gl_t *, const char *);
static bool CheckAPI (EGLDisplay dpy, const char *api)
static bool CheckToken(const char *haystack, const char *needle)
{
const char *apis = eglQueryString (dpy, EGL_CLIENT_APIS);
size_t apilen = strlen (api);
size_t len = strlen(needle);
/* Cannot use strtok_r() on constant string... */
do
while (haystack != NULL)
{
while (*apis == ' ')
apis++;
if (!strncmp (apis, api, apilen)
&& (memchr (" ", apis[apilen], 2) != NULL))
while (*haystack == ' ')
haystack++;
if (!strncmp(haystack, needle, len)
&& (memchr(" ", haystack[len], 2) != NULL))
return true;
apis = strchr (apis, ' ');
haystack = strchr(haystack, ' ');
}
while (apis != NULL);
return false;
}
static bool CheckAPI (EGLDisplay dpy, const char *api)
{
const char *apis = eglQueryString (dpy, EGL_CLIENT_APIS);
return CheckToken(apis, api);
}
static bool CheckClientExt(const char *name)
{
const char *exts = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
return CheckToken(exts, name);
}
struct gl_api
{
const char name[10];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment