diff --git a/linux/nix/default.nix b/linux/nix/default.nix index 8f09dbc..6da2a60 100644 --- a/linux/nix/default.nix +++ b/linux/nix/default.nix @@ -14,6 +14,15 @@ android_sdk.accept_license = true; allowUnfree = true; }; + overlays = [ + (_: prev: { + # Without this, GTK3 can't create a GL context on Mesa builds without GLES 1 + # (Flathub's since 26.2.8). Drop once nixpkgs has a GTK3 release with it. + gtk3 = prev.gtk3.overrideAttrs (old: { + patches = old.patches or [ ] ++ [ ./patches/gtk3-egl-renderable-type.patch ]; + }); + }) + ]; }; packages = diff --git a/linux/nix/patches/gtk3-egl-renderable-type.patch b/linux/nix/patches/gtk3-egl-renderable-type.patch new file mode 100644 index 0000000..6711e39 --- /dev/null +++ b/linux/nix/patches/gtk3-egl-renderable-type.patch @@ -0,0 +1,60 @@ +From 386e7cb0ad85660cde7124ebd5b70d6f948e311f Mon Sep 17 00:00:00 2001 +From: YummierGravy <48499148+YummierGravy@users.noreply.github.com> +Date: Fri, 20 Nov 2026 00:20:31 +0100 +Subject: [PATCH] wayland: Set EGL_RENDERABLE_TYPE when choosing an EGLConfig + +eglChooseConfig() defaults EGL_RENDERABLE_TYPE to EGL_OPENGL_ES_BIT +(OpenGL ES 1.x), which GDK never uses. Since Mesa 26.3, builds without +GLES 1 support no longer set that bit on their configs, so no config +matches and creating a GL context fails + +Part-of: +--- + gdk/wayland/gdkglcontext-wayland.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/gdk/wayland/gdkglcontext-wayland.c b/gdk/wayland/gdkglcontext-wayland.c +index d73e6e68d71..622b43ed1fb 100644 +--- a/gdk/wayland/gdkglcontext-wayland.c ++++ b/gdk/wayland/gdkglcontext-wayland.c +@@ -372,6 +372,7 @@ gdk_wayland_display_init_gl (GdkDisplay *display, + + static gboolean + find_eglconfig_for_window (GdkWindow *window, ++ gboolean use_es, + EGLConfig *egl_config_out, + EGLint *min_swap_interval_out, + GError **error) +@@ -389,6 +390,9 @@ find_eglconfig_for_window (GdkWindow *window, + attrs[i++] = EGL_SURFACE_TYPE; + attrs[i++] = EGL_WINDOW_BIT; + ++ attrs[i++] = EGL_RENDERABLE_TYPE; ++ attrs[i++] = use_es ? EGL_OPENGL_ES2_BIT : EGL_OPENGL_BIT; ++ + attrs[i++] = EGL_COLOR_BUFFER_TYPE; + attrs[i++] = EGL_RGB_BUFFER; + +@@ -464,6 +468,7 @@ gdk_wayland_window_create_gl_context (GdkWindow *window, + GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display); + GdkWaylandGLContext *context; + EGLConfig config; ++ gboolean use_es; + + if (!gdk_wayland_display_init_gl (display, share)) + { +@@ -481,7 +486,10 @@ gdk_wayland_window_create_gl_context (GdkWindow *window, + return NULL; + } + +- if (!find_eglconfig_for_window (window, &config, ++ use_es = (_gdk_gl_flags & GDK_GL_GLES) != 0 || ++ (share != NULL && gdk_gl_context_get_use_es (share)); ++ ++ if (!find_eglconfig_for_window (window, use_es, &config, + &display_wayland->egl_min_swap_interval, + error)) + return NULL; +-- +GitLab +