victory-shader: resolve Structured::other and constant masks in v_cndmask_b32 (port of VIctory#1221) #193
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/Belobug--VIctory-Belobug-AMD!193
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-193"
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?
@lcg007xd-c on GitHub · 2026-11-25 20:26 UTC · original
lcg007xd-c:port/vic-1221→main· +43 −0 · 1 files · 1 commits · openPort of Marvisak/VIctory#1221 by bartikele. It is cherry-picked with
-x, so the commit keeps its author and its upstream hash. This fork'smain(000ffdd) does not have it, and it is not in #142.What it fixes
v_cndmask_b32with a constant mask, or a mask the structure pass tracks among its other values, was refused in pixel programs (compute programs got by through the numeric-select retry). The fork already keeps the same map under the nameothers, so no new field: the constant case and anotherslookup go into the fork'sselect_condition; a miss still reports an untracked select, so the retry is unchanged.Tested (Linux, Rust 1.98.1)
v_cndmask_accepts_uniform_and_constant_masks(uses the fork'slowers_rsrc2) fails on this fork's main and passes with the port; a temporary pixel-shader test also failed without it.cargo test -p victory-shader --libon this branch alone: no failures.mainwithout conflicts, and does not depend on the other open ports.Not run here: Windows/GPU tests, since I have no Windows machine.
🤖 Generated with Claude Code
@MamaLeVrai on GitHub · 2026-11-26 04:58 UTC · original
One case where the new inline-constant branch in
v_cndmask_b32(lower.rs, around line 3756 of the PR) gives a wrong select instead of an error, from reading the code (not seen in a real program):lane_bitwheneverself.console_lanesis set.lane_bitsays it is not for programs split in halves:debug_assert!(!self.split || self.console_cf).splitcan be true withconsole_lanestrue andconsole_cffalse. That happens for a wave64 compute program on a host that does not run 64 lanes, whereconsole_lanescomes fromin_halfinstructions (DPP,ds_swizzle, quad derivatives) and nothing marksreads_wholeormasks_held.v_cndmask_b32whose mask is an inline constant does not set either of those withnumeric_selectsoff. Before this PR it failed withUNTRACKED_SELECT, so the program was retried with numeric selects and not split. Now it takes the new branch.lane_bit's non-console-flow path takes the host lane index (0-31) in both halves, so console lanes 32-63 readloinstead ofhi. With mask1, for example, lane 32 pickssrc1where the console pickssrc0. Debug builds hit the assert.This only concerns hosts that do not run 64-lane waves (RDNA cards do), so it is narrow. A guard like
else if self.console_lanes && (!self.split || self.console_cf), falling through to theErrotherwise, would keep the old retry for that case.AI-assisted (Claude Code); no game data.
@adrianmjim on GitHub · 2026-11-26 19:45 UTC · original
Tested on Windows 11 with an RX 7900 XT (RDNA3, driver 32.0.32029.2010) and Rust 1.98.1. I tested head
2222cefmerged onto main4f62c2a. The branch sits on000ffdd, but it merges onto4f62c2awithout conflicts.Full game shaders.rpf,
translate --validate --host-lanes 32-64, compared with4f62c2a:v_cndmask_b32in the archive uses an inline-constant mask.So on this title the PR changes no output.
Tests (
cargo test -p victory-shader --lib -- --test-threads=1):4f62c2a: 278 passed, 0 failed, 6 ignored. Main4f62c2a: 277 passed, 0 failed, 6 ignored.4f62c2a,v_cndmask_accepts_uniform_and_constant_masksfails with "a select on an untracked mask".-1mask only. A copy of the test with only thes_cselect_b32select passes on main.s_cselect_b32-only case fails on main and passes with this PR. So theotherslookup works, but no committed test covers it. It could be added as its own test, for example as a pixel program.One thing from reading the code (not hit in this corpus, not tested): in wave64 the constant branch sign-extends the 32-bit value from
inline()for every code. That is right for the integer constants (128-208). The fork's owns_mov_b64folding inresource.rssign-extends only those codes. The float constants (240-248) in a 64-bit operand should be the f64 encodings, not sign-extended f32 bits.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.