From 9aa0d3ddab244a0e88dc9d0601283b8d31b91d81 Mon Sep 17 00:00:00 2001 From: Quantum Date: Thu, 19 Aug 2021 07:18:11 -0400 Subject: [PATCH] [client] egl: fix context creation on EGL 1.4 EGL_CONTEXT_OPENGL_DEBUG is only defined in EGL 1.5, and therefore, we should not be passing it on older versions of EGL. --- client/renderers/EGL/egl.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/client/renderers/EGL/egl.c b/client/renderers/EGL/egl.c index 2c2230b0..d94a4995 100644 --- a/client/renderers/EGL/egl.c +++ b/client/renderers/EGL/egl.c @@ -703,12 +703,21 @@ static bool egl_renderStartup(LG_Renderer * renderer, bool useDMA) } bool debugContext = option_get_bool("egl", "debug"); - EGLint ctxattr[] = + EGLint ctxattr[5]; + int ctxidx = 0; + + ctxattr[ctxidx++] = EGL_CONTEXT_CLIENT_VERSION; + ctxattr[ctxidx++] = 2; + + if (maj > 1 || (maj == 1 && min >= 5)) { - EGL_CONTEXT_CLIENT_VERSION, 2, - EGL_CONTEXT_OPENGL_DEBUG , debugContext ? EGL_TRUE : EGL_FALSE, - EGL_NONE - }; + ctxattr[ctxidx++] = EGL_CONTEXT_OPENGL_DEBUG; + ctxattr[ctxidx++] = debugContext ? EGL_TRUE : EGL_FALSE; + } + else if (debugContext) + DEBUG_WARN("Cannot create debug contexts before EGL 1.5"); + + ctxattr[ctxidx++] = EGL_NONE; this->context = eglCreateContext(this->display, this->configs, EGL_NO_CONTEXT, ctxattr); if (this->context == EGL_NO_CONTEXT)