egl: Don't bind to NULL surface unless surfaceless

We need to ensure that an EGL surface exists before we call
eglMakeCurrent() with it. Otherwise we might end up binding to
EGL_NO_SURFACE and then never revising that decision.
Which leads to not rendering to the backbuffer, but into the void.

Fixes X11 rendering being black

Fixes #6930
This commit is contained in:
Benjamin Otte
2024-08-19 23:27:30 +02:00
parent c230546a2c
commit f650f96b69

View File

@@ -1160,6 +1160,8 @@ gdk_surface_get_egl_surface (GdkSurface *self)
{
GdkSurfacePrivate *priv = gdk_surface_get_instance_private (self);
gdk_surface_ensure_egl_surface (self, priv->egl_surface_depth);
return priv->egl_surface;
}
@@ -1172,6 +1174,14 @@ gdk_surface_ensure_egl_surface (GdkSurface *self,
g_return_val_if_fail (priv->egl_native_window != NULL, depth);
if (depth == GDK_MEMORY_NONE)
{
if (priv->egl_surface_depth == GDK_MEMORY_NONE)
depth = GDK_MEMORY_U8;
else
depth = priv->egl_surface_depth;
}
if (priv->egl_surface_depth != depth &&
priv->egl_surface != NULL &&
gdk_display_get_egl_config (display, priv->egl_surface_depth) != gdk_display_get_egl_config (display, depth))