Repository navigation
fix(render): drop GPU textures of image pages freed when a window rests - #2108
Closed
opencodejr[bot] wants to merge 1 commit into
Closed
opencodejr[bot] wants to merge 1 commit into
opencodejr[bot] wants to merge 1 commit into
Conversation
Member
|
closing, #2126 already does this on dev: give_back now takes the image atlas and drops the textures of pages rest() freed, for both windows and overlays |
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.
Fixes #2102.
ImageAtlas::rest()frees the CPU copy of image pages no element showed in the last frame (and truncatespages). ButRenderer::give_backnever touchedRenderer::images, and no frame is drawn while a window rests or is hidden. So those pages' GPU textures stayed resident until the next drawn frame'supload_images.Changes
Renderer::rest_images(&ImageAtlas) -> bool(render/upload.rs): shortensself.imagesto the atlas's page count and drops the texture of every page whosedatais empty. When anything was dropped it also clears the layers' image bind groups and bumpsimages_changed(), asclear_imagesdoes.Host::give_back(window/host/lifecycle.rs) andOverlayCore::give_back(overlay/lifetime.rs) call it right afterrt.images.rest()and beforerenderer.give_back(...), so withallthe existing submit/poll (window) orretire_now(overlay) releases the memory.changelog/unreleased/2026-11-25-rest-drops-image-textures.md.Pages still on screen keep their textures, including on
GiveBackAll. The issue also suggestedclear_images()on hidden/covered windows; I left that out because it would make a covered window re-upload every visible image when it comes back. Happy to add it if that trade-off is wanted.Tests
render::image_tests::rest_drops_textures_of_freed_image_pages: a shelf-page image and an oversized standalone-page image are uploaded. The small one leaves the view, thenrest()+rest_images. Checks: the freed page's texture is dropped, the lengths match, the page still showing keeps its texture, a second call drops nothing, and the image re-uploads when it comes back.RUNE_ALLOW_NO_GPU=1 cargo test -p rune --features rune/test-gpu-noop --lib --no-fail-fast: 3002 passed, 0 failed, 13 ignored (wgpu no-op backend; no GPU in the test environment, so real VRAM use was not measured). The full AGENTS.md command, which also covers rune-mermaid and rune-kit, was not run.cargo check -p rune --all-targetsandcargo clippy -p rune --libreport nothing on the changed lines;scripts/file-size.shreports no errors.Fixes #2102