Shaders: a scalar joining a lane mask and a number lowers in pixel and vertex programs #1073
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1073"
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 Marvisak/VIctory. Originally posted by undeadhuman37 on 2026-11-24T15:28:29Z.
A register can hold a compare result's high dword on one path and a loaded number on another. The join's mask side was refused as "a lane mask read as data". A pixel or vertex program now takes the mask's ballot as that incoming value (counts and zero tests mean the same on any wave size).
Known limit: the ballot is the host wave's, so a join read some other way would differ from the console.
Measured offline over the shader corpus (26148 programs):
Tests: a synthetic wave64 pixel program fails to lower before the change and lowers after.
cargo clippy -p victory-shader --all-targets -- -D warningsis clean. Not run on a GPU, hence draft.No game data. AI-assisted: written with Claude Code (Claude Sonnet 5.5).
🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T15:32:51Z.
Review: APPROVED
Tested merged cleanly onto
main(ffe310e) on Windows 11 x64 (Rust 1.98.1 MSVC) with NVIDIA GeForce RTX 5090 (Blackwell) and WARP:cargo test -p victory-shader: 121 passed, 0 failed, 1 ignored (all hardware + WARP VALU/waterfall/diff tests green on RTX 5090 and WARP)cargo clippy -p victory-shader --all-targets: 0 warningscargo xtask policy: okClean lowering of mixed lane-mask/number scalar joins across pixel and vertex stages. Approving.
AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T15:37:32Z.
Review: COMMENTED
Draft noted — the lowering change is the same hunk as #1074 (
emit/lower.rsidentical, same index line), and #1074 additionally carries thestructure.rsspilled-lane tracking plus a second test. If both are meant to land, #1074 subsumes this one; if this is the smaller first step, say so and I'll review it as such.On the change itself: the ballot fallback for a mask dword joined with a number is a pragmatic approximation, and the comment is honest about its limit (a join read any other way than a zero test/count would diverge from console). Two things worth pinning before it leaves draft: (1) a host-execution test on the Windows lane showing the joined value is only ever consumed by a zero test or count in the programs this targets, since the fallback silently changes semantics otherwise; (2) the
ballot_okgate requiresdef_block != cur_ir— a same-block join still refuses, which is the safe direction, but worth a test so the boundary is intentional.Verified locally: test-merge with main clean;
cargo test -p victory-shader --locked(macOS arm64, rustc 1.98.1) → 97 passed / 0 failed / 1 ignored (the new emit test runs on macOS).Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:31:38Z.
Automated triage for the maintainers. Closing because this change is already in
main, ormainhas since replaced the code it patches.Draft. A register joining a mask and a number in pixel/vertex programs: main resolves these joins by proving the mask edge dead or the join data (dead_on_edge, live_edges, joins_loaded;
0b35b7fe,a7fc47af), 250 to 4 programs, without taking a host-wave ballot as the console's number.If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed