diff options
author | Rob Clark <robdclark@gmail.com> | 2018-01-29 13:48:43 -0500 |
---|---|---|
committer | Rob Clark <robdclark@gmail.com> | 2018-01-31 12:33:27 -0500 |
commit | 64199332694bed8bdaf1c51b85b5a4c9b9a4b1aa (patch) | |
tree | 4c24edd3a3a12d7fc95df24d92847440167828a3 /run.c | |
parent | 75bf74f06b17d50fc8e0fd02dd96308ded8cb9c4 (diff) |
run: fallback to 3.1 core context
If we can't create a 3.2 core context, fall back to a 3.1 context.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'run.c')
-rw-r--r-- | run.c | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -383,9 +383,22 @@ create_context(EGLDisplay egl_dpy, EGLConfig cfg, enum shader_type type) EGL_NONE }; switch (type) { - case TYPE_CORE: + case TYPE_CORE: { eglBindAPI(EGL_OPENGL_API); - return eglCreateContext(egl_dpy, cfg, EGL_NO_CONTEXT, attribs); + EGLContext core_ctx = + eglCreateContext(egl_dpy, cfg, EGL_NO_CONTEXT, attribs); + + if (core_ctx == EGL_NO_CONTEXT) { + static const EGLint attribs_31[] = { + EGL_CONTEXT_MAJOR_VERSION_KHR, 3, + EGL_CONTEXT_MINOR_VERSION_KHR, 1, + EGL_NONE + }; + core_ctx = eglCreateContext(egl_dpy, cfg, EGL_NO_CONTEXT, attribs_31); + } + + return core_ctx; + } case TYPE_COMPAT: eglBindAPI(EGL_OPENGL_API); return eglCreateContext(egl_dpy, cfg, EGL_NO_CONTEXT, &attribs[6]); |