build, verify: fix MSVC /W4 warnings and resolve ordinal imports #169

Manually merged
github merged 1 commit from gh-pr/169/head into gh-pr/169/base 2026-11-26 06:35:56 +00:00
Owner

@⁠Vladimir-Human on GitHub · 2026-11-25 12:55 UTC · original
Vladimir-Human:build/msvc-w4-guest-narrowing → main · +70 −12 · 6 files · 1 commits · merged 2026-11-25 14:21 UTC

Summary

Unblock native Windows MSVC builds and Lanes GPU verification (tuxbox.py verify) without changing Linux/Proton behavior:

  • Fix MSVC /W4 /WX warnings in guest fixtures:
    • Split desc.SampleDesc.Count = 1 (UINT) from desc.DepthOrArraySize / desc.MipLevels (UINT16, C4244) in runtime/d3d12/buffer_import_guest.cpp and examples/lanes/screen.cpp.
    • Rename local profile to release_profile in runtime/d3d12/root_cbv_guest.cpp so it does not shadow frame_abi::profile (C4459).
    • Replace std::string::assign(wchar_t*, wchar_t*) on the ASCII PCI ID buffer with an explicit static_cast<char> loop in examples/lanes/course.cpp (C4244).
  • Add missing_provider_imports in project_tuxbox/verify.py to resolve #ordinal static import records produced by MSVC link.exe against .def @ordinal entries via export_table(provider), preserving fast-path matching for named imports and explicit #ordinal expectations (GameInput.dll #1).
  • Add unit tests in tests/test_verify.py (ProviderImportTests) covering fast-path named/ordinal checks, ordinal resolution against export_table, and negative cases for wrong/unknown ordinals and missing explicit #1.

Verified on Lanes

  • python tuxbox.py check passed on this branch (not fully runnable on Windows host: full unittest discover hits 5 pre-existing Linux-only fcntl/os.sched_getaffinity test errors, and lanes-shader-cache in project_tuxbox/verify.py is gated on host.backend == "proton"; equivalent build, Rust CI checks, Windows-compatible Python tests, and native lanes + lanes-selftest GPU gates passed below)
  • Changed or new behaviour is covered by a Lanes scenario, or the reason it cannot be is stated below (exercises lanes and lanes-selftest build & tuxbox.py verify ordinal-import verification; modified buffer_import_guest.cpp and root_cbv_guest.cpp are also verified directly on the GPU)

GPU, driver and backend: NVIDIA GeForce RTX 4070 SUPER (pci=10de:2783), NVIDIA driver 32.0.16.2114, Windows 11 native backend (MSVC 19.44.35207, Windows SDK 10.0.26100.0 DXC, Rust 1.95.0).

Paste the summary printed at the end:

python build.py lanes (xmem, d3d12, gameinput, lanes): exit 0
cl /W4 /WX on examples/lanes/{course,screen,input,game,selftest}.cpp: 0 warnings, exit 0
python tuxbox.py verify --only lanes --only lanes-selftest --backend native --output build/check/lanes.json:
PASS  lanes-xbox-replay             lanes-replay PASS pci=10de:2783 course=16/16 win=16/16 safe-miss=1 collision=1 frames=2 input=gameinput
PASS  lanes-selftest-labels         lanes-selftest PASS pci=10de:2783 scenario=labels passed=1
PASS  lanes-selftest-cross-queue    lanes-selftest PASS pci=10de:2783 scenario=cross-queue passed=1
PASS  lanes-selftest-compute-frame  lanes-selftest PASS pci=10de:2783 scenario=compute-frame passed=1
PASS  lanes-selftest-skipped-command lanes-selftest PASS pci=10de:2783 scenario=skipped-command passed=1
PASS  lanes-selftest-copy-memory    lanes-selftest PASS pci=10de:2783 scenario=copy-memory passed=1
PASS  lanes-selftest-shared-texture lanes-selftest PASS pci=10de:2783 scenario=shared-texture passed=1
(lanes-shader-cache is Linux/Proton-only under host.backend == "proton")

Also re-verified cherry-picked cleanly onto latest main (`bd8049f`, detached `728cc017` after `python build.py bvh` since `52292e6` added `XboxBvhBuilder.dll` to `build_target("lanes")` while `targets` in `build.py:367` builds `bvh` separately):
- `python tuxbox.py verify --only lanes --only lanes-selftest --backend native`: **10/10 PASS** (`lanes-xbox-replay` + all 9 scenarios including `indirect-dispatch`, `texture-readback`, `ray-tracing-builder`).
- Targeted Python checks: 32 ran, 31 ok, 1 skipped (`test_case_collision`).

Direct modified D3D12 guest checks on RTX 4070 SUPER:
d3d12-buffer-import.exe             d3d12-buffer-import PASS pci=10de:2783 pages=2 words=1536/1536 passes=2 aliases=2
d3d12-buffer-import.exe --reject    d3d12-buffer-import-reject PASS pci=10de:2783 rejected=1 (TUXBOX_REQUIRE_BUFFER_IMPORT=1)
d3d12-buffer-import.exe --layout    d3d12-buffer-layout PASS pci=10de:2783 slot=133 words=512/512 VA-offsets=0,4
d3d12-root-cbv-window.exe           d3d12-root-cbv-window PASS pci=10de:2783 words=120/120 window=65536 offsets=0,256,65280,65536,65792

Checks

  • cargo test --locked -p tuxbox-d3d12: 98 passed, 0 failed
  • cargo test --locked -p tuxbox-dxbc --features native-bindings: 53 passed, 0 failed
  • cargo test --locked -p tuxbox-xg-layout: 14 passed, 0 failed
  • cargo test --locked --manifest-path tools/shader-compiler/Cargo.toml: 279 unit + 2 integration passed, 0 failed
  • cargo check --locked --target x86_64-pc-windows-msvc -p tuxbox-d3d12 -p tuxbox-bvh: exit 0
  • python -m unittest tests.test_verify tests.test_build_msvc tests.test_check tests.test_repository_hygiene tests.test_inspect tests.test_cli -v: 29 ran, 28 ok, 1 skipped (test_case_collision on Windows case-insensitive filesystem)
  • python -m unittest discover -s tests -q: 281 ran, 93 skipped, 5 pre-existing Linux-only errors on Windows (ModuleNotFoundError: No module named 'fcntl' in tests/test_refusal_reasons.py; AttributeError: ... 'sched_getaffinity' in tests/test_shader_pack.py)

AI-assisted implementation and verification.

**@⁠Vladimir-Human** on GitHub · 2026-11-25 12:55 UTC · [original](https://github.com/brcly/TuxBox/pull/169) `Vladimir-Human:build/msvc-w4-guest-narrowing` → `main` · +70 −12 · 6 files · 1 commits · merged 2026-11-25 14:21 UTC ## Summary Unblock native Windows MSVC builds and `Lanes` GPU verification (`tuxbox.py verify`) without changing Linux/Proton behavior: - Fix MSVC `/W4 /WX` warnings in guest fixtures: - Split `desc.SampleDesc.Count = 1` (`UINT`) from `desc.DepthOrArraySize` / `desc.MipLevels` (`UINT16`, `C4244`) in `runtime/d3d12/buffer_import_guest.cpp` and `examples/lanes/screen.cpp`. - Rename local `profile` to `release_profile` in `runtime/d3d12/root_cbv_guest.cpp` so it does not shadow `frame_abi::profile` (`C4459`). - Replace `std::string::assign(wchar_t*, wchar_t*)` on the ASCII PCI ID buffer with an explicit `static_cast<char>` loop in `examples/lanes/course.cpp` (`C4244`). - Add `missing_provider_imports` in `project_tuxbox/verify.py` to resolve `#ordinal` static import records produced by MSVC `link.exe` against `.def` `@ordinal` entries via `export_table(provider)`, preserving fast-path matching for named imports and explicit `#ordinal` expectations (`GameInput.dll` `#1`). - Add unit tests in `tests/test_verify.py` (`ProviderImportTests`) covering fast-path named/ordinal checks, ordinal resolution against `export_table`, and negative cases for wrong/unknown ordinals and missing explicit `#1`. ## Verified on Lanes - [ ] `python tuxbox.py check` passed on this branch *(not fully runnable on Windows host: full `unittest discover` hits 5 pre-existing Linux-only `fcntl`/`os.sched_getaffinity` test errors, and `lanes-shader-cache` in `project_tuxbox/verify.py` is gated on `host.backend == "proton"`; equivalent build, Rust CI checks, Windows-compatible Python tests, and native `lanes` + `lanes-selftest` GPU gates passed below)* - [x] Changed or new behaviour is covered by a Lanes scenario, or the reason it cannot be is stated below *(exercises `lanes` and `lanes-selftest` build & `tuxbox.py verify` ordinal-import verification; modified `buffer_import_guest.cpp` and `root_cbv_guest.cpp` are also verified directly on the GPU)* GPU, driver and backend: NVIDIA GeForce RTX 4070 SUPER (`pci=10de:2783`), NVIDIA driver `32.0.16.2114`, Windows 11 native backend (MSVC `19.44.35207`, Windows SDK `10.0.26100.0` DXC, Rust `1.95.0`). Paste the summary printed at the end: ```text python build.py lanes (xmem, d3d12, gameinput, lanes): exit 0 cl /W4 /WX on examples/lanes/{course,screen,input,game,selftest}.cpp: 0 warnings, exit 0 python tuxbox.py verify --only lanes --only lanes-selftest --backend native --output build/check/lanes.json: PASS lanes-xbox-replay lanes-replay PASS pci=10de:2783 course=16/16 win=16/16 safe-miss=1 collision=1 frames=2 input=gameinput PASS lanes-selftest-labels lanes-selftest PASS pci=10de:2783 scenario=labels passed=1 PASS lanes-selftest-cross-queue lanes-selftest PASS pci=10de:2783 scenario=cross-queue passed=1 PASS lanes-selftest-compute-frame lanes-selftest PASS pci=10de:2783 scenario=compute-frame passed=1 PASS lanes-selftest-skipped-command lanes-selftest PASS pci=10de:2783 scenario=skipped-command passed=1 PASS lanes-selftest-copy-memory lanes-selftest PASS pci=10de:2783 scenario=copy-memory passed=1 PASS lanes-selftest-shared-texture lanes-selftest PASS pci=10de:2783 scenario=shared-texture passed=1 (lanes-shader-cache is Linux/Proton-only under host.backend == "proton") Also re-verified cherry-picked cleanly onto latest main (`bd8049f`, detached `728cc017` after `python build.py bvh` since `52292e6` added `XboxBvhBuilder.dll` to `build_target("lanes")` while `targets` in `build.py:367` builds `bvh` separately): - `python tuxbox.py verify --only lanes --only lanes-selftest --backend native`: **10/10 PASS** (`lanes-xbox-replay` + all 9 scenarios including `indirect-dispatch`, `texture-readback`, `ray-tracing-builder`). - Targeted Python checks: 32 ran, 31 ok, 1 skipped (`test_case_collision`). Direct modified D3D12 guest checks on RTX 4070 SUPER: d3d12-buffer-import.exe d3d12-buffer-import PASS pci=10de:2783 pages=2 words=1536/1536 passes=2 aliases=2 d3d12-buffer-import.exe --reject d3d12-buffer-import-reject PASS pci=10de:2783 rejected=1 (TUXBOX_REQUIRE_BUFFER_IMPORT=1) d3d12-buffer-import.exe --layout d3d12-buffer-layout PASS pci=10de:2783 slot=133 words=512/512 VA-offsets=0,4 d3d12-root-cbv-window.exe d3d12-root-cbv-window PASS pci=10de:2783 words=120/120 window=65536 offsets=0,256,65280,65536,65792 ``` ## Checks - `cargo test --locked -p tuxbox-d3d12`: 98 passed, 0 failed - `cargo test --locked -p tuxbox-dxbc --features native-bindings`: 53 passed, 0 failed - `cargo test --locked -p tuxbox-xg-layout`: 14 passed, 0 failed - `cargo test --locked --manifest-path tools/shader-compiler/Cargo.toml`: 279 unit + 2 integration passed, 0 failed - `cargo check --locked --target x86_64-pc-windows-msvc -p tuxbox-d3d12 -p tuxbox-bvh`: exit 0 - `python -m unittest tests.test_verify tests.test_build_msvc tests.test_check tests.test_repository_hygiene tests.test_inspect tests.test_cli -v`: 29 ran, 28 ok, 1 skipped (`test_case_collision` on Windows case-insensitive filesystem) - `python -m unittest discover -s tests -q`: 281 ran, 93 skipped, 5 pre-existing Linux-only errors on Windows (`ModuleNotFoundError: No module named 'fcntl'` in `tests/test_refusal_reasons.py`; `AttributeError: ... 'sched_getaffinity'` in `tests/test_shader_pack.py`) AI-assisted implementation and verification.
Split chained D3D12_RESOURCE_DESC assignments (UINT -> UINT16 C4244) in buffer_import_guest.cpp and examples/lanes/screen.cpp, avoid shadowing frame_abi::profile in root_cbv_guest.cpp (C4459), and replace wchar-to-char std::string::assign in examples/lanes/course.cpp (C4244 under /W4 /WX).

Resolve #ordinal guest imports against the staged provider export table in project_tuxbox/verify.py so MSVC-linked binaries (whose .def @ordinal imports use ordinal records in .lib) verify identically to lld-link builds.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:35:54 +00:00
github manually merged commit a7431e33a8 into gh-pr/169/base 2026-11-26 06:35:56 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.