Skip to content

test(root_signature): extend the oracle to flags, CBV/SAMPLER ranges, root UAVs and the 1.0 root-view form - #3340

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
biglill:root-signature-oracle
Nov 23, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
biglill:root-signature-oracle

Conversation

@biglill

@biglill biglill commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Why

root_signature_oracle_test.cpp is the only test that can falsify the RTS0 layout hypothesis: it feeds synthetic D3D12_VERSIONED_ROOT_SIGNATURE_DESCs through Microsoft's D3D12SerializeVersionedRootSignature and requires rt::rootsig::parse_rts0 to recover the same model. root_signature_test.cpp hand-builds payloads from the same hypothesis, so it cannot.

It covered 27 of 53 features. Every fixture used D3D12_ROOT_SIGNATURE_FLAG_NONE, only SRV and UAV ranges existed, dtype 4 (root UAV) never reached the parser, and 1.0 root views were only tested as SRV.

Two of those matter more than the count suggests:

  • A mis-read flags word silently switches the binding model. Nothing in the suite ever saw a non-zero flags value, so a wrong offset would have shipped with a green CI.
  • Bindless signatures are what a modern title uses. NumDescriptors == UINT_MAX, the sampler-table split, and DESCRIPTORS_VOLATILE had no coverage at all.

A first root UAV in a compute signature would also have failed to parse with no test to catch the regression.

What

32 assertions across 1.0, 1.1 and 1.2:

area cases
flags ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT, all five DENY_*, ALLOW_STREAM_OUTPUT, both heap-directly-indexed bits
ranges CBV, SRV, UAV and SAMPLER, unbounded counts, DESCRIPTORS_VOLATILE, non-zero spaces and base registers
parameters root UAVs, root constants at counts 1 and 64, 1.0 root view form for both SRV and UAV
static samplers a second table, per-sampler visibility, border colour and the 1.2 flags dword
layout several parameters in unusual legal orders, and the empty signature

Each case is named, so a failure reads flags: allow IA layout survives instead of false. parse_checked() stops a failed parse from being indexed — that segfault is what killed the previous attempt at this coverage.

Evidence

Windows, MSVC 19.44, SDK 10.0.26100, /W4:

PASS=65  FAIL=0  exit=0

The baseline before this change is 33 assertions.

Mutation-checked, so the new cases are known to bite: reading the flags dword at +16, dropping dtype 4, and mapping MESH visibility to PIXEL each fail new cases only, and the untouched suite passes all three.

Relationship to open work

Notes

  • Windows-only, like the existing oracle test. CI already runs it on windows-latest.
  • No game data, no keys, nothing downloaded.
  • D:\Leonida was not modified to produce this; the diff was developed in a scratch copy and applied here.

… root UAVs and the 1.0 root-view form

The oracle serializes synthetic versioned root signatures with Microsoft's
D3D12SerializeVersionedRootSignature and requires rt::rootsig::parse_rts0 to recover
the same model. It covered 27 of 53 features: every fixture used FLAG_NONE, only SRV
and UAV ranges existed, dtype 4 (root UAV) never reached the parser, and 1.0 root
views were only tested as SRV.

That matters because a mis-read flags word silently switches the binding model, and
bindless signatures (NumDescriptors == UINT_MAX, sampler tables) are exactly what a
modern title uses. A first root UAV in a compute signature would have failed to parse
with no test to catch the regression.

Adds 32 assertions across 1.0/1.1/1.2: every root-signature flag, CBV and SAMPLER
ranges including unbounded counts and DESCRIPTORS_VOLATILE, root UAVs, the 1.0 root
view form, static samplers in a second table, and checkerboard parameter orders.

Each case is named, so a failure reads 'flags: allow IA layout survives' rather than
'false'. parse_checked() stops a failed parse from being indexed, which is what
segfaulted the earlier attempt.

Verified on Windows with MSVC 19.44 / SDK 10.0.26100 at /W4: 62 PASS, 0 FAIL.
Mutation-checked: reading flags at +16, dropping dtype 4, and mapping MESH to PIXEL
each fail new cases only, and the untouched suite passes none of them.
@biglill

biglill commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Companion: #3343 adds the conformance harness those root signatures will be exercised by. The two are independent — this one is a test-only change and can land on its own.

@kotorvr

kotorvr commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested 1fde38e on Windows 11 Home 26200 (MSVC 19.44, VS 2022, Ninja, RelWithDebInfo; the machine's GPU is an RTX 4090 on 621.14, which this CPU-side test does not use): pass.

The branch is one commit on main f847748, built the same way for comparison. The oracle here is this Windows build's own D3D12SerializeVersionedRootSignature.

main f847748 1fde38e
root_signature_oracle_test.exe exit 0, 39 output lines (PASS lines and blob dumps together) exit 0, 65 PASS, 0 FAIL, 13 blob dumps
ctest -R root_sig root_signature and root_signature_oracle passed (root_sig not run on this commit) 3/3: root_sig, root_signature, root_signature_oracle

Every new case was accepted by Microsoft's serializer on this build (no "serializer error" line), so none of the new assertions was skipped by an early return. No new compiler warnings in the changed file. No game files. AI-assisted check (Claude Code).

@JRamos1993

Copy link
Copy Markdown
Contributor

Tested 1fde38e merged onto main aa2988c on an RTX 5090 (driver 616.92), Windows 11, MSVC 19.44, Vulkan SDK 1.4.363, RelWithDebInfo:

  • Full ctest: 154/154.
  • root_signature_oracle: passes 20 of 20 runs, and passes under LEONIDA_VK_VALIDATION=1 with 0 validation messages.
  • Warnings: none new in the files this PR changes.

AI-assisted (Claude Code).

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.

4 participants