Skip to content

fix: preserve image atlas across patchless resolves#1664

Open
waywardmonkeys wants to merge 1 commit into
linebender:mainfrom
waywardmonkeys:fix/image-atlas-patchless-resolve
Open

fix: preserve image atlas across patchless resolves#1664
waywardmonkeys wants to merge 1 commit into
linebender:mainfrom
waywardmonkeys:fix/image-atlas-patchless-resolve

Conversation

@waywardmonkeys
Copy link
Copy Markdown
Collaborator

@waywardmonkeys waywardmonkeys commented May 23, 2026

Vello's renderer keeps a persistent GPU image atlas, while the resolver tracks logical atlas residency and dirty image uploads. Patchless resolves used to return Images::default(), which made the renderer treat an image-free frame as a 0x0 atlas and replace a previously populated atlas with a fresh 1x1 texture.

The resolver still kept resident image entries marked clean. If a later scene reused the same image, it returned cached atlas coordinates but scheduled no upload. When the renderer grew the atlas back to its previous size, that new GPU texture did not contain the resident image, so image brushes, including glyph image brushes, sampled blank content.

Patchless resolves now begin an image-cache resolve and return the cache's resident atlas state when there are resident images. That clears the per-resolve upload list while preserving the GPU atlas those clean images sample from. Fresh patchless resolves with no resident images still report no atlas, so image-free frames do not allocate the default image atlas just to draw solid content.

Shader hot reload had the same class of failure: it dropped the GPU atlas by replacing the engine while keeping clean resolver residency. Reset resolver state when reloading shaders, and carry image overrides into the new engine so the next image frame uploads into the fresh atlas.

@waywardmonkeys waywardmonkeys requested a review from raphlinus May 23, 2026 08:40
@waywardmonkeys
Copy link
Copy Markdown
Collaborator Author

This was done with the assistance of Codex (GPT 5.5, xhigh).

It was found while updating imaging to use Vello 0.9.

This was a result of changes that I introduced for Vello 0.8.

We should do a 0.9.1 release with this fix. (And let's see if there are other fixes...)

Vello's renderer keeps a persistent GPU image atlas, while the resolver tracks logical atlas residency and dirty image uploads. Patchless resolves used to return Images::default(), which made the renderer treat an image-free frame as a 0x0 atlas and replace a previously populated atlas with a fresh 1x1 texture.

The resolver still kept resident image entries marked clean. If a later scene reused the same image, it returned cached atlas coordinates but scheduled no upload. When the renderer grew the atlas back to its previous size, that new GPU texture did not contain the resident image, so image brushes, including glyph image brushes, sampled blank content.

Patchless resolves now begin an image-cache resolve and return the cache's resident atlas state when there are resident images. That clears the per-resolve upload list while preserving the GPU atlas those clean images sample from. Fresh patchless resolves with no resident images still report no atlas, so image-free frames do not allocate the default image atlas just to draw solid content.

Shader hot reload had the same class of failure: it dropped the GPU atlas by replacing the engine while keeping clean resolver residency. Reset resolver state when reloading shaders, and carry image overrides into the new engine so the next image frame uploads into the fresh atlas.

Add focused coverage for the root invariant and the failing GPU sequence: image brush glyphs rendered before and after an image-free frame with the same renderer.
@waywardmonkeys waywardmonkeys force-pushed the fix/image-atlas-patchless-resolve branch from 86e61e2 to 4d1a949 Compare May 23, 2026 13:18
@waywardmonkeys
Copy link
Copy Markdown
Collaborator Author

I kicked off a group of adversarial subagents and it found a couple of further things wrong.

PR updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant