shader: size compute root constants from the pipeline's root signature #114
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/114"
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-26T17:07:42Z.
Follow-up to
d02869f, as discussed on #4: compute root constants take their exact size from the pipeline's root signature instead of the guess.Why. An FSPX metadata record gives a root parameter's first user-data dword, not its size.
d02869fguesses the size as "up to the next slot's first SGPR, or 1 for a trailing block". That guess is wrong after a gap (it takes the gap's SGPRs) and for a trailing multi-dword block (it stays 1 dword).What.
pipeline::create_compute_pieces(0x218): whendesc's root signature is one of ours, its blob (root::blob_of, read back from the objectroot::createmade) goes into the FSPX part as one more entry of our own,native::FSPX_ROOT_SIGNATURE(RTS0).native::fspx_programtakes each record'sNum32BitValuesfrom it (RTS0 1.0 to 1.2, bare or in a DXBC container).metadata_resourcesnow takes the size per slot instead of a bool.root type 0:root constants the root signature does not size;root constants overlapping another root parameter;root constants past the user SGPRs.Guess (marked in code and docs). The console puts all N dwords of a constant in consecutive user SGPRs from the record's dword. The checks above catch a count that contradicts the other records or the SGPR count.
Tests.
compute_root_constants_reach_the_user_data: a 4-dword block followed by a gap; dword 2 (s6) is read. With the root signature, it maps to slot 1 dword 2. Without it, the guess sizes the block at 1 dword and s6 is refused.root_signatures_keep_their_blob(macOS).compute_containerwith and without the entry.victory-shader and victory-gpu tests (arm64), Windows clippy and
cargo xtask policypass. Not verified in game (I don't have it yet): a story-load run should show noroot type 0refusals and no change in the shaders that already translate.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T17:17:00Z.
Merged in
182c14f. The root-signature sizing, the three refusal reasons, thed02869ffallback and the cache keying all read correctly, and the new tests pass. Thanks!