fix(shader): decode scalar NULL operand as Bool::FALSE in lane mask analysis #3369
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3369"
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 reeledMarek on 2026-11-26T20:40:30Z.
Summary
Lanes::operandguarded scalar operands withif code != NULL, letting scalarNULL(code 125, which always reads as 0) fall through to_ => return None.null(such ass_and_saveexec_b32 s0, nullors_mov_b32 exec_lo, null) therefore failed inLanes::sop, turningEXECand saved masks intoAtom::Opaqueinstead ofBool::FALSE.Operand::Scalar { code: NULL, .. }as(Bool::FALSE, false)inLanes::operand, matchingwave.rsandresource.rs.null_scalar_operand_is_zero_mask.Verification
null_scalar_operand_is_zero_maskdirectly againstvictory-shaderon Linuxcargo clippy -p victory-shader --all-targets --target x86_64-pc-windows-msvc --locked -- -D warningscargo test -p xtask --lockedImported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T20:48:55Z.
Review: APPROVED
LGTM — verified on Windows against
origin/main(63bcca4).Operand::Scalar { code: NULL, .. }as(Bool::FALSE, false)inLanes::operandaccurately reflects thatNULLreads as 0 and keepsEXECtracking precise instead of turning it opaque.cargo test -p victory-shader --lib structure:: -- --test-threads=1: 14 passed, 0 failed (1 ignored; includingnull_scalar_operand_is_zero_mask).cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T20:54:54Z.
Review: APPROVED
LGTM — decoding
Operand::Scalar { code: NULL, .. }as(Bool::FALSE, false)inLanes::operandmatches RDNA2 (NULLalways reads 0) across both wave32 and wave64, aligningstructure.rswithwave.rsandresource.rs.Verified
cargo clippy --locked -p victory-shader --all-targets -- -D warnings(default &--all-features): clean.rustfmt --edition 2024: clean on all PR-touched hunks incrates/victory-shader/src/structure.rs.cargo test --locked -p victory-shader --lib -- --test-threads=1 structure:: resource:: ir::: 58 passed, 0 failed, 1 ignored (includingnull_scalar_operand_is_zero_mask).Non-blocking downstream notes
structure.rs:1107-1114,"wqm"buildsa | Atom::Quad(lo). Withnullnow decoding toBool::FALSE,s_wqm_b32 exec_lo, nullproducesQuad, whichemit/lower.rs:2592unconditionally lowers totrue(same pre-existing behavior as inline0; foldinga == Bool::FALSEin"wqm"to(Bool::FALSE, Some(Bool::FALSE))would avoid this).s_cmp_eq/lgwithnull(structure.rs:1208) inherits the existing per-lane mask comparison behavior used for inline0; float inline constants (240..=248) remain unresolved inLanes::operand, and the new test covers wave32 only.Imported from Marvisak/VIctory. Originally posted by Jackster on 2026-11-26T22:29:05Z.
Windows 11,
63bcca4+ this PR:structure::tests::null_scalar_operand_is_zero_maskby name: 1 passed.cargo test -p victory-shader --lib structure::: green.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.The program is
s_and_saveexec_b32 s0, nullfollowed by a restore froms0; the new arm decodes the NULL scalar asBool::FALSErather than falling through to the mask lookup, so the guard comes outSome(Bool::FALSE)instead of opaque. Synthetic only. AI-assisted.Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-27T01:23:17Z.
Independent local verification of PR #3369 (head
9ff1d512c446acf1c861708c4d0285a4519dc3e2), Windows / Rust 1.100.0 / MSVC, worktree-localCARGO_TARGET_DIR,CARGO_BUILD_JOBS=2, synthetic source only, no game data.Command:
cargo test --locked -p victory-shader --lib -- structure::tests::null_scalar_operand_is_zero_mask --exact --test-threads=1 --quietResult:
running 1 test,test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 305 filtered out.git diff --check 63bcca43c6a00a758510398fa43096ce7e4f7df0 HEAD(the real merge base) exits 0. The new test name is absent fromorigin/main(git grepfound 0 hits), confirming the test is added by this PR. Against currentorigin/mainan unrelated trailing blank line incrates/victory-formats/src/xma/tables.rspollutesdiff --check, so the merge base was used.Only the named test was run; the full crate suite was not exercised. GPU/driver: N/A (CPU-only lane-mask analysis). AI-assisted (Hy4 flash). No game data, assets, extracted shaders or DRM were used.
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.