Shaders/spill: reject hybrid root layouts and s16+ hardware-initialized SGPR overlap #629
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!629
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@AscilCH on GitHub · 2026-11-25 03:26 UTC · original
AscilCH:fix/shader-spill-hybrid-layout-and-system-sgpr-clash→main· +69 −15 · 1 files · 1 commits · openProblem
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.