fix: preserve image atlas across patchless resolves#1664
Open
waywardmonkeys wants to merge 1 commit into
Open
Conversation
Collaborator
Author
|
This was done with the assistance of Codex (GPT 5.5, xhigh). It was found while updating 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.
86e61e2 to
4d1a949
Compare
Collaborator
Author
|
I kicked off a group of adversarial subagents and it found a couple of further things wrong. PR updated. |
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.
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.