From cb42fd82a47c56f99940e66e9033a49f2b92d217 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 16 Aug 2025 07:30:32 +0530 Subject: [PATCH] EGL: Fix GLFW_CONTEXT_NO_ERROR on Mesa Mesa EGL requires the context version to be set to 2.0 or greater before EGL_CONTEXT_OPENGL_NO_ERROR_KHR in the attribute list. Without this, context creation via Mesa EGL with EGL_CONTEXT_OPENGL_NO_ERROR_KHR set fails with EGL_BAD_ATTRIBUTE. Port from upstream glfw: eeeb56eb23c9a23866e8042fb23d7b0b4d96d106 --- glfw/egl_context.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/glfw/egl_context.c b/glfw/egl_context.c index 9008cba60..b4da38a8c 100644 --- a/glfw/egl_context.c +++ b/glfw/egl_context.c @@ -543,18 +543,18 @@ bool _glfwCreateContextEGL(_GLFWwindow* window, flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR; } - if (ctxconfig->noerror) - { - if (_glfw.egl.KHR_create_context_no_error) - setAttrib(EGL_CONTEXT_OPENGL_NO_ERROR_KHR, true); - } - if (ctxconfig->major != 1 || ctxconfig->minor != 0) { setAttrib(EGL_CONTEXT_MAJOR_VERSION_KHR, ctxconfig->major); setAttrib(EGL_CONTEXT_MINOR_VERSION_KHR, ctxconfig->minor); } + if (ctxconfig->noerror) + { + if (_glfw.egl.KHR_create_context_no_error) + setAttrib(EGL_CONTEXT_OPENGL_NO_ERROR_KHR, true); + } + if (mask) setAttrib(EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, mask);