From e16d5adcad794904a62b90daeff5d3cd1eda9c83 Mon Sep 17 00:00:00 2001 From: Felix Croasdale <205819305+etcetera-yt@users.noreply.github.com> Date: Sun, 22 Nov 2026 22:35:45 -0600 Subject: [PATCH] root_signature_oracle_test: check the flag word without the heap-direct bits where the host can't serialize them "1.1 with every root-signature flag" (#3340) sets CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED and SAMPLER_HEAP_DIRECTLY_INDEXED, which came with Shader Model 6.6. Windows 10's built-in d3d12.dll refuses them ("Unsupported bit-flag set (root signature flags c7f)"), so the test failed on every Windows 10 PC. As for the 1.2 cases, the test now asks the host first. Where it can't serialize the heap-direct bits, it prints SKIP for them and round-trips the other seven flags, so a parser reading the wrong header word is still caught there. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01GZEZyXGTTXs4V33hrBw1tD (cherry picked from commit d1b1d0dbc9bfa02cb4779b3ae9829330eea31a0e) --- runtime/test/root_signature_oracle_test.cpp | 23 +++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/runtime/test/root_signature_oracle_test.cpp b/runtime/test/root_signature_oracle_test.cpp index a5d90c1411..2fd07608ff 100644 --- a/runtime/test/root_signature_oracle_test.cpp +++ b/runtime/test/root_signature_oracle_test.cpp @@ -341,7 +341,10 @@ int main() { // that read the flags from the wrong header word would pick the other binding model without failing anywhere // else. There are no parameters because the DENY_* bits are invalid next to a parameter any of those stages // can see. - const uint32_t every_pc_flag = + const uint32_t heap_direct_flags = + D3D12_ROOT_SIGNATURE_FLAG_CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED | + D3D12_ROOT_SIGNATURE_FLAG_SAMPLER_HEAP_DIRECTLY_INDEXED; + uint32_t every_pc_flag = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT | D3D12_ROOT_SIGNATURE_FLAG_DENY_VERTEX_SHADER_ROOT_ACCESS | D3D12_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS | @@ -349,8 +352,20 @@ int main() { D3D12_ROOT_SIGNATURE_FLAG_DENY_GEOMETRY_SHADER_ROOT_ACCESS | D3D12_ROOT_SIGNATURE_FLAG_DENY_PIXEL_SHADER_ROOT_ACCESS | D3D12_ROOT_SIGNATURE_FLAG_ALLOW_STREAM_OUTPUT | - D3D12_ROOT_SIGNATURE_FLAG_CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED | - D3D12_ROOT_SIGNATURE_FLAG_SAMPLER_HEAP_DIRECTLY_INDEXED; + heap_direct_flags; + // The heap-direct bits came with Shader Model 6.6. Windows 10's built-in d3d12.dll predates them and refuses them + // ("Unsupported bit-flag set"), so there the other bits are checked without them. + { + D3D12_VERSIONED_ROOT_SIGNATURE_DESC heap_direct{}; + heap_direct.Version = D3D_ROOT_SIGNATURE_VERSION_1_1; + heap_direct.Desc_1_1 = {0, nullptr, 0, nullptr, static_cast(heap_direct_flags)}; + Blobs probe; + if (FAILED(D3D12SerializeVersionedRootSignature(&heap_direct, &probe.blob, &probe.error))) { + std::printf("SKIP 1.1 with every root-signature flag: the heap-direct bits (the host d3d12.dll can't " + "serialize them, e.g. Windows 10); the other flags are still checked\n"); + every_pc_flag &= ~heap_direct_flags; + } + } D3D12_VERSIONED_ROOT_SIGNATURE_DESC flagged11{}; flagged11.Version = D3D_ROOT_SIGNATURE_VERSION_1_1; flagged11.Desc_1_1 = {0, nullptr, 0, nullptr, static_cast(every_pc_flag)}; @@ -360,7 +375,7 @@ int main() { if (serialize_desc(flagged11, out, "1.1 with every root-signature flag") && parse_checked(out.blob, "1.1 with every root-signature flag", got)) { check_named(got.flags == every_pc_flag, "1.1 with every root-signature flag", - "the whole PC flag word round-trips (heap-direct bits included)"); + "the whole PC flag word round-trips (heap-direct bits included where the host has them)"); const std::vector bytes = encode_canonical(got); const DecodeResult again = decode_canonical(bytes.data(), bytes.size()); check_named(again.ok && again.sig.flags == every_pc_flag, "1.1 with every root-signature flag",