GPU: a texture's levels on demand keep their tiles while anything names the texture (#776) #795
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/795"
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 fxceless/victory-fork. Originally posted by LeonardoS11 on 2026-11-25T08:07:38Z.
Fixes the device loss of #776.
The defect
VICTORY_LEVELS_ON_DEMAND=1a texture's memory is tiles in heaps of the pool (tiles.rs), not memory of the resource.ID3D12Resourceit names (HostList::keep), not the host copy. For a committed texture that reference holds the memory. For a reserved one it holds nothing.Tiled's drop gives the tiles back at once. They are handed to other textures, and a heap whose tiles are all free goes back to the card, while a list still to run reads through the old texture's mappings.This is still so on
9376fd6: the fixes that came with #747 are others.The change
A host copy let go hands its texture and tiles to a list (
tiles::let_go). The tiles go back to the pool when nothing but that list names the texture (tiles::give_back_let_go, at every sweep), and at once if nothing does already. 86 lines intiles.rs,resource.rs,host.rs.Tested
Windows 11, RTX 3080 Ti 12 GB, 64 GB RAM,
diagbuild withdiagnostics.a_texture_kept_by_a_list_keeps_its_tiles): a texture is given tiles, a clone of the resource is kept as a list would, the copy is let go; the tiles wait while the clone lives, also across agive_back_let_go, and go back when it is dropped; a texture nothing else names gives them back at once. Passes on the software adapter with the debug layer and on the card (VICTORY_TILES_TEST_CARD=1: "all steps passed ON THE CARD").VICTORY_LEVELS_ON_DEMAND=1 VICTORY_CARD_ROOM_FOR_BUFFERS=1:8dd30ab8dd30ab+ this changeFrame times with the change: 292, 274, 279, 272 ms (269 without it), so it costs nothing I can measure.
Caveats. The game runs were made with this change on
8dd30ab, before it was rebased onto9376fd6and before step 8 was added; the rebase had one conflict, in a doc comment. On the rebased commit I ran the test above, not the game yet. And 1 loss in 3 against 0 in 4 is few launches: two of the four had the condition of the loss (a heap given back) and went on, which is the stronger sign.No title data in this PR.
🤖 Generated with Claude Code
Imported from fxceless/victory-fork. Originally posted by LeonardoS11 on 2026-11-25T09:02:59Z.
Game runs of the rebased commit (
32772d9on9376fd6), same scene and card,VICTORY_LEVELS_ON_DEMAND=1, 300 s each: 2 runs, no device loss, 326 and 322 ms a frame; the second ended with "the pool's heaps 576 MB (1 given back to the card so far)", so it went through the condition of the loss. That closes the first caveat above. (Runs by me; written with Claude Code.)Imported from fxceless/victory-fork. Originally posted by MamaLeVrai on 2026-11-25T10:20:24Z.
Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head
32772d9intomain9376fd6in a throwaway tree (no conflict).cargo clippy --workspace --all-targets --locked -- -D warningsfails with exactly the errorsmainitself has on this machine (placed_filler_twinsnever used,depth_writtennever read, invictory-gpu); with--all-featuresit fails with the same number of errors asmain(4). This PR adds none and removes none.cargo test --workspace --locked: 540 passed, 0 failed, 10 ignored, two runs (mainalone: 540 passed, 0 failed, 10 ignored). The title was not run, so this says nothing about in-game effect. No game data.AI-assisted (Claude Code); no game data.
Imported from fxceless/victory-fork. Originally posted by LeonardoS11 on 2026-11-27T03:59:08Z.
Added one commit (
6d2265a): a let-go texture's tiles now waitVICTORY_TILES_HOLD_FRAMES(default 3) frames after nothing names it, before they go back.Why: in one run the device was lost about 0.7 s after a sweep that let go of 144 copies at once; the tiles were handed back while a frame still in flight could read them. Holding them a few frames removes that window.
cargo checkpasses.AI-assisted (Claude in Claude Code).
🤖 Generated with Claude Code
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.