GDK-Win32: Reject WGL context if shaders aren't supported
authorChun-wei Fan <fanchunwei@src.gnome.org>
Tue, 17 Aug 2021 07:13:38 +0000 (15:13 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Tue, 17 Aug 2021 08:25:09 +0000 (16:25 +0800)
commit5d0f188615ad34186da974b251bb18f5974e70ec
treeb4277527085273b56f06df1f71a8c629ac9c59b1
parent78fcc8feb8008eb60e862e870c357b6e91139afc
GDK-Win32: Reject WGL context if shaders aren't supported

When we initialize OpenGL, check whether we have OpenGL  2.0 or later; if not,
check whether we have the 'GL_ARB_shader_objects' extension, since we must be
able to support shaders if using OpenGL for GTK.

If we don't support shaders, as some Windows graphics drivers do not support
OpenGL adequately, notably older Intel drivers, reject and destroy the GL
context that we created, and so fallback to the Cairo GSK renderer, so that
things continue to run, albeit with an expected warning message that the GL
context cannot be realized.

Also, when we could not make the created dummy WGL context current during
initialization, make sure that we destroy the dummy WGL context as well.

Fixes issue #4165.
gdk/win32/gdkglcontext-win32-egl.c
gdk/win32/gdkglcontext-win32-wgl.c