fix Wayland ghosting using GL_TEXTURE_SWIZZLE_A#535
Merged
nschimme merged 1 commit intoJun 4, 2026
Conversation
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.
Reviewer's guide (collapsed on small PRs)Reviewer's GuideConfigures the resolved FBO texture so that its alpha channel is forced to 1.0 (except on WebAssembly), eliminating Wayland ghosting artifacts caused by non-opaque alpha being presented to the compositor. Sequence diagram for updated FBO configuration and alpha swizzlesequenceDiagram
participant Functions
participant FBO
participant OpenGL
Functions->>FBO: configure(getPhysicalViewport(), samples)
Functions->>FBO: resolvedTextureId()
FBO-->>Functions: textureId
alt CURRENT_PLATFORM != PlatformEnum::Wasm and textureId != 0
Functions->>OpenGL: glBindTexture(GL_TEXTURE_2D, textureId)
Functions->>OpenGL: glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_ONE)
Functions->>OpenGL: glBindTexture(GL_TEXTURE_2D, 0)
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Binding and unbinding GL_TEXTURE_2D inside configureFbo introduces a new side effect; consider saving/restoring the previously bound texture so callers’ GL state assumptions remain valid.
- The swizzle parameter is set every time configureFbo runs; if the resolved texture is reused across frames, you could guard this with a small flag or move it to the FBO/texture initialization path to avoid redundant state changes.
- The workaround currently applies to all non-Wasm platforms; if the ghosting issue is specific to Wayland, consider scoping this behavior behind a more precise platform/window-system check or configuration flag to avoid surprising behavior on other backends.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Binding and unbinding GL_TEXTURE_2D inside configureFbo introduces a new side effect; consider saving/restoring the previously bound texture so callers’ GL state assumptions remain valid.
- The swizzle parameter is set every time configureFbo runs; if the resolved texture is reused across frames, you could guard this with a small flag or move it to the FBO/texture initialization path to avoid redundant state changes.
- The workaround currently applies to all non-Wasm platforms; if the ghosting issue is specific to Wayland, consider scoping this behavior behind a more precise platform/window-system check or configuration flag to avoid surprising behavior on other backends.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #535 +/- ##
==========================================
- Coverage 25.39% 25.38% -0.01%
==========================================
Files 521 521
Lines 43178 43183 +5
Branches 4708 4709 +1
==========================================
Hits 10963 10963
- Misses 32215 32220 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Summary by Sourcery
Bug Fixes: