Skip to content

gpui: Prevent texture atlas bleeding at image edges - #62557

Open
18o wants to merge 1 commit into
zed-industries:mainfrom
18o:img-border-fix
Open

gpui: Prevent texture atlas bleeding at image edges#62557
18o wants to merge 1 commit into
zed-industries:mainfrom
18o:img-border-fix

Conversation

@18o

@18o 18o commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Objective

Fixes #62456.

RenderImage can show a thin border along its edges when linear texture filtering samples outside the image's tile in the texture atlas.

Solution

  • Clamp polychrome sprite UV coordinates to the centers of the first and last texels in the atlas tile.
  • Apply the same sampling bounds in the Metal, DirectX, and WGPU shaders.
  • Ensure cropped image sub-tiles remain at least one texel wide and high so the sampling bounds are always valid.

Testing

  • Reproduced the issue on macOS using the example from GPUI: RenderImage leaves visible frame/border on same-color background #62456.
  • Confirmed that the visible right and bottom borders disappear with the Metal renderer.
  • Ran cargo check against the reproduction project.
  • Ran cargo test -p gpui_wgpu shader_is_valid_wgsl; all three shader validation tests passed.
  • Ran cargo fmt --package gpui -- --check.
  • DirectX runtime rendering was not tested because a Windows environment was not available.

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content adheres to Zed's UI standards
  • Tests cover the new/changed behavior — verified manually on Metal, but no pixel-level automated regression test was added
  • Performance impact has been considered and is acceptable

Showcase

Before: a thin border is visible along the right and bottom edges of an image matching the background color.
CleanShot20260813105244

After: the image blends uniformly with the background, with no visible border.
CleanShot20260813105325


Release Notes:

  • Fixed unwanted borders around images rendered from GPUI texture atlases.

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Aug 13, 2026
@dinocosta dinocosta added the area:gpui GPUI rendering framework support label Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:gpui GPUI rendering framework support cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GPUI: RenderImage leaves visible frame/border on same-color background

2 participants