GPU: a texture's levels on demand keep their tiles while anything names the texture (#776) #795
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!795
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@LeonardoS11 on GitHub · 2026-11-25 08:07 UTC · original
LeonardoS11:fix/levels-heap-release→main· +86 −0 · 3 files · 1 commits · openFixes 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
@LeonardoS11 on GitHub · 2026-11-25 09:02 UTC · original
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.)@MamaLeVrai on GitHub · 2026-11-25 10:20 UTC · original
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.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.