[PR #677] [MERGED] OLD-7234: restore old upstream PR 7234 - d3d12_xs: pin that the root-signature flag mask keeps every public flag (old upstream PR 7140) #717

Closed
opened 2026-11-26 20:18:49 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/677
Author: @aslan2142
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142

Base: main ← Head: root-sig-flag-mask


📝 Commits (5)

  • 558206b d3d12_xs: pin that the root-signature flag mask keeps every public flag (old upstream PR 7140)
  • 3769fd6 root_sig_public_flags_test: allow 1.2 "host refuses, shim succeeds" only on a host without 1.2
  • 00c65b9 Merge commit 'refs/fix2/main' into fix2-677
  • 5e85304 root_sig_public_flags_test: link d3d12_xs_pso_stream.cpp, as root_sig_test does on main
  • ac3aef5 root_sig_public_flags_test: expect the heap-indexed fallback where the host refuses those flags

📊 Changes

3 files changed (+475 additions, -1 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+15 -1)
📝 runtime/CMakeLists.txt (+17 -0)
➕ runtime/test/root_sig_public_flags_test.cpp (+443 -0)

📄 Description

Claimed in the coordination issue as: OLD-7234 https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7130351383

Restoration of my original pull request, old upstream PR 7234 in ItsNotRexed/Leonida, which was closed unmerged when that repository went private on 2026-11-23 (old numbers link nowhere now). Rebased onto main at 21625bca8c; the only changes are that the old PR references in comments and commit messages are now plain text ("old upstream PR 7140").

What and why

  • This is a guard, not a bug fix. It changes no runtime code and pins behaviour that is already correct on main.
  • The d3d12_xs shims clear bits 24-31 of a root signature's flags (kXboxRootSignatureFlagHighByte, runtime/shims/d3d12_xs_rootsig.h) on every descriptor and RTS0 blob, whatever built it.
  • Old upstream PR 7140 asked whether that mask should depend on where the blob came from. The retail executable's root signatures do not carry 0x03000000: its direct call passes a 1.1 description with Flags = 0x80, and its decoder reads Flags as a 16-bit value.
  • Every public D3D12_ROOT_SIGNATURE_FLAGS value is in bits 0-11, so the mask cannot touch one, and it can stay unconditional.
  • docs/d3d12_vulkan.md answers the question the doc still left open ("whether its root signatures carry them is open") and says why the mask stays as it is.
  • The new root_sig_public_flags_test (Windows only, next to root_sig_test) checks:
    • the 1.0, 1.1, 1.2 and legacy descriptor helpers keep all 65536 flag values in [0, 0xFFFF];
    • an RTS0 blob with such flags is never rewritten;
    • the registered serializer shims give the host's blob byte for byte for each public flag, 0x80 and all twelve;
    • the deserializer shim returns the host's flags;
    • a blob with 0x03000080 comes back as 0x80, with a valid container hash and no other byte changed;
    • static_asserts that no public flag lies in the cleared byte.
  • On a host that serializes only up to 1.1, the shim rewrites 1.2 descriptions as 1.1. The test allows "host refuses, shim succeeds" only on such a host, which it probes once with an empty 1.2 description.

Tested

Built and run on Linux. The Windows build used clang targeting x86_64-w64-mingw32 and ran under Wine 11.22. MSVC (/W4 /permissive-) is left to CI.

  • root_sig_public_flags_test built against main's code: 28 pass, 0 fail, as expected for a guard.
  • This branch: 28 pass, 0 fail.
  • A mask that also clears 0x80, in a scratch copy: 12 pass, 16 fail. So the test catches a mask that eats a public flag.
  • root_sig_test: 56 pass, 1 fail, the same on main and on this branch. The failure is "shim deserializer accepts an all-zero-checksum Xbox blob". Wine's host deserializer causes it, and this pull request does not touch it.
  • git diff --check and scripts/check_no_game_data.py on the changed files: clean.

GPUs tested: n/a (the test needs no GPU)

AI-assisted: yes

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 change)

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/677 **Author:** [@aslan2142](https://github.com/aslan2142) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/25/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `root-sig-flag-mask` --- ### 📝 Commits (5) - [`558206b`](https://github.com/ubiquitarianism/leonida/commit/558206bb09a1819cab21a95b7b79fcbbc2701171) d3d12_xs: pin that the root-signature flag mask keeps every public flag (old upstream PR 7140) - [`3769fd6`](https://github.com/ubiquitarianism/leonida/commit/3769fd6b509232c78150076d4f58770be7e6c239) root_sig_public_flags_test: allow 1.2 "host refuses, shim succeeds" only on a host without 1.2 - [`00c65b9`](https://github.com/ubiquitarianism/leonida/commit/00c65b940dca8a84c94144293903cb1c8406069d) Merge commit 'refs/fix2/main' into fix2-677 - [`5e85304`](https://github.com/ubiquitarianism/leonida/commit/5e85304b1f2b72168087d7cfebe08d2cd4c077ea) root_sig_public_flags_test: link d3d12_xs_pso_stream.cpp, as root_sig_test does on main - [`ac3aef5`](https://github.com/ubiquitarianism/leonida/commit/ac3aef567bbe4ec3aed6199c151e65f8b0d126c2) root_sig_public_flags_test: expect the heap-indexed fallback where the host refuses those flags ### 📊 Changes **3 files changed** (+475 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+15 -1) 📝 `runtime/CMakeLists.txt` (+17 -0) ➕ `runtime/test/root_sig_public_flags_test.cpp` (+443 -0) </details> ### 📄 Description Claimed in the coordination issue as: OLD-7234 https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7130351383 Restoration of my original pull request, old upstream PR 7234 in `ItsNotRexed/Leonida`, which was closed unmerged when that repository went private on 2026-11-23 (old numbers link nowhere now). Rebased onto main at 21625bca8c675c62f9dbffc318ce6a59d57faf31; the only changes are that the old PR references in comments and commit messages are now plain text ("old upstream PR 7140"). ### What and why - This is a guard, not a bug fix. It changes no runtime code and pins behaviour that is already correct on `main`. - The d3d12_xs shims clear bits 24-31 of a root signature's flags (`kXboxRootSignatureFlagHighByte`, `runtime/shims/d3d12_xs_rootsig.h`) on every descriptor and RTS0 blob, whatever built it. - Old upstream PR 7140 asked whether that mask should depend on where the blob came from. The retail executable's root signatures do not carry `0x03000000`: its direct call passes a 1.1 description with `Flags = 0x80`, and its decoder reads `Flags` as a 16-bit value. - Every public `D3D12_ROOT_SIGNATURE_FLAGS` value is in bits 0-11, so the mask cannot touch one, and it can stay unconditional. - `docs/d3d12_vulkan.md` answers the question the doc still left open ("whether its root signatures carry them is open") and says why the mask stays as it is. - The new `root_sig_public_flags_test` (Windows only, next to `root_sig_test`) checks: - the 1.0, 1.1, 1.2 and legacy descriptor helpers keep all 65536 flag values in `[0, 0xFFFF]`; - an RTS0 blob with such flags is never rewritten; - the registered serializer shims give the host's blob byte for byte for each public flag, `0x80` and all twelve; - the deserializer shim returns the host's flags; - a blob with `0x03000080` comes back as `0x80`, with a valid container hash and no other byte changed; - `static_assert`s that no public flag lies in the cleared byte. - On a host that serializes only up to 1.1, the shim rewrites 1.2 descriptions as 1.1. The test allows "host refuses, shim succeeds" only on such a host, which it probes once with an empty 1.2 description. ### Tested Built and run on Linux. The Windows build used clang targeting x86_64-w64-mingw32 and ran under Wine 11.22. MSVC (`/W4 /permissive-`) is left to CI. - `root_sig_public_flags_test` built against `main`'s code: 28 pass, 0 fail, as expected for a guard. - This branch: 28 pass, 0 fail. - A mask that also clears `0x80`, in a scratch copy: 12 pass, 16 fail. So the test catches a mask that eats a public flag. - `root_sig_test`: 56 pass, 1 fail, the same on `main` and on this branch. The failure is "shim deserializer accepts an all-zero-checksum Xbox blob". Wine's host deserializer causes it, and this pull request does not touch it. - `git diff --check` and `scripts/check_no_game_data.py` on the changed files: clean. GPUs tested: n/a (the test needs no GPU) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) AI-assisted (Claude Code, Claude Opus 5.5). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:18:49 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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
starred/leonida#717
No description provided.