GPU: textures the host refused for lack of memory are tried again, a bounded number of times #241

Open
fffluffy-dev wants to merge 1 commit from upstream-pr/241 into main
fffluffy-dev commented 2026-11-24 22:58:51 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by fffluffy-dev on 2026-11-24T22:58:51Z.


When host_texture failed, the texture was marked refused for good, and a failed slot still counted as made, so it read zeros (black) for the rest of the run even after memory freed. Marvisak/VIctory#1226 shows E_OUTOFMEMORY (0x8007000E) on ordinary textures under commit pressure; #109 shows an 8 GB card at its budget.

  • Only E_OUTOFMEMORY is retried: after 1 s, doubling, at most 8 more tries (the last about 4 minutes after the first), then given up as before. Every other failure (E_INVALIDARG, any DXGI_ERROR_DEVICE_*, no code) keeps today's behaviour, and a device removal on a later try ends the retries.
  • At most one attempt per texture per back-off window, decided under its own lock; no driver call on the per-draw path until the window opens.
  • A slot made null while its texture waits for a retry counts as not made (refused_for_now in descriptor/host.rs): it is remade when the texture is made, read through a table, or looked at again by the picked-by-index pass 16 frames later.
  • REFUSALS counts refusals, permanent refusals, late successes and give-ups (not printed yet); "host texture made on a later try" is logged once per recovery.

Not covered: depth twins, and slots picked by index with VICTORY_LAZY_TEXTURES=0.

Validation (cargo-xwin, tests under Wine): cargo test -p victory-gpu 111 passed, 1 ignored, new test only_a_lack_of_memory_is_tried_again_and_not_for_ever; clippy clean both ways; policy ok. Not run on a card under memory pressure.

AI use: written with Claude Code (Claude Opus 5.5); reviewed and posted with my approval. No game files were used.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6593110021 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/241). Originally posted by [fffluffy-dev](https://github.com/fffluffy-dev) on 2026-11-24T22:58:51Z. --- When `host_texture` failed, the texture was marked refused for good, and a failed slot still counted as made, so it read zeros (black) for the rest of the run even after memory freed. Marvisak/VIctory#1226 shows `E_OUTOFMEMORY` (0x8007000E) on ordinary textures under commit pressure; #109 shows an 8 GB card at its budget. - Only `E_OUTOFMEMORY` is retried: after 1 s, doubling, at most 8 more tries (the last about 4 minutes after the first), then given up as before. Every other failure (`E_INVALIDARG`, any `DXGI_ERROR_DEVICE_*`, no code) keeps today's behaviour, and a device removal on a later try ends the retries. - At most one attempt per texture per back-off window, decided under its own lock; no driver call on the per-draw path until the window opens. - A slot made null while its texture waits for a retry counts as not made (`refused_for_now` in descriptor/host.rs): it is remade when the texture is made, read through a table, or looked at again by the picked-by-index pass 16 frames later. - `REFUSALS` counts refusals, permanent refusals, late successes and give-ups (not printed yet); "host texture made on a later try" is logged once per recovery. Not covered: depth twins, and slots picked by index with `VICTORY_LAZY_TEXTURES=0`. Validation (cargo-xwin, tests under Wine): `cargo test -p victory-gpu` 111 passed, 1 ignored, new test `only_a_lack_of_memory_is_tried_again_and_not_for_ever`; clippy clean both ways; policy ok. Not run on a card under memory pressure. **AI use:** written with Claude Code (Claude Opus 5.5); reviewed and posted with my approval. No game files were used.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/241:upstream-pr/241'
git switch 'upstream-pr/241'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/241'
git switch 'upstream-pr/241'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/241'
git switch 'upstream-pr/241'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/241'
git switch 'main'
git merge --squash 'upstream-pr/241'
git switch 'main'
git merge --ff-only 'upstream-pr/241'
git switch 'main'
git merge 'upstream-pr/241'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork!241
No description provided.