Repository navigation
Upload every mip level and layer when updating an image in place - #26320
Merged
alice-i-cecile merged 1 commit intoOct 27, 2026
Merged
Conversation
viridia
approved these changes
Oct 26, 2026
IceSentry
approved these changes
Oct 27, 2026
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.
Objective
When an
Imagechanges but keeps the same texture descriptor,GpuImagereuses the existing texture and writes the new data with a singlewrite_texturecall that assumes the data holds only mip 0. For images with more than one mip level:Solution
Write each mip level and array layer separately, using the same data layout as
create_texture_with_data, which handles the first upload. If the data is shorter than the texture needs, write the levels that fit and log a warning.Testing
Showcase
A 2-layer image with 2 mip levels is uploaded gray, then updated with a different color for each layer and mip level. Each column shows one layer and mip level. Before this PR, mip 1 keeps its old gray data, and layer 1 picks up a row of layer 0's mip 1 data. The reference row shows the same data uploaded to a new texture.
AI Disclosure
This was AI assisted w/ Opus 5.5. Talin reported on Discord that uploading new data to an existing image didn't replace all of it. I used Opus to look at whether the fix belonged in asset processing or in the image upload, and we settled on the upload, since there's nothing to re-process at that point and the bug is that the new data was just being ignored. I also used Opus to build a sample app and test that render the before and after images. I then reviewed it, cleaned it up, had Talin test it, and opened PR.