mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:30:53 +01:00
[PR #1353] [MERGED] d3d12_xs: keep the heap-directly-indexed flags on a host that refuses to serialize them #1383
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1383
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1353
Author: @robot00f
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @QemmHD
Base:
main← Head:fix/rootsig-heap-flags📝 Commits (1)
a330747d3d12_xs: keep the heap-directly-indexed flags on a host that refuses to serialize them📊 Changes
7 files changed (+363 additions, -21 deletions)
View changed files
📝
docs/d3d12_vulkan.md(+11 -0)📝
runtime/shims/d3d12_xs.cpp(+6 -4)📝
runtime/shims/d3d12_xs_rootsig.cpp(+180 -16)📝
runtime/shims/d3d12_xs_rootsig.h(+27 -0)📝
runtime/test/d3d12_test_shaders.h(+50 -1)📝
runtime/test/d3d12_xs_root_signature_test.cpp(+58 -0)📝
runtime/test/root_sig_test.cpp(+31 -0)📄 Description
Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7145813750 (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
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.