gpu: read root signature blobs without a host d3d12.dll #83
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/83"
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?
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-26T13:52:04Z.
What this changes
On macOS,
d3d12_xs!D3D12CreateRootSignatureDeserializer(root.rs,create_deserializer) forwarded to a hostd3d12.dllthat does not exist there, so every call loggedno host d3d12.dll to deserialize root signaturesand returnedE_NOTIMPL. Both Series S tester logs (#66, #68) show 29 of these calls at the first world frame, right after the AMD FidelityFX upscaler DLL loads: the upscaler got no root signature description back.rootser.rsalready wroteRTS0blobs in Rust; it now reads them too, versions 1.0 and 1.1, bare or as theRTS0part of a DXBC container (victory_shader::dxbc), into anID3D12RootSignatureDeserializer(IID34ab647b-3cc8-46ac-841b-c0965645c046: IUnknown, thenGetRootSignatureDesc). The object owns the description and the arrays its pointers point into, so they live as long as it does. Layouts followd3d12.h. Reading is bounds-checked throughout: versions 1 and 2, parameter types 0 to 4, at most 4096 parameters and 2048 static samplers, as the writer allows, and no more descriptor ranges than the blob has room for, so tables pointing at the same bytes cannot make it allocate past the blob's size. A malformed blob givesE_INVALIDARGand a null object; an unknown interfaceE_NOINTERFACE. On Windows the host DLL is still used: only thewarn!andE_NOTIMPLare replaced.Guess, marked in the code and docs/native-host.md: a 1.1 blob is returned as the 1.0 description with its range and root descriptor flags dropped, which is believed to be what Microsoft's 1.0 deserializer does. The Windows test
the_host_reads_our_blobs_as_we_docompares both readers on 1.0 and 1.1 blobs, so the CI settles it.Tests: v1 and v2 round trips through
serializechecking every field and the data behind each pointer (a table of two ranges, constants, a CBV, a static sampler); the same blob in DXBC, DXBC without RTS0, a truncated container; every truncation and 15 corruptions (versions, counts, offsets, type 5, shared ranges past the blob's room); QueryInterface, AddRef and Release; the export itself off Windows.How it was tested
cargo test -p victory-gpuon arm64 with the Metal Shader Converter installed (166 tests)cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings, also with--all-featurescargo test --workspaceandcargo xtask policyChecklist
VICTORY_*variable and documented (none added)Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T14:54:43Z.
Review: APPROVED
Thanks: the blob reader is bounds-checked, the layouts match d3d12.h, and truncation and corruption are tested. Approved (nit for later: a SAFETY comment on
descriptionin rootser.rs).