d3d12_xs: export D3D12CreateVersionedRootSignatureDeserializer, clearing the Xbox RTS0 flags #283

Closed
Andretuta wants to merge 1 commit from upstream-pr/283 into main
Andretuta commented 2026-11-24 02:59:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-24T02:59:01Z.


Carried over from old PR 10012 by tedin7 in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/10012, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
tedin7: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

What

d3d12_xs.dll now exports D3D12CreateVersionedRootSignatureDeserializer (ordinal 7, also by name). It clears the Xbox high flag byte of the RTS0 chunk on a copy, re-checks the DXBC checksum first (a corrupt blob is still rejected), then forwards to the host deserializer. A clean blob is forwarded unchanged. docs/d3d12_xs_surface.md row 7 is updated from "absent" to "present".

Why

The Xbox title's root signatures carry flag bits 24-31. Main already cleans them in D3D12SerializeVersionedRootSignature and D3D12CreateRootSignatureDeserializer, but the versioned deserializer (the one that reads 1.1/1.2 blobs) was not exported, so a boot-time root signature read through it fails and the PSO that needs it is never created.

Rebased cleanly on current main; supersedes #8814 closed during org migration.

Tested

Local cross-build (clang-cl 19 + xwin SDK 10.0.26100) and run under Wine 10.0, root_sig_test.exe; pods are down so nothing ran on a GPU pod.

  • With the fix: the 7 new checks pass (registry exposes the export, ordinal 7 resolves to it, corrupt checksum rejected, Xbox flags accepted and cleared to 0, clean blob accepted, garbage rejected).
  • Negative control: same new test linked against main's d3d12_xs.cpp: "shim registry exposes the versioned deserializer" and "ordinal 7 resolves to the versioned deserializer" FAIL.
  • Not caused by this PR: 2 pre-existing failures on main under Wine ("blob helper rewrites an all-zero-checksum Xbox blob...", "shim deserializer accepts an all-zero-checksum Xbox blob..."), identical with and without this change.

Build note: main currently does not build (issue #9812, fixed by #9809/#9815). For the local run I applied the #9809 hunks for d3d12_xs_device.cpp/.h in a throwaway worktree only; none of it is in this branch.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5465242635 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/283). Originally posted by [Andretuta](https://github.com/Andretuta) on 2026-11-24T02:59:01Z. --- > Carried over from **old PR 10012** by `tedin7` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/10012`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `tedin7`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): ## What d3d12_xs.dll now exports `D3D12CreateVersionedRootSignatureDeserializer` (ordinal 7, also by name). It clears the Xbox high flag byte of the RTS0 chunk on a copy, re-checks the DXBC checksum first (a corrupt blob is still rejected), then forwards to the host deserializer. A clean blob is forwarded unchanged. `docs/d3d12_xs_surface.md` row 7 is updated from "absent" to "present". ## Why The Xbox title's root signatures carry flag bits 24-31. Main already cleans them in `D3D12SerializeVersionedRootSignature` and `D3D12CreateRootSignatureDeserializer`, but the versioned deserializer (the one that reads 1.1/1.2 blobs) was not exported, so a boot-time root signature read through it fails and the PSO that needs it is never created. Rebased cleanly on current main; supersedes `#8814` closed during org migration. ## Tested Local cross-build (clang-cl 19 + xwin SDK 10.0.26100) and run under Wine 10.0, `root_sig_test.exe`; pods are down so nothing ran on a GPU pod. - With the fix: the 7 new checks pass (registry exposes the export, ordinal 7 resolves to it, corrupt checksum rejected, Xbox flags accepted and cleared to 0, clean blob accepted, garbage rejected). - Negative control: same new test linked against main's `d3d12_xs.cpp`: "shim registry exposes the versioned deserializer" and "ordinal 7 resolves to the versioned deserializer" FAIL. - Not caused by this PR: 2 pre-existing failures on main under Wine ("blob helper rewrites an all-zero-checksum Xbox blob...", "shim deserializer accepts an all-zero-checksum Xbox blob..."), identical with and without this change. Build note: main currently does not build (issue `#9812`, fixed by `#9809`/#9815). For the local run I applied the `#9809` hunks for d3d12_xs_device.cpp/.h in a throwaway worktree only; none of it is in this branch.
Snooozs commented 2026-11-24 18:01:07 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Snooozs on 2026-11-24T18:01:07Z.


root_sig is red with this PR on Windows 10:

FAIL versioned shim rejects Xbox flags with corrupt checksum
root_sig_test: FAILED (1 failure)

The other new checks pass, and the new test with main's shim fails only the two registry checks, as expected.

Cause: the checksum comparison in create_versioned_root_signature_deserializer sits inside if (copy_rts0_blob_clear_xbox_flags(...)), but that helper already returns false for a container with a wrong hash (runtime/shims/d3d12_xs_rootsig.cpp:149-153, "a corrupted blob must reach the host deserializer unchanged so it is rejected"). So the comparison can never fail there, and the corrupt blob goes to the host. Windows 10's versioned deserializer does not reject it; I assume a newer runtime does, which would hide this.

Possible fix: compare the hash before the helper for any well-formed DXBC container and return E_INVALIDARG (with *out cleared) on a mismatch. I have not built that.

Windows 10 Pro 22H2 (19045), VS 2022 RelWithDebInfo, merged onto main 3aa975421 without conflicts, targets rebuilt, CPU only, no game files. AI-assisted (Claude Code): I read the whole diff and ran this on that machine.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7140037486 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/283#issuecomment-7140037486). Originally posted by [Snooozs](https://github.com/Snooozs) on 2026-11-24T18:01:07Z. --- `root_sig` is red with this PR on Windows 10: ``` FAIL versioned shim rejects Xbox flags with corrupt checksum root_sig_test: FAILED (1 failure) ``` The other new checks pass, and the new test with `main`'s shim fails only the two registry checks, as expected. Cause: the checksum comparison in `create_versioned_root_signature_deserializer` sits inside `if (copy_rts0_blob_clear_xbox_flags(...))`, but that helper already returns false for a container with a wrong hash (`runtime/shims/d3d12_xs_rootsig.cpp:149-153`, "a corrupted blob must reach the host deserializer unchanged so it is rejected"). So the comparison can never fail there, and the corrupt blob goes to the host. Windows 10's versioned deserializer does not reject it; I assume a newer runtime does, which would hide this. Possible fix: compare the hash before the helper for any well-formed DXBC container and return `E_INVALIDARG` (with `*out` cleared) on a mismatch. I have not built that. Windows 10 Pro 22H2 (19045), VS 2022 RelWithDebInfo, merged onto `main` 3aa975421 without conflicts, targets rebuilt, CPU only, no game files. AI-assisted (Claude Code): I read the whole diff and ran this on that machine.
MoonEyes commented 2026-11-27 19:11:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-27T19:11:08Z.


Thanks a lot for carrying this over, @Andretuta (original work by tedin7, old PR 10012). We checked and this change is already in main: it landed through #758 (the same old PR 10012). main exports D3D12CreateVersionedRootSignatureDeserializer (by name and as ordinal 7) and forwards a copy with the Xbox RTS0 flags cleared. The new test in runtime/test/root_sig_test.cpp and the docs/d3d12_xs_surface.md row are there with the same wording.

One difference: this branch checks the container hash again in the shim before forwarding the cleared copy. main does that check earlier, in find_rts0 (runtime/shims/d3d12_xs_rootsig.cpp), so a blob with a wrong hash is never rewritten. main also deliberately accepts an all-zero hash there, which this extra check would reject.

Since there is nothing left to merge, I am closing this one to keep the queue clear. Please do reopen it if you see something we missed.

AI-assisted (Claude Code, Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7226274089 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/283#issuecomment-7226274089). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-27T19:11:08Z. --- Thanks a lot for carrying this over, @Andretuta (original work by `tedin7`, old PR 10012). We checked and this change is already in `main`: it landed through #758 (the same old PR 10012). `main` exports `D3D12CreateVersionedRootSignatureDeserializer` (by name and as ordinal 7) and forwards a copy with the Xbox RTS0 flags cleared. The new test in `runtime/test/root_sig_test.cpp` and the `docs/d3d12_xs_surface.md` row are there with the same wording. One difference: this branch checks the container hash again in the shim before forwarding the cleared copy. `main` does that check earlier, in `find_rts0` (`runtime/shims/d3d12_xs_rootsig.cpp`), so a blob with a wrong hash is never rewritten. `main` also deliberately accepts an all-zero hash there, which this extra check would reject. Since there is nothing left to merge, I am closing this one to keep the queue clear. Please do reopen it if you see something we missed. AI-assisted (Claude Code, Claude Opus 5.5)

Pull request closed

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
ProjectLeonida/mandy!283
No description provided.