Runtime tests: fix two failures on main (d3d12_com stale depth-clear check, root_sig merge of two checksum fixes) #16

Manually merged
github merged 2 commits from gh-pr/16/head into gh-pr/16/base 2026-11-26 08:40:31 +00:00
Owner

@⁠Pixel-Katana on GitHub · 2026-11-24 01:45 UTC · original
Pixel-Katana:fix/main-test-regressions → main · +48 −41 · 2 files · 2 commits · merged 2026-11-24 02:27 UTC

Two runtime tests fail on main (30daa695). Both come from changes that were merged without the matching follow-up; one commit each.

What and why

d3d12_com (test only). 3ce953ae8 made CommandList::clear_depth_stencil record a depth outside [0, 1] as given, matching WARP, and updated command_list_test, d3d12_clear_test and d3d12_close_parity_test. d3d12_com_test still expected Close to return E_INVALIDARG for ClearDepthStencilView(depth 2.0): line 345: list->Close() == E_INVALIDARG. It now expects S_OK, as the close-parity rows do.

root_sig (d3d12_xs_rootsig.cpp). b95925cbf (an all-zero checksum is accepted, as host d3d12.dll does) and c297bb577 / 5c3487a94 (strict checksum, fail closed on a malformed chunk table) changed copy_rts0_blob_clear_xbox_flags in parallel. Merge 1e029d6df kept the strict early checksum from one and the chunk loop from the other:

  • an all-zero-checksum Xbox blob is rejected before the zero-aware check runs, so root_sig_test fails its two all-zero-checksum cases;
  • the loop skips malformed chunk entries instead of failing, has no RTS0 version check, and leaves min_chunk_off unused.

The function now has 5c3487a94's fail-closed chunk walk and RTS0 version check, with b95925cbf's rule: an all-zero checksum is accepted and stays zero after the rewrite; any other checksum must match. The duplicate total_size and checksum checks inside the loop are gone.

Tested

Windows 11 (10.0.26300), RTX 5080, NVIDIA 621.24, VS 2022 Build Tools 17.14 / MSVC 19.44, Vulkan SDK 1.4.363.0, scripts\build_runtime.ps1; no new warnings.

  • root_sig_test: OK (0 failures), was 2 failures. d3d12_com_test: exit 0, also with LEONIDA_VK_VALIDATION=1.
  • Root-signature tests (root_sig, root_signature, root_signature_oracle, device_proxy*, xs_proxy_mock*): 11/11.
  • ctest (302): only three failures left, all present on main before this change and untouched here: d3d12_execute_indirect_validation, d3d12_vulkan_device (line 6576, tiles == 1), d3d12_depth_resolve. xmem and crt_timed_wait failed once under -j 4 and pass 3/3 run alone.
  • Merges cleanly with the current main (14 commits ahead of the base).

No game data, keys or decryption. AI-assisted.

🤖 Generated with Claude Code

**@⁠Pixel-Katana** on GitHub · 2026-11-24 01:45 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/16) `Pixel-Katana:fix/main-test-regressions` → `main` · +48 −41 · 2 files · 2 commits · merged 2026-11-24 02:27 UTC Two runtime tests fail on `main` (30daa695). Both come from changes that were merged without the matching follow-up; one commit each. ### What and why **`d3d12_com` (test only).** 3ce953ae8 made `CommandList::clear_depth_stencil` record a depth outside [0, 1] as given, matching WARP, and updated `command_list_test`, `d3d12_clear_test` and `d3d12_close_parity_test`. `d3d12_com_test` still expected `Close` to return `E_INVALIDARG` for `ClearDepthStencilView(depth 2.0)`: `line 345: list->Close() == E_INVALIDARG`. It now expects `S_OK`, as the close-parity rows do. **`root_sig` (`d3d12_xs_rootsig.cpp`).** b95925cbf (an all-zero checksum is accepted, as host `d3d12.dll` does) and c297bb577 / 5c3487a94 (strict checksum, fail closed on a malformed chunk table) changed `copy_rts0_blob_clear_xbox_flags` in parallel. Merge 1e029d6df kept the strict early checksum from one and the chunk loop from the other: - an all-zero-checksum Xbox blob is rejected before the zero-aware check runs, so `root_sig_test` fails its two all-zero-checksum cases; - the loop skips malformed chunk entries instead of failing, has no RTS0 version check, and leaves `min_chunk_off` unused. The function now has 5c3487a94's fail-closed chunk walk and RTS0 version check, with b95925cbf's rule: an all-zero checksum is accepted and stays zero after the rewrite; any other checksum must match. The duplicate `total_size` and checksum checks inside the loop are gone. ### Tested Windows 11 (10.0.26300), RTX 5080, NVIDIA 621.24, VS 2022 Build Tools 17.14 / MSVC 19.44, Vulkan SDK 1.4.363.0, `scripts\build_runtime.ps1`; no new warnings. - `root_sig_test`: OK (0 failures), was 2 failures. `d3d12_com_test`: exit 0, also with `LEONIDA_VK_VALIDATION=1`. - Root-signature tests (`root_sig`, `root_signature`, `root_signature_oracle`, `device_proxy*`, `xs_proxy_mock*`): 11/11. - `ctest` (302): only three failures left, all present on `main` before this change and untouched here: `d3d12_execute_indirect_validation`, `d3d12_vulkan_device` (line 6576, `tiles == 1`), `d3d12_depth_resolve`. `xmem` and `crt_timed_wait` failed once under `-j 4` and pass 3/3 run alone. - Merges cleanly with the current `main` (14 commits ahead of the base). No game data, keys or decryption. AI-assisted. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
3ce953ae8 made CommandList::clear_depth_stencil record a depth outside [0, 1] as given, matching WARP, and
updated command_list_test, d3d12_clear_test and d3d12_close_parity_test, but d3d12_com_test still expected
Close to return E_INVALIDARG for ClearDepthStencilView(depth 2.0), so it fails on main:
"line 345: list->Close() == E_INVALIDARG". It now expects S_OK, as the close-parity rows do.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
b95925cbf (all-zero checksum accepted, as host d3d12.dll does) and c297bb577/5c3487a94 (strict checksum,
fail closed on a malformed chunk table) changed copy_rts0_blob_clear_xbox_flags in parallel. Merge 1e029d6df
kept the strict early checksum from one and the loop from the other, so:

- an all-zero-checksum Xbox blob was rejected before the zero-aware check ran: root_sig_test fails on main
  ("blob helper rewrites an all-zero-checksum Xbox blob and keeps its zero checksum", "shim deserializer
  accepts an all-zero-checksum Xbox blob with the high byte cleared");
- the chunk loop skipped malformed entries instead of failing, dropped the RTS0 version check, and left
  min_chunk_off unused.

The function now has 5c3487a94's fail-closed chunk walk and RTS0 version check, with b95925cbf's rule: an
all-zero checksum is accepted and stays zero after the rewrite; any other checksum must match. The duplicate
total_size and checksum checks inside the loop are gone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:40:29 +00:00
github manually merged commit 681847c7c3 into gh-pr/16/base 2026-11-26 08:40:31 +00:00
Author
Owner

@⁠wavehs on GitHub · 2026-11-24 02:13 UTC · original

macOS arm64 review (Apple M3 Pro) — the rootsig half is reproducible here after all: the repository's own function fails 4 of 14 cases on base and passes all 14 on this head

Head 681847c7c, merge base 30daa6958, 2 files +48/−41 (runtime/shims/d3d12_xs_rootsig.cpp, runtime/test/d3d12_com_test.cpp); merges cleanly into ubi/main (9ec34cdff, git merge-tree --write-tree rc=0). The targets are Windows-only (MSVC + WARP + the host d3d12.dll), which I cannot run. What I could do instead: runtime/shims/d3d12_xs_rootsig.cpp only needs four D3D12 typedefs for the code path under test, so I extracted copy_rts0_blob_clear_xbox_flags, dxbc_checksum, clear_high_byte, rotl and md5_block verbatim from 30daa6958 and from 681847c7c into a harness with a two-line type stub (using D3D12_ROOT_SIGNATURE_FLAGS = std::uint32_t;), added the same kind of DXBC input the Windows test builds (one RTS0 chunk at +36), and compiled both with Apple clang 21.0.0, -std=c++20 -O1 -g -fsanitize=address,undefined.

Case (input) 30daa6958 681847c7c
valid checksum, Flags = 0x03000000 rewrite, flags cleared, checksum recomputed same
all-zero checksum returns false — this is your red root_sig_test rewrite, flags cleared, checksum kept zero
corrupted non-zero checksum refused, out empty same
total_size != size, trailing bytes, no Xbox high byte refused same
valid checksum, RTS0 version 4 rewrites it refused
valid checksum, chunk_size past the container rewrites it refused
valid checksum, RTS0 chunk < 24-byte header rewrites it refused
chunk offset inside the header/table, chunk_size past end, short chunk (zero checksum) refused refused

Base: 4 failures of 14. Head: 14/14, no ASan/UBSan report. The harness is the repo's code, so the branch logic being exercised is the code being merged; the registries, the host deserializer and WARP are not.

Why base was red, and it is not the PR's fault. b95925cbf ("verify DXBC total_size and incoming checksum before re-signing") added both root_sig_test.cpp:552-568 (all-zero checksum must be rewritten and kept zero) and the header sentence "an all-zero hash is accepted as-is and kept zeroed", but its top-level check still compared dxbc_checksum(...) against bytes 4..19 unconditionally — so a zero checksum was rejected before the in-loop zero branch could ever run, and the test asserts the opposite of what the code does. This PR makes the code match its own test and header.

The new checks match the rest of the codebase. The version range 1..3 is exactly rt::rootsig::parse_rts0's (runtime/src/root_signature.cpp:320-333: 1 = 1.0, 2 = 1.1, 3 = 1.2, everything else a hard error) and docs/d3d12_vulkan.md:1839; the chunk_size bound mirrors parse_rts0's own check (:499-511), which also decodes only payload_size bytes and rejects an overrun. The total_size check that disappears from the loop is still there at the top of the function, so the bad_total case keeps refusing (harness confirms).

The d3d12_com_test half is right on the code. 3ce953ae8 changed runtime/src/command_list.h:762-773: a depth outside [0, 1] is now recorded as given and a flags mask of 0 closes the list, so Close() is S_OK and the old E_INVALIDARG expectation could only fail. The portable command_list ctest passes here (1/1 in build32), and the referenced d3d12_close_parity_test row exists (runtime/test/d3d12_close_parity_test.cpp:276).

Two small things.

  • The public contract in runtime/shims/d3d12_xs_rootsig.h:45-50 lists why the helper returns false ("no RTS0 chunk, no Xbox high byte, a malformed/truncated header, total_size != size, or a non-zero incoming DXBC hash that does not match"). It does not mention the new unknown-RTS0-version rejection or the chunk-table/chunk_size rejections, and d3d12_xs.cpp:114 forwards the original blob on false — so the header is what tells a caller whether a false means "nothing to do" or "this blob is not safe to re-sign". Worth a clause.
  • Nothing in root_sig_test.cpp covers the version check or the three chunk-shape rejections; the zero-checksum block is the only new green. The four cases above are ~20 lines next to it and would pin the "fail closed" table this PR says it keeps.

I also ran check_no_game_data.py on both changed files: clean.

No game files. AI-assisted.

**@⁠wavehs** on GitHub · 2026-11-24 02:13 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/16#issuecomment-7119889080) **macOS arm64 review (Apple M3 Pro) — the rootsig half is reproducible here after all: the repository's own function fails 4 of 14 cases on base and passes all 14 on this head** Head `681847c7c`, merge base `30daa6958`, 2 files +48/−41 (`runtime/shims/d3d12_xs_rootsig.cpp`, `runtime/test/d3d12_com_test.cpp`); merges cleanly into `ubi/main` (`9ec34cdff`, `git merge-tree --write-tree` rc=0). The targets are Windows-only (MSVC + WARP + the host `d3d12.dll`), which I cannot run. What I could do instead: `runtime/shims/d3d12_xs_rootsig.cpp` only needs four D3D12 typedefs for the code path under test, so I extracted `copy_rts0_blob_clear_xbox_flags`, `dxbc_checksum`, `clear_high_byte`, `rotl` and `md5_block` **verbatim** from `30daa6958` and from `681847c7c` into a harness with a two-line type stub (`using D3D12_ROOT_SIGNATURE_FLAGS = std::uint32_t;`), added the same kind of DXBC input the Windows test builds (one `RTS0` chunk at +36), and compiled both with Apple clang 21.0.0, `-std=c++20 -O1 -g -fsanitize=address,undefined`. | Case (input) | `30daa6958` | `681847c7c` | |---|---|---| | valid checksum, `Flags = 0x03000000` | rewrite, flags cleared, checksum recomputed | same | | **all-zero checksum** | **returns false** — this is your red `root_sig_test` | rewrite, flags cleared, checksum kept zero | | corrupted non-zero checksum | refused, `out` empty | same | | `total_size != size`, trailing bytes, no Xbox high byte | refused | same | | valid checksum, **RTS0 version 4** | **rewrites it** | **refused** | | valid checksum, **chunk_size past the container** | **rewrites it** | **refused** | | valid checksum, **RTS0 chunk < 24-byte header** | **rewrites it** | **refused** | | chunk offset inside the header/table, `chunk_size` past end, short chunk (zero checksum) | refused | refused | Base: **4 failures of 14**. Head: **14/14**, no ASan/UBSan report. The harness is the repo's code, so the branch logic being exercised is the code being merged; the registries, the host deserializer and WARP are not. **Why base was red, and it is not the PR's fault.** `b95925cbf` ("verify DXBC total_size and incoming checksum before re-signing") added both `root_sig_test.cpp:552-568` (all-zero checksum must be rewritten and kept zero) and the header sentence "an all-zero hash is accepted as-is and kept zeroed", but its top-level check still compared `dxbc_checksum(...)` against bytes 4..19 unconditionally — so a zero checksum was rejected before the in-loop zero branch could ever run, and the test asserts the opposite of what the code does. This PR makes the code match its own test and header. **The new checks match the rest of the codebase.** The version range 1..3 is exactly `rt::rootsig::parse_rts0`'s (`runtime/src/root_signature.cpp:320-333`: 1 = 1.0, 2 = 1.1, 3 = 1.2, everything else a hard error) and `docs/d3d12_vulkan.md:1839`; the `chunk_size` bound mirrors `parse_rts0`'s own check (`:499-511`), which also decodes only `payload_size` bytes and rejects an overrun. The `total_size` check that disappears from the loop is still there at the top of the function, so the `bad_total` case keeps refusing (harness confirms). **The `d3d12_com_test` half is right on the code.** `3ce953ae8` changed `runtime/src/command_list.h:762-773`: a depth outside [0, 1] is now recorded as given and a flags mask of 0 closes the list, so `Close()` is `S_OK` and the old `E_INVALIDARG` expectation could only fail. The portable `command_list` ctest passes here (1/1 in `build32`), and the referenced `d3d12_close_parity_test` row exists (`runtime/test/d3d12_close_parity_test.cpp:276`). **Two small things.** - The public contract in `runtime/shims/d3d12_xs_rootsig.h:45-50` lists why the helper returns false ("no RTS0 chunk, no Xbox high byte, a malformed/truncated header, total_size != size, or a non-zero incoming DXBC hash that does not match"). It does not mention the new unknown-RTS0-version rejection or the chunk-table/`chunk_size` rejections, and `d3d12_xs.cpp:114` forwards the original blob on false — so the header is what tells a caller whether a false means "nothing to do" or "this blob is not safe to re-sign". Worth a clause. - Nothing in `root_sig_test.cpp` covers the version check or the three chunk-shape rejections; the zero-checksum block is the only new green. The four cases above are ~20 lines next to it and would pin the "fail closed" table this PR says it keeps. I also ran `check_no_game_data.py` on both changed files: clean. No game files. AI-assisted.
This discussion has been locked. Commenting is limited to contributors.
No description provided.