Skip to content

Fix running GTK4 under EGL on Windows

Chun-wei Fan requested to merge gtk4-win32-egl into main

Hi,

This attempts to update the code so that one can at least launch GTK-4.x programs under Windows using EGL/libANGLE, where we:

  • Use the non-legacy, non-GLES codepath but avoid using noperspective in the shaders when we are using #version 300 es in our shaders. Using the #version 300 es directive instead of the usual #version 100 directive that we use for EGL is necessary for the shaders to compile and work successfully when used under libANGLE.
  • Make sure that we call gdk_surface_set_egl_native_window() when we create and destroy the GdkSurface in Windows.
  • Check in GSK that we are going to use the GLSL 300 ES codepath if we are using a libANGLE GLES 3.0+ GL renderer.

The gtk4-demo now launches and runs in EGL mode, albeit some of the GL demos are currently not working as it seems that some GL features were not supported or so (which, is beyond this MR IMO).

With blessings, thank you!

Edited by Chun-wei Fan

Merge request reports