From 89d240867151caa05d86a8d9adeedf51748eea10 Mon Sep 17 00:00:00 2001 From: MeNoSkills <359902512+MeNoSkills@users.noreply.github.com> Date: Mon, 23 Nov 2026 18:25:06 +0100 Subject: [PATCH] d3d12_set_descriptor_heaps_test: set the heap-direct root-signature flag word by hand where the host serializer refuses it (Windows 10) (cherry picked from commit 287fe0e24610308ef054fee050c65ac83e9bdc81) --- runtime/test/d3d12_set_descriptor_heaps_test.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/runtime/test/d3d12_set_descriptor_heaps_test.cpp b/runtime/test/d3d12_set_descriptor_heaps_test.cpp index 62ffb1ffee..e54af4c947 100644 --- a/runtime/test/d3d12_set_descriptor_heaps_test.cpp +++ b/runtime/test/d3d12_set_descriptor_heaps_test.cpp @@ -337,7 +337,21 @@ bool check_tracking_lifetime_and_direct_indexing(DeviceHeaps& ours) { const auto di_flags = D3D12_ROOT_SIGNATURE_FLAG_CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED | D3D12_ROOT_SIGNATURE_FLAG_SAMPLER_HEAP_DIRECTLY_INDEXED; rs_desc.Desc_1_0 = {1, &p, 0, nullptr, di_flags}; - const auto blob = d3d12test::serialize_root_signature(rs_desc); + auto blob = d3d12test::serialize_root_signature(rs_desc); + if (blob.empty()) { + // The heap-direct bits came with Shader Model 6.6; Windows 10's built-in d3d12.dll refuses them ("Unsupported + // bit-flag set"). Serialize the same signature without flags and write the flag word (the sixth dword of the + // 1.0 header) into the RTS0 chunk ourselves, so the layer's parser is still checked with the bits set. + std::puts("heap-direct flags: the host serializer refuses them (e.g. Windows 10); flag word set by hand"); + rs_desc.Desc_1_0.Flags = D3D12_ROOT_SIGNATURE_FLAG_NONE; + blob = d3d12test::serialize_root_signature(rs_desc); + std::size_t payload = 0; // the serializer returns a DXBC container; its RTS0 chunk holds the signature + for (std::size_t at = 0; at + 8 <= blob.size() && !payload; ++at) + if (std::memcmp(blob.data() + at, "RTS0", 4) == 0) payload = at + 8; + CHECK(payload && payload + 24 <= blob.size()); + const std::uint32_t flag_word = static_cast(di_flags); + std::memcpy(blob.data() + payload + 20, &flag_word, sizeof(flag_word)); + } CHECK(!blob.empty()); Ptr root; CHECK(SUCCEEDED(ours.device->CreateRootSignature(0, blob.data(), blob.size(), IID_PPV_ARGS(&root.p))));