GPU: back off texture heap growth after out-of-memory #3266
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3266
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3266"
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?
@yumaste on GitHub · 2026-11-26 15:05 UTC · original
yumaste:fix/texture-heap-growth-backoff→main· +71 −15 · 1 files · 1 commits · openWhen D3D12 refuses a new 64 MiB placement heap with E_OUTOFMEMORY, each subsequent small texture can otherwise repeat that driver call before trying a committed texture.
Wait 500 ms before attempting another full heap after that specific error. Free ranges in existing heaps are still considered first. A miss still returns to the existing committed-texture path, and other HRESULTs do not activate the delay. The timer starts when the failed call returns. The policy uses the same D3D12 API on all adapters.
In a synthetic burst of 64 requests following a refusal, the allocator calls the heap factory once instead of 64 times. The regression verifies that allocation is retried when the delay expires and that a free range is reused during the delay in an actual D3D12 heap. WARP GPU suite passed (247 passed, one ignored) and strict Clippy passed. The new regression also passed on a physical NVIDIA RTX 5080 Laptop GPU with both PRs applied. AMD hardware validation remains open. No title files were used.
Clean trial merges with #3259, #3265, #3230, #3228 and #2972. #3259 covers upload staging buffers, while this change covers the default heaps that hold the textures themselves.
Inspired by codec_d's pool-growth backoff in cool_fox.
@Dukestar69 on GitHub · 2026-11-26 15:07 UTC · original · approved these changes
Reviewed the diff and verified locally on Windows 11 x64 (RTX 5090 + WARP):
CreateHeapattempts for 500 ms afterE_OUTOFMEMORYwhile continuing to reuse freed heap ranges and letting callers fall back to committed textures avoids repeated failing heap allocations under VRAM pressure.cargo test -p victory-gpu --lib placement:: -- --test-threads=1(RTX 5090): 3 passed, 0 failed (includingout_of_memory_backs_off_growth_but_not_reuse).VICTORY_FORCE_WARP=1 cargo test -p victory-gpu --lib placement:: -- --test-threads=1(WARP): 3 passed, 0 failed.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@oni-swr on GitHub · 2026-11-26 16:10 UTC · original
WARP verification report (test report only, no code changes)
87c6d35063bcca43(control); WARP software adapter forced withVICTORY_WARP=1 VICTORY_D3D12_WARP=1,--features diagnostics, d3d10warp.dll 10.0.26100.9818; dxil.dll 1.8.2502.11 (Windows Kit 10.0.26100.0, viaVICTORY_DXIL).--exact),-j 4, synthetic tests only, no game data. Command:cargo test -p victory-gpu --lib --features diagnostics -j 4 -- --exact <test>.placement::tests::out_of_memory_backs_off_growth_but_not_reuse(also the changedplacement::tests::a_range_is_reused_only_once_nothing_holds_its_texture): both pass on the PR (1 passed each). The test's WARP-device part (reuse of a free range while growth is backed off) ran.now/makeparameters ofHeaps::allocate, so I added only that hook to main and left out the backoff logic. The test fails on main atassert_eq!(calls.get(), 1)(left 64, right 1: 64 heap creations for 64 refused allocations instead of 1). That is a main-plus-hook control, not unmodified main.victory-gpulib suite: PR 247 passed, 0 failed, 1 ignored on 8 of 9 runs; main 246 passed, 0 failed, 1 ignored on 6 of 6. One full-suite run of the PR (the first) had 1 failure,descriptor::host::tests::a_slot_rewritten_while_its_view_is_prepared_views_the_new_record(the slot views the record written last); it passed on its own and in 8 full-suite reruns. This PR does not touch descriptors. That test sets a globalWHILE_PREPARINGhook that other tests share, which #3265 moves to a thread-local, so this may be a pre-existing flake; I did not reproduce it on main (6 runs).AI-assisted: verification by Claude Code (Claude Sonnet 5.5)
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.