From: Benjamin Otte Date: Sat, 2 Oct 2021 03:21:29 +0000 (+0200) Subject: gdk: Make GDK_DEBUG GL backend selection global X-Git-Tag: archive/raspbian/4.6.5+ds-1+rpi1~1^2~19^2~5^2~258^2~20 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=38461ee204edfbc1da3a27d306a3d4399c79bd92;p=gtk4.git gdk: Make GDK_DEBUG GL backend selection global We have a global GdkGLBackendType now, just set it. This way, using the variable forces the backend type, and we don't need special code handling the env vars in the backends. It also means setting the env var will now "work" on GDK backends that don't even support that GL backend and simualte another GDK backend having registered that GL backend already. So you can run GDK_DEBUG=gl-wgl gtk4-demo on test what Wayland will do when WGL is in use. --- diff --git a/gdk/gdk.c b/gdk/gdk.c index cd8c0bdcc8..8f0cbbb3bb 100644 --- a/gdk/gdk.c +++ b/gdk/gdk.c @@ -31,6 +31,7 @@ #include "gdkconstructor.h" #include "gdkdebug.h" #include "gdkdisplay.h" +#include "gdkglcontextprivate.h" #include "gdkintl.h" #include "gdk-private.h" @@ -294,6 +295,14 @@ gdk_pre_parse (void) gdk_debug_keys, G_N_ELEMENTS (gdk_debug_keys)); + /* These are global */ + if (GDK_DEBUG_CHECK (GL_EGL)) + gdk_gl_backend_use (GDK_GL_EGL); + else if (GDK_DEBUG_CHECK (GL_GLX)) + gdk_gl_backend_use (GDK_GL_GLX); + else if (GDK_DEBUG_CHECK (GL_WGL)) + gdk_gl_backend_use (GDK_GL_WGL); + #ifndef G_HAS_CONSTRUCTORS stash_desktop_startup_notification_id (); #endif diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c index 323ef8a7d8..5495f0f6af 100644 --- a/gdk/win32/gdkdisplay-win32.c +++ b/gdk/win32/gdkdisplay-win32.c @@ -1152,13 +1152,6 @@ gdk_win32_display_init_gl_backend (GdkDisplay *display, { gboolean result = FALSE; -#ifdef GDK_WIN32_ENABLE_EGL - if (GDK_DISPLAY_DEBUG_CHECK (display, GL_EGL)) - return gdk_win32_display_init_egl (display, error); -#endif - if (GDK_DISPLAY_DEBUG_CHECK (display, GL_WGL)) - return gdk_win32_display_init_wgl (display, error); - /* No env vars set, do the regular GL initialization, first WGL and then EGL, * as WGL is the more tried-and-tested configuration. */ diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c index 6e5fd276f7..2e4273db8f 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -2893,11 +2893,6 @@ gdk_x11_display_init_gl_backend (GdkX11Display *self, { GdkDisplay *display G_GNUC_UNUSED = GDK_DISPLAY (self); - if (GDK_DISPLAY_DEBUG_CHECK (display, GL_EGL)) - return gdk_x11_display_init_egl (self, TRUE, out_visual, out_depth, error); - if (GDK_DISPLAY_DEBUG_CHECK (display, GL_GLX)) - return gdk_x11_display_init_glx (self, out_visual, out_depth, error); - /* No env vars set, do the regular GL initialization. * * We try EGL first, but are very picky about what we accept.