GPU: a title texture's host texture is made on its first use (the first-use half of #431) #1967
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1969"
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 Marvisak/VIctory. Originally posted by AgneyaK on 2026-11-25T01:56:14Z.
Ports the first-use half of #431 (by @AntoninMichelq) onto current
main. #431 and #1526 closed each other as duplicates (see #431), so nothing open covered it. The other half of #431, freeing host objects only after running submissions, is already inmain(host::retire/release_retired).What
A title texture's host copy was made when the title created the resource. Most are never used by a list, and on small cards the unused ones spill into system RAM. With #431 on the older base, a 6 GB / 16 GB laptop's story load went from 22.7 to 18.2 GB private and from 7.2 to 3.7 GB of GPU memory in RAM. 0xKaji measured ~7.85 → ~5.39 GiB of host textures on an 8 GB card with #1526.
Resource.hostis aOnceLock.Resource::hostmakes the texture on first use, from the creation state and clear value kept with the resource (made_with), then registers it inTEXTURES_AT. Everyhost_resource/host_copy/host_transitionis a first use: views, targets, copies, barriers.host_madeinstead:current,alias_source(it holdsTEXTURES_AT), andDrop.texture_at(placed views) still makes its texture at once, as before.MEMORY(inshared_texture), thenTEXTURES_AT. Nothing takes them the other way round.Tested
Windows 11 26300, Rust 1.98.1, on
main940d32f:a_texture_gets_its_host_copy_on_first_use: no host texture at creation, made on the firsthost_resource, made once, registered by memory once made.cargo test -p victory-gpu --locked: 140 passed, 3 failed, the same 3 that fail onmainhere (the Intel Iris Xe the tests run on: the 2 heap-cap tests of #1744, and the castable test that #1765 fixes).cargo clippy --workspace --all-targets --locked -- -D warnings: clean.cargo xtask policy: ok.Not tested yet: the title on this exact tree. On NVIDIA,
mainstops at boot without #1763 (#1754), so a title run needs that too. I'll post the numbers here once I have them.AI use: Claude Code (Claude Opus 5.5) ported the change (from a local port made earlier in the same setup), wrote the test and ran the checks; the results are from the runs described.
🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T02:10:33Z.
Review: COMMENTED
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
Title texture's host texture made on first use: lazy texture creation — memory win; check first-use stall.
Imported from Marvisak/VIctory. Originally posted by AgneyaK on 2026-11-25T02:06:34Z.
In-title result, and it's weaker than I hoped, so here it is plainly.
Setup: RTX 3050 6 GB Laptop, 16 GB RAM.
main940d32f+ #1763 (NVIDIA stops at boot without it, #1754), with and without this PR. Diag build, a local NVIDIA-adapter patch (not in any PR), scripted Enter into the story. An outside guard killed the game when free RAM fell under 800 MB (this laptop blue-screened in the NVIDIA driver at ~24 GB private earlier tonight).So at boot it saves ~1–4%, not the 20% that #431 gave on the old base. The reason:
descriptor::sync_heapsnow mirrors every slot of the title's view heap before each submission, and making a slot's view (descriptor/host.rsmake,View::Shader→host_copy) is a first use. So every texture that has a descriptor is made at once, used or not. By frame 256 this PR already has 1,515 host textures.What it may still save: textures made after the heap is mirrored and never put in a slot. An earlier local run of the same change on
70564ae(another session on this laptop, not repeated tonight) had 4,852 instead of 8,777 MB of host textures at the same point of the story load. I could not get that far safely tonight: on both profiles free RAM drops by ~3 GB in a few seconds as the story starts, and the guard stopped every run there.To get #431's old effect on current
main, the mirror would have to stop making textures: a slot's view made only when a list or a heap-indexing draw can reach it. That's a bigger change than this PR. I'm happy to close this one if you'd rather not take it on its own.AI use: Claude Code (Claude Opus 5.5) ran these builds and wrote this; the results are from the runs described.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T08:24:53Z.
Automated triage for the maintainers.
This pull request no longer merges cleanly into
main(conflicts incrates/victory-gpu/src/resource.rs). It will be reviewed once it is rebased onto the currentmain. The earlier verdict (needs work) was for an older state ofmain.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by Slay326 on 2026-11-25T14:13:09Z.
On an RTX 3070,
draw::tests::a_texture_written_in_one_format_reads_in_another_through_a_placed_viewfails with this PR alone on940d32f(round 0: one host texture); it passes onmain.mainhas one.AI-assisted.
Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-25T14:39:51Z.
Second RTX 3070 confirming Slay326's failure.
001c153(as-is, onmain940d32f), driver 616.56, Windows 11, debug:draw::tests::a_texture_written_in_one_format_reads_in_another_through_a_placed_view --exact, 3 runscargo test -p victory-gpu --lockedmain940d32fdraw.rs:2185,round 0: one host texture(leftfalse, righttrue)The 2 failures on
mainare the same on both trees (dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_views). The extra one with the PR is this test. NoSKIPPEDlines.AI-assisted (Claude Code). Synthetic tests only.
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.