Many applications request and use GL configs with alpha, but assume that the windowing system will present their surfaces opaquely. Wayland compositors normally respect the alpha channel, which leads to unwanted translucency effects for such applications, so we use the EGL_EXT_present_opaque extension to avoid this.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57800
--
Note that this has been a known issue since the initial GL support in winewayland (see description of https://gitlab.winehq.org/wine/wine/-/merge_requests/5264). At that point I didn't enable the opaque attribute because there was a bug in Mesa that could cause a crash for some 16bpp formats. I fixed the bug in https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28153, and the fix got released in 24.2.0 (Aug 2024). This Mesa version (or newer) is now either part of the latest version of most major distributions or available through official updates/backports (from what I see OpenSUSE Leap is a notable exception), so I now feel more comfortable enabling the attribute by default. Some users using older Mesa versions may be affected, but I think most people trying out the latest Wine 10.x will already be (or can move to) to newer Mesa versions anyway.
From: Alexandros Frantzis alexandros.frantzis@collabora.com
Many applications request and use GL configs with alpha, but assume that the windowing system will present their surfaces opaquely. Wayland compositors normally respect the alpha channel, which leads to unwanted translucency effects for such applications, so we use the EGL_EXT_present_opaque extension to avoid this.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57800 --- dlls/winewayland.drv/opengl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/winewayland.drv/opengl.c b/dlls/winewayland.drv/opengl.c index b8b673f398a..d9a83d49b3e 100644 --- a/dlls/winewayland.drv/opengl.c +++ b/dlls/winewayland.drv/opengl.c @@ -194,6 +194,7 @@ static struct wayland_gl_drawable *wayland_gl_drawable_create(HWND hwnd, int for struct wayland_gl_drawable *gl; int client_width, client_height; RECT client_rect = {0}; + const EGLint attribs[] = {EGL_PRESENT_OPAQUE_EXT, EGL_TRUE, EGL_NONE};
TRACE("hwnd=%p format=%d\n", hwnd, format);
@@ -223,7 +224,7 @@ static struct wayland_gl_drawable *wayland_gl_drawable_create(HWND hwnd, int for }
gl->surface = p_eglCreateWindowSurface(egl_display, egl_config_for_format(format), - gl->wl_egl_window, NULL); + gl->wl_egl_window, attribs); if (!gl->surface) { ERR("Failed to create EGL surface\n"); @@ -1397,6 +1398,7 @@ static void init_opengl(void) REQUIRE_EXT(EGL_KHR_create_context); REQUIRE_EXT(EGL_KHR_create_context_no_error); REQUIRE_EXT(EGL_KHR_no_config_context); + REQUIRE_EXT(EGL_EXT_present_opaque); #undef REQUIRE_EXT
has_egl_ext_pixel_format_float = has_extension(egl_exts, "EGL_EXT_pixel_format_float");