Fix slot_evict busy race, highest_shader_model adapter reuse, card_steps test isolation, and launcher scripts #2486

Merged
eljoviz merged 1 commit from upstream-pr/2486 into main 2026-11-30 14:12:02 +00:00
eljoviz commented 2026-11-29 13:31:37 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by eljoviz on 2026-11-29T13:31:37Z.


Summary

This PR fixes several small correctness, concurrency, test-isolation, and Windows launcher bugs found while testing and auditing the repository on Windows 11 + NVIDIA GeForce RTX 3070 Ti:

  1. Honor busy flag in slot_evict (crates/victory-gpu/src/resource.rs)

    • crate::descriptor::evict_slots returns (reset, busy) where busy = true indicates another thread is currently building a descriptor slot for that texture (HostHeap::texture_slot_evicted returned None), meaning the texture is in use and its host copy must stay.
    • Previously busy was ignored in slot_evict, allowing the host copy to be unstaged and retired while another thread was actively creating a slot for it. Now, when busy is true, we increment SLOT_EVICT[6] and continue without evicting the texture.
  2. Use game_adapter() result in highest_shader_model (crates/victory-gpu/src/streamline.rs)

    • highest_shader_model() called let (adapter, _) = game_adapter()?;, then left adapter unused and re-queried victory_shader::emit::host::hardware_adapter() separately.
    • Now D3D12CreateDevice is called directly with the adapter returned by game_adapter(), only falling back to EnumAdapters1(0) if device is still None.
  3. Isolate late::PAGES in card_steps unit tests (crates/victory-gpu/src/host/card_steps.rs)

    • places_written_after_sending_are_learned and fills_done_on_the_cpu_are_learned_too allocate heap buffers and inspect the global late::PAGES set. When tests run in parallel, freed heap pages can be reused across tests and trigger a false failure on !late::written(...).
    • Added a #[cfg(test)] helper late::forget(from, to) and called it on the allocated test page range at the start of both tests.
  4. Remove unreachable duplicate b'%' match arm (crates/victory-gpu/src/host/font.rs)

    • Removed the shadowed duplicate b'%' pattern in the F3 panel bitmap font.
  5. Preserve exit code across pause in PLAY_FRAMEGEN.cmd

    • In the check branch, pause resets %errorlevel% to 0 before exit /b %errorlevel%. Saved RC=%errorlevel% before pause and exited with exit /b %RC% so failed checks propagate a non-zero exit code as documented.
  6. Fallback to Windows powershell in PLAY_FACES_FIX.cmd

    • PLAY_FACES_FIX.cmd hardcoded pwsh (PowerShell 7), failing on stock Windows 10/11 systems without PowerShell 7 installed. Matched PLAY_FRAMEGEN.cmd by defaulting to powershell and upgrading to pwsh when available on PATH or in C:\Program Files\PowerShell\7\pwsh.exe.

Verification (Windows 11, NVIDIA GeForce RTX 3070 Ti 8 GB)

  • cargo test -p victory-gpu --lib: 915 passed, 0 failed (57 ignored)
  • cargo test -p victory-shader --lib: 462 passed, 0 failed (9 ignored, executed on RTX 3070 Ti)
  • cargo test -p victory --tests: 81 passed, 0 failed
  • cargo test -p victory-loader --lib: 75 passed, 0 failed
  • cargo test -p victory-pe --lib: 36 passed, 0 failed
  • cargo test -p victory-pipeline --lib: 13 passed, 0 failed
  • cargo build --release --locked -p victory & target\release\victory.exe shader-model: built cleanly and reported NVIDIA GeForce RTX 3070 Ti / 6.8
  • PLAY_FRAMEGEN.cmd check < nul and PLAY_FACES_FIX.cmd < nul (tested without pwsh on PATH): both exited cleanly (EXIT_CODE=0)
  • python -m unittest test_faultbook.py (in scripts/): 4 tests OK
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5551202454 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2486). Originally posted by [eljoviz](https://github.com/eljoviz) on 2026-11-29T13:31:37Z. --- ## Summary This PR fixes several small correctness, concurrency, test-isolation, and Windows launcher bugs found while testing and auditing the repository on Windows 11 + NVIDIA GeForce RTX 3070 Ti: 1. **Honor `busy` flag in `slot_evict` (`crates/victory-gpu/src/resource.rs`)** - `crate::descriptor::evict_slots` returns `(reset, busy)` where `busy = true` indicates another thread is currently building a descriptor slot for that texture (`HostHeap::texture_slot_evicted` returned `None`), meaning the texture is in use and its host copy must stay. - Previously `busy` was ignored in `slot_evict`, allowing the host copy to be unstaged and retired while another thread was actively creating a slot for it. Now, when `busy` is `true`, we increment `SLOT_EVICT[6]` and `continue` without evicting the texture. 2. **Use `game_adapter()` result in `highest_shader_model` (`crates/victory-gpu/src/streamline.rs`)** - `highest_shader_model()` called `let (adapter, _) = game_adapter()?;`, then left `adapter` unused and re-queried `victory_shader::emit::host::hardware_adapter()` separately. - Now `D3D12CreateDevice` is called directly with the `adapter` returned by `game_adapter()`, only falling back to `EnumAdapters1(0)` if `device` is still `None`. 3. **Isolate `late::PAGES` in `card_steps` unit tests (`crates/victory-gpu/src/host/card_steps.rs`)** - `places_written_after_sending_are_learned` and `fills_done_on_the_cpu_are_learned_too` allocate heap buffers and inspect the global `late::PAGES` set. When tests run in parallel, freed heap pages can be reused across tests and trigger a false failure on `!late::written(...)`. - Added a `#[cfg(test)]` helper `late::forget(from, to)` and called it on the allocated test page range at the start of both tests. 4. **Remove unreachable duplicate `b'%'` match arm (`crates/victory-gpu/src/host/font.rs`)** - Removed the shadowed duplicate `b'%'` pattern in the F3 panel bitmap font. 5. **Preserve exit code across `pause` in `PLAY_FRAMEGEN.cmd`** - In the `check` branch, `pause` resets `%errorlevel%` to `0` before `exit /b %errorlevel%`. Saved `RC=%errorlevel%` before `pause` and exited with `exit /b %RC%` so failed checks propagate a non-zero exit code as documented. 6. **Fallback to Windows `powershell` in `PLAY_FACES_FIX.cmd`** - `PLAY_FACES_FIX.cmd` hardcoded `pwsh` (PowerShell 7), failing on stock Windows 10/11 systems without PowerShell 7 installed. Matched `PLAY_FRAMEGEN.cmd` by defaulting to `powershell` and upgrading to `pwsh` when available on `PATH` or in `C:\Program Files\PowerShell\7\pwsh.exe`. ## Verification (Windows 11, NVIDIA GeForce RTX 3070 Ti 8 GB) - `cargo test -p victory-gpu --lib`: **915 passed, 0 failed** (57 ignored) - `cargo test -p victory-shader --lib`: **462 passed, 0 failed** (9 ignored, executed on RTX 3070 Ti) - `cargo test -p victory --tests`: **81 passed, 0 failed** - `cargo test -p victory-loader --lib`: **75 passed, 0 failed** - `cargo test -p victory-pe --lib`: **36 passed, 0 failed** - `cargo test -p victory-pipeline --lib`: **13 passed, 0 failed** - `cargo build --release --locked -p victory` & `target\release\victory.exe shader-model`: built cleanly and reported `NVIDIA GeForce RTX 3070 Ti` / `6.8` - `PLAY_FRAMEGEN.cmd check < nul` and `PLAY_FACES_FIX.cmd < nul` (tested without `pwsh` on `PATH`): both exited cleanly (`EXIT_CODE=0`) - `python -m unittest test_faultbook.py` (in `scripts/`): **4 tests OK**
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
trustno1-coder/VIctory-NVIDIA!2486
No description provided.