GDK-Win32: Make EGL a runtime opt-in

Use the debug envvar 'GDK_DEBUG=gl-egl' to determine whether we want to try to
initialize EGL first before trying WGL, as a means for people to more easily
enable EGL support on Windows to test EGL there (such as to debug the shaders,
for instance)
This commit is contained in:
Chun-wei Fan 2021-11-08 15:37:08 +08:00
parent 1b2e69f6c0
commit 41599e5e90

View File

@ -1152,21 +1152,23 @@ gdk_win32_display_init_gl_backend (GdkDisplay *display,
if (display_win32->dummy_context_wgl.hdc == NULL)
display_win32->dummy_context_wgl.hdc = GetDC (display_win32->hwnd);
/* No env vars set, do the regular GL initialization, first WGL and then EGL,
/*
* No env vars set, do the regular GL initialization, first WGL and then EGL,
* as WGL is the more tried-and-tested configuration.
*/
/*
* Disable defaulting to EGL for now, since shaders need to be fixed for
* usage against libANGLE EGL. EGL is used more as a compatibility layer
* on Windows rather than being a native citizen on Windows
*/
#if 0
result = gdk_display_init_egl (display,
EGL_PLATFORM_ANGLE_ANGLE,
display_win32->dummy_context_wgl.hdc,
FALSE,
error);
#ifdef HAVE_EGL
/*
* Disable defaulting to EGL for now, since shaders need to be fixed for
* usage against libANGLE EGL. EGL is used more as a compatibility layer
* on Windows rather than being a native citizen on Windows
*/
if (_gdk_debug_flags & GDK_DEBUG_GL_EGL)
result = gdk_display_init_egl (display,
EGL_PLATFORM_ANGLE_ANGLE,
display_win32->dummy_context_wgl.hdc,
FALSE,
error);
#endif
if (!result)