From 2f1af04745191250cb833704ffa55a47e1ee563b Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 30 Sep 2016 12:20:35 +0200 Subject: [PATCH] vo_opengl: egl: print EGL errors only if not probing Avoids printing an error when trying to create a GLES 3.x context on a device which can do GLES 2.0 only. --- video/out/opengl/egl_helpers.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/video/out/opengl/egl_helpers.c b/video/out/opengl/egl_helpers.c index 598e3512ae..31a31dfb24 100644 --- a/video/out/opengl/egl_helpers.c +++ b/video/out/opengl/egl_helpers.c @@ -31,10 +31,11 @@ #define EGL_OPENGL_ES3_BIT 0x00000040 #endif -static bool create_context(EGLDisplay display, struct mp_log *log, int msgl, +static bool create_context(EGLDisplay display, struct mp_log *log, bool probing, int vo_flags, bool es3, EGLContext *out_context, EGLConfig *out_config) { + int msgl = probing ? MSGL_V : MSGL_FATAL; bool es = vo_flags & VOFLAG_GLES; @@ -143,23 +144,25 @@ bool mpegl_create_context(EGLDisplay display, struct mp_log *log, int vo_flags, STR_OR_ERR(version), STR_OR_ERR(vendor), STR_OR_ERR(apis)); int clean_flags = vo_flags & ~(unsigned)(VOFLAG_GLES | VOFLAG_NO_GLES); - int msgl = vo_flags & VOFLAG_PROBING ? MSGL_V : MSGL_FATAL; + bool probing = vo_flags & VOFLAG_PROBING; + int msgl = probing ? MSGL_V : MSGL_FATAL; + bool try_desktop = !(vo_flags & VOFLAG_NO_GLES); if (!(vo_flags & VOFLAG_GLES)) { // Desktop OpenGL - if (create_context(display, log, msgl, clean_flags, false, + if (create_context(display, log, try_desktop | probing, clean_flags, false, out_context, out_config)) return true; } - if (!(vo_flags & VOFLAG_NO_GLES)) { + if (try_desktop) { // ES 3.x - if (create_context(display, log, msgl, clean_flags | VOFLAG_GLES, true, + if (create_context(display, log, true, clean_flags | VOFLAG_GLES, true, out_context, out_config)) return true; // ES 2.0 - if (create_context(display, log, msgl, clean_flags | VOFLAG_GLES, false, + if (create_context(display, log, probing, clean_flags | VOFLAG_GLES, false, out_context, out_config)) return true; }