Textures: VICTORY_TEXTURES_IN_PC=1 places streamed textures in system memory when the card is full #3070
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3070"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Adriwin06 on 2026-11-29T19:52:54Z.
What it changes
Off by default. When a streamed texture's host copy cannot be placed
on the card (the budget has no room for it), VICTORY_TEXTURES_IN_PC=1
places it in system memory instead of failing the upload: in a
non-local (L0) custom heap where the adapter supports one, cut from a
pool of 16 MiB system-memory blocks (PC_TEXTURES, reclaimed with the
staging pool), or as a committed allocation of just the texture's size
when a new block would not fit. Admission keeps headroom in the shared
budget (pc_texture_room), the local-VRAM admission still comes first,
and a transient allocation failure is retried. The first spill is
logged once.
Tests: resource::system_texture_admission_keeps_shared_budget_headroom,
resource::system_texture_uses_a_nonlocal_heap_when_the_adapter_supports_it.
Ported from readmet3xt-lab/foxhound@7c53527 (readmet3xt-lab), ba04392
and 5b6ebb4 (dilim), GPL-3.0-or-later.
How it was tested
cargo testpassed for the crates it touches:cargo test -p victory-gpu --lib -- resource:: pool::: 73 passed. host::uav_pool::tests::host_list_uav_pool_lifecycle_retire_trim_and_info_queue fails now and then when it runs beside the resource:: tests, on main as on this branch (1 run in 4 on each here): it reads the process-wide UAV spare poolcargo clippy --workspace --all-targets --locked: no finding that main does not already have (main has 34 of its own, which is why the Clippy step of CI is red on main itself).cargo xtask policy: no new finding (main fails it on crates/victory-loader/src/heap_sites/frame_users.rs).cargo clippyalso with--all-featuresadds no finding, andcargo test --workspace --lockedfails only tests main also fails on this machine: the five shader tests that fail on main here too (WARP's SM 6.2 and the validator) (barycentric_tests::first_half_values_render_on_hardware_and_warp, hw_tests::split_lds_wave32_read_after_read_barrier_coalescing_and_parity, intersect_tests::flat_global_stores_and_atomics_fence_uavs_at_group_barriers_across_waves, rect::tests::rectangles_are_drawn_whole, rect::tests::the_rectangle_stage_is_a_geometry_shader) and xtask's repository_passes_policy (frame_users.rs). 2208 passed, including five that fail on main (three BCPack oracle tests, the menu save race, the shader key test).Checked for overlap
None found for placing streamed textures in system memory (searched "system memory textures", "spill", "L0"). Touches the same alignment line as #3069 (small-alignment) (one line to merge).
🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Copilot on 2026-11-29T19:57:20Z.
Code review location:
crates/victory-gpu/src/draw.rs; line 4455If system-memory allocation is temporarily refused for a differently formatted view of a host-written texture, the retry can lose its source contents.
seed_pendingremoves the seed before attempting allocation (texture.rs:869–880), so a later successful allocation has nothing to copy and title-memory uploads are skipped for this view. Preserve the seed until its copy is recorded, and keep the descriptor pending while seeding fails.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Copilot on 2026-11-29T19:57:21Z.
Code review location:
crates/victory-gpu/src/pool.rs; line 1232roomis a captured DXGI usage sample, buttake_from_with_growthreleases the pool lock before this check. Concurrent uploads can each allocate a 16 MiB block against the same 16 MiB allowance, crossing the 75% shared-budget ceiling; committed fallbacks inresource::host_texture_asshare this issue. Reserve pending bytes across both allocation paths, release reservations on failure, and reconcile successful allocations with usage samples before admitting further growth.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-29T19:57:21Z.
Review: COMMENTED
🟡 Changes recommended
Critical issues can lose host-written texture contents during allocation retries and let concurrent allocations exceed the shared-memory budget ceiling.
2 open issues
What changed in this PR
Adds an opt-in system-memory fallback for streamed textures when local video-memory admission rejects them, extending the GPU upload path without changing default behavior.
Changes:
VICTORY_TEXTURES_IN_PC=1with shared-budget checks and non-local texture allocations.crates/victory-gpu/src/resource.rscrates/victory-gpu/src/pool.rscrates/victory-gpu/src/draw.rsReview effort: Balanced
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Adriwin06 on 2026-11-30T01:10:19Z.
Code review location:
crates/victory-gpu/src/draw.rs; line 4455Fixed in
a8bec768:seed_pendingnow leaves the seed inSEEDSuntil the copy is recorded. Transient failures (no host texture yet, no buffer) keep it for the next use, a shape mismatch still drops it, and releases already clear it. In the texture pass, a system-memory slot is held whileseed_waits(resource)is true, so title memory is not uploaded instead.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Adriwin06 on 2026-11-30T01:10:22Z.
Code review location:
crates/victory-gpu/src/pool.rs; line 1232Fixed in
e5fc66e9: each system-memory block (in the pool's growth closure) and each committed fallback now takes aPcReservation. It adds its bytes toPC_ALLOCATINGfirst, takes a fresh DXGI sample, and goes ahead only if what is in use plus every allocation under way stays under 75% of the shared budget (fits_shared). The bytes are given back when the reservation drops, once the allocation is made (the next sample counts it) or refused. Regression test:allocations_under_way_share_one_allowance.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.