Repository navigation
d3d12_xs: keep the heap-directly-indexed flags on a host that refuses to serialize them - #1353
Conversation
… to serialize them
|
Retail confirmation on Windows 10, counts only. Windows 10 Pro 22H2 (19045), Ryzen 7 7700, 32 GB RAM, RTX 5060 Ti 16 GB (NVIDIA 621.01), VS 2022 RelWithDebInfo, own 1.0.2.1 copy. Base: #984
One run each, same overlay and pipeline cache folder, so the second run also had the cache the first one left. The only code difference is this PR applied to While reading it: AI-assisted (Claude Code, Claude Opus 5.5). |
|
Merging. Why merged: on Windows 10, the in-box Why it's good: on this Windows 11 host the real serializer accepts the flags, so I also checked the refusal path independently with a harness: a fake serializer that refuses AI-assisted (Claude Code, Claude Opus 5.5). |
…e host refuses those flags Since ProjectLeonida#1353 the shims' serializers (versioned and legacy) serialize a description the host refuses for CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED or SAMPLER_HEAP_DIRECTLY_INDEXED (Windows 10's in-box d3d12.dll): they call the host again without the two bits and put them back into RTS0. The three host-parity checks failed on Windows 10 for that, as reported in review. Where the host refuses such flags but takes the description without them, the shim now has to return S_OK with that blob byte for byte, except the RTS0 flags dword, which must hold all the flags, and a valid container hash. Byte-for-byte parity stays wherever the host accepts, and the shim still has to refuse whatever else the host refuses. The doc bullet says the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claim: #14 (comment) (ID
D3D12-SET-HEAPS-BLOB; the deterministicd3d12_set_descriptor_heapsfailure in #1150)The test failed at
CHECK(!blob.empty()). The empty blob is not the shim dropping anything: it never reaches the shim, and the test was not wrong either.Cause
The in-box
d3d12.dllof Windows 10 (10.0.19041.4355, this machine) refusesD3D12_ROOT_SIGNATURE_FLAG_CBV_SRV_UAV_HEAP_DIRECTLY_INDEXEDand..._SAMPLER_HEAP_DIRECTLY_INDEXEDinD3D12SerializeVersionedRootSignatureat every descriptor version, withE_INVALIDARGandUnsupported bit-flag set (root signature flags c00). Versions 1.0 and 1.1 both fail; without the bits the same description serializes. That is wider than one test: the 1.0.2.1 shaders set either bit in 18,066 cases (docs/d3d12_vulkan.md), so any title root signature that indexes a heap directly could not be created at all on such a host.Measured, so the fix is possible: the same host's deserializer, and a WARP device, accept a blob that carries
0xC00-- a blob serialized without the bits, patched back in and re-hashed deserializes withFlags = 0xc00and creates a root signature. Only the serializer is the problem.Fix
serialize_versioned_keeping_heap_flags/serialize_legacy_keeping_heap_flagsinruntime/shims/d3d12_xs_rootsig.cpp: call the host as before; if it fails and the description carries either bit, call again with the bits cleared, then put them back into the producedRTS0flags dword and recompute the DXBC container hash (an all-zero hash stays zeroed). The blob is handed back through a smallID3DBlob. A host that takes the flags itself (Windows 11) still gets one call and its own blob unchanged; the version-1.2 downgrade path uses the same wrapper.d3d12test::serialize_root_signaturedoes the same retry for tests that serialize directly (zeroing the hash, which the host accepts and the device here does not read), so the failing case now builds a blob everywhere.Tested
d3d12_set_descriptor_heaps:CHECK failed: !blob.empty()3/3 before, passes 3/3 after.d3d12_xs_root_signature_test, both versions through the real shim: the host refuses (0x80070057), the shim retries, the flags are back through the host deserializer, the shim deserializer and a WARP root signature. Passes 3/3.root_sig_test: new legacy-entry-point case; the flags come back in the RTS0 chunk. All cases pass.d3d12_bundle_test,d3d12_draw_test,device_proxy_test,xs_proxy_mock_testpass;ctest -Ron the three touched tests 3/3.check_no_game_data.py-> exit 0;tests/test_docs_links.pyandtests/test_docs_table_rows.py-> OK.Not tested: a host that natively accepts the flags (no Windows 11 here); the test asserts byte equality with the host blob in that branch. The 1.0.2.1 root signatures themselves were not run (no game files).
GPUs tested: NVIDIA GPU (Pascal class, 4 GB), driver 582.28, Windows 10 19045 (WARP for the root-signature checks).
AI-assisted: yes (OpenCode, DeepSeek V4.1 Flash)
Checklist