GTK Win32: GL and Vulkan renderers are never used by default because they require DComp, which is opt-in

Summary

Since !8559, both GPU draw contexts present through DirectComposition, and both
fail to attach when there is no DComp device:

  • gdk_win32_gl_context_surface_attach(): OpenGL requires Direct Composition
  • gdk_win32_vulkan_context_surface_attach(): Vulkan requires Direct Composition

Since !9593 (914cb8dc), DComp is only created with GDK_DEBUG=dcomp. As a
result, a default GTK 4.24 setup on Windows always renders with Cairo, even when
GL itself works (gdk_display_prepare_gl() succeeds).

Impact: every frame is composited on the CPU. Our app (the Ghostty terminal)
hands GTK a new GdkMemoryTexture every frame. While it animates continuously,
the main thread keeps one CPU core at 100% in GskCairoRenderer.

Current behavior

Not using Vulkan: GdkWin32Display prefers OpenGL
Failed to realize renderer 'GskGLRenderer' for surface 'GdkWin32Toplevel': OpenGL requires Direct Composition
Not using Vulkan as fallback: Vulkan support disabled via GDK_DISABLE
Failed to realize renderer 'GskGLRenderer' for surface 'GdkWin32Toplevel': OpenGL requires Direct Composition
Using renderer 'GskCairoRenderer' for surface 'GdkWin32Toplevel'

There is no Not using GL line, so GL initialization succeeded; only the
surface attach failed. Without GSK_DEBUG, nothing is logged.

After manually enabling DComp, I tested both the Vulkan and GL renderers. The Vulkan renderer displays correctly, whereas the GL renderer shows black borders.

Expected outcome

A DComp device is created by default, as both the GL and Vulkan renderers rely on DComp.

When there is no DComp device, GSK skips them (GL is currently realized twice and fails both times), and the Cairo-only default on Windows is documented.

Version information

  • GTK 4.24.1, MSYS2 CLANG64 mingw-w64-clang-x86_64-gtk4 4.24.1-1.
  • Windows: 11
  • GPU: NVIDIA GeForce RTX 5080 Laptop GPU

The problem with GL itself is that the framebuffer it creates often doesn’t support transparency which is why I ported it to dcomp.

It turns out there are various issues with dcomp (read: crashers on various hardware) so there was a choice to be made between turning dcomp on or off and the choice of “off” was made.

So now we’re stuck in a world without acceleration, but we do have transparency and no crashes.