Skip to content
  • David Edmundson's avatar
    Avoid texture bleed rendering X11 window · d1cfcf4c
    David Edmundson authored
    Summary:
    We currently see a gap on transformed windows between the window and the
    top decoration.
    
    This is partly the atlas bleed on the decoration, and partly a bleed on
    the window content itself.
    
    On X11, the window we composite is the frame window - which is a larger
    texture containing a transparent border where the frame normally would
    be. When we sample with a linear filter we include these texels. Hence
    GL_CLAMP_TO_EDGE doesn't work.
    
    Vlad's patch to composite the correct window, not the frame was my
    preferred approach, but we had to revert it as it caused an issue with
    xwayland :(
    
    Half pixel correction nearly worked, but caused blurry fonts.
    
    This patch resolves it in the fragment shader used by effects doing
    transforms. We pass the real texture geometry of the window to the
    client with a half pixel correction. Any samples outside the outer half
    pixel are then clamped within bounds.
    
    Arguably a hack, but solves the problem in a comparatively
    non-invasive way.
    
    BUG: 360549
    BUG: 257566
    
    Test Plan:
    X11:
    Using Vlad's atlas padding for decoration
    Slowed animations, wobbled a dark window over a light background
    No artifacts
    
    Wayland:
    This isn't needed. Now tested that everything still renders the same.
    
    Reviewers: #kwin, zzag
    
    Reviewed By: #kwin, zzag
    
    Subscribers: zzag, jgrulich, kwin
    
    Tags: #kwin
    
    Differential Revision: https://phabricator.kde.org/D25737
    d1cfcf4c