Repository navigation
fix(image): release CPU ImagePage shadow buffers after GPU upload - #2688
Merged
Merged
Conversation
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.
Addresses #163
Summary
Staging::write_texture_rect,DirectTextureRect, and Metalreplace_texture_rect/write_texture_rect_in_place) so individual image slots upload directly to GPU textures without requiring a full-page CPU row buffer.ImagePage::datain GPU mode (ImageAtlas::set_backing(Backing::Gpu)/release_cpu_pages). GPU-first windows and overlays switch toBacking::Gpubefore frame 0 (never allocatingImagePage::datainImagePage::neworImagePage::allocate), andRenderer::upload_imagesautomatically releases any existing CPU page buffers after uploading.rest()shrinking,give_back(true)hide/wake,invalidate(), andstaging.lost()re-upload all live slots directly from theirPixelshandles (Slot::live) plus any in-frame pending snapshots.ImagePage::is_active()andImagePage::pixel_bytes()decouple page liveness andIMAGE_ATLAS_MAX_BYTES/IMAGE_ATLAS_MAX_PAGESbounds frompage.data.len().cpu_boot::Scene::newcontinues borrowingImagePage::datawith zero allocation during CPU-boot (and Windows handover keeps CPU backing viaupload_images_retaining_cpuuntilSurfaceMode::Handedcommits), and falls back to on-demandImageAtlas::read_page_rgbaif called on a GPU-released atlas.Verification
cargo test -p rune-staging --lib(12 passed, includingwrite_texture_rect_writes_unaligned_subrects_without_clobbering_neighbors)cargo test -p rune-image --lib pixels::(28 passed, includinggpu_backing_holds_zero_cpu_page_bytes_and_uploads_dirty_rects_and_full_rebuilds)cargo test -p rune --lib render::upload::tests(13 passed, includinggpu_upload_drops_cpu_page_buffers_and_survives_growth_device_loss_and_cpu_paint)cargo test -p rune --lib render::image_tests(15 passed),overlay::rest_tests(6 passed),render::cpu_boot::(28 passed),--test pixels_streaming(3 passed)cargo check -p rune-staging -p rune-image -p rune --target wasm32-unknown-unknown(passed)mallocrerun on Images: every atlas page keeps a CPU copy beside its GPU texture #163).