From 7bbafb47f5c9a16c815e1c6583abb03144cce852 Mon Sep 17 00:00:00 2001 From: Nils Schimmelmann Date: Thu, 4 Jun 2026 16:15:53 +0000 Subject: [PATCH] fix Wayland ghosting using GL_TEXTURE_SWIZZLE_A Fix window ghosting artifacts on Wayland by forcing the alpha channel of the resolved FBO texture to 1.0, ensuring the final composition is fully opaque to the compositor. --- src/opengl/legacy/Legacy.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/opengl/legacy/Legacy.cpp b/src/opengl/legacy/Legacy.cpp index 36043cf0a..cf5e608ac 100644 --- a/src/opengl/legacy/Legacy.cpp +++ b/src/opengl/legacy/Legacy.cpp @@ -4,6 +4,7 @@ #include "Legacy.h" #include "../../display/Textures.h" +#include "../../global/ConfigConsts-Computed.h" #include "../../global/utils.h" #include "../OpenGLTypes.h" #include "../UboManager.h" @@ -394,6 +395,17 @@ void Functions::checkError() void Functions::configureFbo(int samples) { getFBO().configure(getPhysicalViewport(), samples); + + // WebGL2 lacks native support for texture swizzling + if constexpr (CURRENT_PLATFORM != PlatformEnum::Wasm) { + const GLuint textureId = getFBO().resolvedTextureId(); + if (textureId != 0) { + // Fix Wayland ghosting by forcing the alpha channel of the blit target to 1.0. + Base::glBindTexture(GL_TEXTURE_2D, textureId); + Base::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_ONE); + Base::glBindTexture(GL_TEXTURE_2D, 0); + } + } } void Functions::bindFbo()