leonida-gpu: an amount DLSS-G refused is asked again at the next poll (D3D12-FG-OPTIONS-RETRY) #3518

Code

Clone this repository

Checkout

From your project repository, check out a new branch and test the changes.

git fetch -u  "fg-options-retry:pastel-fg-options-retry"
git switch "pastel-fg-options-retry"
Open
leonida/mandy
pastel wants to merge 1 commit from pastel/mandy:fg-options-retry into main

This branch is out-of-date with the base branch

Conversation
Reviewers 0 approvals
  • No reviewers
Details
This pull request is blocked because it's outdated.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'fg-options-retry:pastel-fg-options-retry'
git switch 'pastel-fg-options-retry'
First-time contributor

Claimed in #3312 as D3D12-FG-OPTIONS-RETRY (#3312 (comment)). Follow-up left open on #3216 (found by @merzleckeier while looking at #3328).

What and why

present_start (d3d12/crates/leonida-gpu/src/fg.rs) set State::set = Some(want) after dlssg_set_options whatever it returned. When DLSS-G refused a request:

  • the next poll saw the amount as applied and never asked again;
  • the followed limit (s.set.unwrap_or(0)) and effective_frames(.., s.set) worked from an amount DLSS-G did not have;
  • a refused turn-off still reset SHOWN and cleared the HUD-less copies while generation went on.

This change removes that cause:

  • State::answered keeps the amount only when the call succeeds, so a refused one still differs from State::set and is asked again at the next poll.
  • After the first request, polls stay every 8th present even while nothing was taken (State::asked); before, set.is_none() would have asked on every present.
  • The disable cleanup and the success logs run only on success.
  • A refusal is warned for the first five in a row (State::refused), the count resetting on success.

Tested

  • cargo test -p leonida-gpu --locked: 792 passed, 0 failed (Windows 11, RTX 5060 8 GB, 621.01). New tests: fg::defer_enable_tests::a_refused_amount_is_asked_again_at_the_next_poll (drives State::polls, effective_frames and State::answered against a DLSS-G that refuses N requests) and refusals_are_said_five_in_a_row_and_again_after_one_is_taken.
  • Red: with main's behaviour put back one at a time, the new test fails. Recording the amount as taken on a refusal fails with left: Some(5), right: Some(0). Polling on every present while nothing was taken fails with left: [1, 2, 3], right: [1, 3, 8].
  • cargo clippy -p leonida-gpu --locked --tests: no warnings. python -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/fg.rs: pass.
  • Two read-only reviewer passes (Claude Opus 5.5): nothing that must change. Their nits were applied: the test goes through State's methods, and the log count resets on success.
  • Not tested: a game run where DLSS-G actually refuses a request. I know of no way to make Streamline refuse on demand, so the failure path is covered by the unit tests only.

GPUs tested: NVIDIA RTX 5060 8 GB, 621.01, Windows 11 (unit tests only).

AI-assisted: yes (Claude Code, Claude Opus 5.5).

🤖 Generated with Claude Code

Claimed in #3312 as `D3D12-FG-OPTIONS-RETRY` (https://clearfieldswimming.com/leonida/mandy/issues/3312#issuecomment-26851). Follow-up left open on #3216 (found by @merzleckeier while looking at #3328). ### What and why `present_start` (`d3d12/crates/leonida-gpu/src/fg.rs`) set `State::set = Some(want)` after `dlssg_set_options` whatever it returned. When DLSS-G refused a request: - the next poll saw the amount as applied and never asked again; - the followed limit (`s.set.unwrap_or(0)`) and `effective_frames(.., s.set)` worked from an amount DLSS-G did not have; - a refused turn-off still reset `SHOWN` and cleared the HUD-less copies while generation went on. This change removes that cause: - `State::answered` keeps the amount only when the call succeeds, so a refused one still differs from `State::set` and is asked again at the next poll. - After the first request, polls stay every 8th present even while nothing was taken (`State::asked`); before, `set.is_none()` would have asked on every present. - The disable cleanup and the success logs run only on success. - A refusal is warned for the first five in a row (`State::refused`), the count resetting on success. ### Tested - `cargo test -p leonida-gpu --locked`: 792 passed, 0 failed (Windows 11, RTX 5060 8 GB, 621.01). New tests: `fg::defer_enable_tests::a_refused_amount_is_asked_again_at_the_next_poll` (drives `State::polls`, `effective_frames` and `State::answered` against a DLSS-G that refuses N requests) and `refusals_are_said_five_in_a_row_and_again_after_one_is_taken`. - Red: with `main`'s behaviour put back one at a time, the new test fails. Recording the amount as taken on a refusal fails with `left: Some(5), right: Some(0)`. Polling on every present while nothing was taken fails with `left: [1, 2, 3], right: [1, 3, 8]`. - `cargo clippy -p leonida-gpu --locked --tests`: no warnings. `python -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/fg.rs`: pass. - Two read-only reviewer passes (Claude Opus 5.5): nothing that must change. Their nits were applied: the test goes through `State`'s methods, and the log count resets on success. - Not tested: a game run where DLSS-G actually refuses a request. I know of no way to make Streamline refuse on demand, so the failure path is covered by the unit tests only. GPUs tested: NVIDIA RTX 5060 8 GB, 621.01, Windows 11 (unit tests only). AI-assisted: yes (Claude Code, Claude Opus 5.5). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
`present_start` recorded the amount it asked `dlssg_set_options` for as
taken even when the call failed, so the next poll saw it as applied and
never asked again, and the followed limit and the disable cleanup worked
from a value DLSS-G did not have. The amount is now kept only when the
call succeeds; after the first request, polls stay every 8th present
even while nothing was taken; the disable cleanup runs on success only;
refusals are warned for the first five in a row.

Found by merzleckeier on #3216 while looking at #3328.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
First-time contributor

Verified at head d998190f, merge base 93b9d90a. The two new tests are absent on the base (git grep -F for each name at 93b9d90a: no match); polls_on_first_present_on_first_inputs_and_every_eighth_present exists there and is updated in place, so the new evidence is the two below.

cargo test -p leonida-gpu --locked --lib fg::defer_enable_tests::a_refused_amount_is_asked_again_at_the_next_poll -- --exact
#   test ...a_refused_amount_is_asked_again_at_the_next_poll ... ok   1 passed; 851 filtered out
cargo test -p leonida-gpu --locked --lib fg::defer_enable_tests::refusals_are_said_five_in_a_row_and_again_after_one_is_taken -- --exact
#   test ...refusals_are_said_five_in_a_row_and_again_after_one_is_taken ... ok   1 passed; 851 filtered out
cargo test -p leonida-gpu --locked --lib fg::defer_enable_tests::
#   7 passed; 0 failed
cargo test -p leonida-gpu --locked --lib fg::
#   23 passed; 0 failed; 0 ignored

git diff --check against 93b9d90a: clean. scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/fg.rs: clean.

What the tests pin. poll_against drives [State] the way present_start does: a refused amount stays different from State::set, so it is asked again at the next present should_poll_options allows (x1→x6 and x6→x1 each asked on presents 8 and 16; with no amount yet, on 1, then at the first inputs on 3, then every 8th present), an amount taken at once is asked once, and the refusal warning is the first five in a row but comes back after one is taken. The refused turn-off no longer reaching the SHOWN/hudless clear is in the diff, not covered by these unit tests.

Limits. Unit-level only: no device and no DLSS-G here, so a real dlssg_set_options refusal path is not reproduced; the tests model "not taken" as a bool.

AI-assisted (Hy4 flash). GPU: RTX 5060 Laptop (driver 621.40) and Radeon 780M present, unused (no test creates a device). No game data used or needed.

Verified at head d998190f, merge base 93b9d90a. The two new tests are absent on the base (`git grep -F` for each name at 93b9d90a: no match); `polls_on_first_present_on_first_inputs_and_every_eighth_present` exists there and is updated in place, so the new evidence is the two below. ```powershell cargo test -p leonida-gpu --locked --lib fg::defer_enable_tests::a_refused_amount_is_asked_again_at_the_next_poll -- --exact # test ...a_refused_amount_is_asked_again_at_the_next_poll ... ok 1 passed; 851 filtered out cargo test -p leonida-gpu --locked --lib fg::defer_enable_tests::refusals_are_said_five_in_a_row_and_again_after_one_is_taken -- --exact # test ...refusals_are_said_five_in_a_row_and_again_after_one_is_taken ... ok 1 passed; 851 filtered out cargo test -p leonida-gpu --locked --lib fg::defer_enable_tests:: # 7 passed; 0 failed cargo test -p leonida-gpu --locked --lib fg:: # 23 passed; 0 failed; 0 ignored ``` `git diff --check` against 93b9d90a: clean. `scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/fg.rs`: clean. **What the tests pin.** `poll_against` drives [`State`] the way `present_start` does: a refused amount stays different from `State::set`, so it is asked again at the next present `should_poll_options` allows (x1→x6 and x6→x1 each asked on presents 8 and 16; with no amount yet, on 1, then at the first inputs on 3, then every 8th present), an amount taken at once is asked once, and the refusal warning is the first five in a row but comes back after one is taken. The refused turn-off no longer reaching the `SHOWN`/hudless clear is in the diff, not covered by these unit tests. **Limits.** Unit-level only: no device and no DLSS-G here, so a real `dlssg_set_options` refusal path is not reproduced; the tests model "not taken" as a bool. AI-assisted (Hy4 flash). GPU: RTX 5060 Laptop (driver 621.40) and Radeon 780M present, unused (no test creates a device). No game data used or needed.
Sign in to join this conversation.
No description provided.