Shaders/spill: reject hybrid root layouts and s16+ hardware-initialized SGPR overlap #629
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/629"
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 fxceless/victory-fork. Originally posted by AscilCH on 2026-11-25T03:26:16Z.
Problem
Two bugs in
crates/victory-shader/src/spill.rs:spilled()only filtered layout entries withuser_data >= registersbefore checkingmin == Some(16). If a compute shader declared both in-register root parameters (user_data < 16) and spilled entries starting at16,is_spilled()returnedtrue, andemit/lower.rs:2539computedu32::from(rp.user_data) + dword - 16, panicking with subtraction underflow in debug builds (or wrapping in release).SV_GroupID/ system SGPR clobbering ats16+:spilled()never verifiedcs.initialized_sgprs() <= 16, anduser_data()reused pre-existingp.inputsentries forReg::S(16+). Ifuser_sgprsplus system SGPRs (TGID_X/Y/Z,GroupInfo, or scratch wave offset) reacheds16, rewritten spilled index 16 silently aliased and overwroteSV_GroupIDin lowering.Fix
registers >= 2andu32::from(cs.initialized_sgprs()) <= FIRST(16) inspill::spilled().sgprs > 0and requiremin == Some(FIRST)so hybrid layouts with any entry below 16 are rejected cleanly.Values in a dedicatedspilled_inputsmap instead of reusing pre-existingp.inputsentries, and use checked arithmetic on spilled dword offsets.hybrid_layout_with_register_and_spilled_params_is_rejectedandsystem_sgpr_reaching_s16_is_rejected.Verification
cargo test -p victory-shader --locked spill::tests: 5 passed, 0 failedcargo xtask policy: 169 files okcargo clippy -p victory-shader --all-targets --locked -- -D warnings: clean(AI-assisted; synthetic unit tests only, no game data.)
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.