Skip to content

d3d12_set_descriptor_heaps_test: set the heap-direct root-signature flag word by hand where the host serializer refuses it (OLD-7718) - #990

Closed
Snooozs wants to merge 1 commit into
ProjectLeonida:mainfrom
Snooozs:carry-old-7718
Closed

Snooozs wants to merge 1 commit into
ProjectLeonida:mainfrom
Snooozs:carry-old-7718

Conversation

@Snooozs

@Snooozs Snooozs commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: OLD-7718 (#14 (comment))

What and why

Carries on MeNoSkills's old pull request 7718, which has no old-pr/ branch. The commit is cherry-picked unchanged and keeps its author; it applies cleanly. If the author would rather carry it on, say so and I will close this.

Windows 10's serializer refuses the heap-direct flags and returns no blob. The test then serializes the signature without flags and writes the flag word into the RTS0 chunk, so the layer's parser is still checked with the bits set.

Tested

Windows 10 Pro 22H2 (10.0.19045), NVIDIA GeForce RTX 5060 Ti (621.01) and WARP, VS 2022 RelWithDebInfo, Vulkan SDK 1.4.363.0, ctest -R "^d3d12_set_descriptor_heaps$":

  • main 3ed8e50: fails, line 341: CHECK failed: !blob.empty()
  • with this commit: passes

I have not run it on Windows 11. check_no_game_data.py on the changed file: clean. Test-only change.

GPUs tested: NVIDIA GeForce RTX 5060 Ti, driver 621.01, Windows 10 22H2

AI-assisted: yes. Claude Code (Claude Opus 5.5) restored, reviewed and tested the original commit.

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator rule)

🤖 Generated with Claude Code

…lag word by hand where the host serializer refuses it (Windows 10)

(cherry picked from commit 287fe0e24610308ef054fee050c65ac83e9bdc81)
@kawaii-shakal

Copy link
Copy Markdown
Contributor

Review of #990, d3d12_set_descriptor_heaps_test: set the heap-direct root-signature flag word by hand where the host serializer refuses it (OLD-7718)

Head: 89d2408 (one commit, cherry-picked from 287fe0e24, author MeNoSkills). Base: merge-base with main is 3ed8e50, the current main. Only runtime/test/d3d12_set_descriptor_heaps_test.cpp changes, nothing else differs from main. The claim in #14 (comment 7137704829, OLD-7718) matches the pull request.

Environment: Windows 11 Pro 10.0.26300, d3d12.dll and d3d10warp.dll 10.0.26100.9818, NVIDIA GeForce RTX 5070 Ti (driver 617.42, LEONIDA_VK_DEVICE=5070), VS 18 2026, RelWithDebInfo, -DBUILD_TESTING=ON, one worktree from origin/main. I swapped in only the changed file and rebuilt only d3d12_set_descriptor_heaps_test.

Commands: cmake --build runtime/build --config RelWithDebInfo --target d3d12_set_descriptor_heaps_test -- /m:4, then ctest --test-dir runtime/build -C RelWithDebInfo -R "^d3d12_set_descriptor_heaps$" -V.

Results:

  • main 3ed8e50: passes. The Windows 11 serializer accepts the heap-direct flags, so the failure from the PR body does not happen here.
  • With the PR: passes, with no warnings in the changed file. The new branch is not taken because the "flag word set by hand" line is not printed. The test behaves as on main.
  • With the PR and the branch forced (if (true || blob.empty()), which simulates a Windows 10 serializer): passes. It prints "heap-direct flags: the host serializer refuses them (e.g. Windows 10); flag word set by hand". So the hand-written blob is accepted by the layer and the bits reach RootArgumentLayout.
  • With the PR, the branch forced, and a layer mutation (runtime/shims/d3d12_vulkan_device.cpp:6044, layout.flags = parsed.sig.flags & ~0xC00u): fails at "line 359: CHECK failed: layout && (layout->flags & di_flags) == di_flags". The fallback path still catches a layer that drops the heap-direct bits.

Findings:

  1. The condition comes from the host. The branch runs only when d3d12test::serialize_root_signature returns an empty blob, meaning the host serializer refused (d3d12_set_descriptor_heaps_test.cpp:341). Nothing is skipped: the final CHECKs at 355-359 run on both paths, and the layer's CreateRootSignature and flag propagation are still asserted. This fits "fix, don't disable".
  2. The offset is right, and the layer does not mind the stale container hash. Flags are the sixth dword of the RTS0 header, payload+20 (line 353). The layer reads them from the same place (runtime/src/root_signature.cpp:326, u32_at(20, flags)). parse_rts0 walks the DXBC chunk table without checking the hash (root_signature.cpp:457-514), so the patched blob, whose hash is now stale, is still valid input for the layer. Only ours.device gets the blob, and a native device would refuse it. That is fine, and a short note in the comment would help.
  3. Nit: the comment overstates what the path checks. "so the layer's parser is still checked with the bits set" (lines 342-344): on a Windows 10 host, the test writes the flag word at the offset the parser already assumes. This path checks that the bits pass from the parser into RootArgumentLayout. It does not check where the header puts the flag word. root_signature_oracle_test covers that against the real serializer. Suggested wording: "so the layer still carries the bits into RootArgumentLayout".
  4. Nit: the RTS0 scan starts at byte 0 (lines 349-350), so in theory it could match inside the 16-byte DXBC hash. Walking the chunk table (count at offset 28, offsets from 32), or scanning from 32 + 4*count, would rule that out. The chance is negligible, so this does not block.
  5. If d3d12.dll or its export is missing, the first blob is empty, the second one is too, and CHECK(payload && ...) fails loudly. That is right: it fails instead of skipping.

Verdict: approve. It passes here, the Windows 10 path is conditional on the serializer actually refusing, the layer is still checked on that path, and a mutation proves it. Optional nits: the comment wording (3) and walking the chunk table (4).

AI-assisted.

@Snooozs

Snooozs commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @kawaii-shakal, the layer mutation on the forced path is good evidence that the fallback still checks something. Agreed on the wording: on Windows 10 this path checks that the bits reach RootArgumentLayout, not the header offset. I have kept the author's commit unchanged; I can add a comment-only commit for that and for scanning the chunk table if a maintainer wants it before merging.

@Snooozs

Snooozs commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Overlap: #1353 handles the same Windows 10 refusal of the heap-directly-indexed flags in the shim's serializer path, with d3d12_set_descriptor_heaps as its starting point. Not tested together by me. If #1353 makes this test pass on Windows 10 without this change, this PR can be closed.

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

@Snooozs

Snooozs commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Checked on main 42537e7b6 (with #1353) without this PR: d3d12_set_descriptor_heaps_test builds and passes on Windows 10 19045, RTX 5060 Ti (NVIDIA 621.01), in one run. #1353 covers it, so I am closing this, as said above. Thanks to the original author of OLD-7718.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants