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

Manually merged
github merged 1 commit from github-bot/gh-2486 into main 2026-11-30 14:14:24 +00:00 AGit
Owner

@⁠eljoviz on GitHub · 2026-11-29 13:31 UTC · original
eljoviz:fix/slot-evict-busy-shader-model-and-launchers → main · +24 −9 · 6 files · 1 commits · merged 2026-11-30 14:12 UTC

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
**@⁠eljoviz** on GitHub · 2026-11-29 13:31 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2486) `eljoviz:fix/slot-evict-busy-shader-model-and-launchers` → `main` · +24 −9 · 6 files · 1 commits · merged 2026-11-30 14:12 UTC ## 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**
- victory-gpu (resource): honor the busy flag returned by descriptor::evict_slots in slot_evict so textures with active slot creation on another thread are skipped (incrementing SLOT_EVICT[6]) instead of being evicted.
- victory-gpu (streamline): use the adapter returned by game_adapter() in highest_shader_model instead of discarding it and re-querying hardware_adapter().
- victory-gpu (card_steps): clear the test page range in late::PAGES via late::forget before running places_written_after_sending_are_learned and fills_done_on_the_cpu_are_learned_too so parallel test runs do not collide on reused heap pages.
- victory-gpu (font): remove unreachable duplicate b'%' arm in the F3 panel bitmap font.
- PLAY_FRAMEGEN.cmd: preserve %errorlevel% before pause in the check branch so failed checks do not exit with 0.
- PLAY_FACES_FIX.cmd: default to Windows powershell and use pwsh only when available instead of failing when PowerShell 7 is not installed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 13:34:02 +00:00
github manually merged commit 6511e7d009 into main 2026-11-30 14:14:24 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!2486
No description provided.