shader: pack integer pairs to 16 bits with saturation (#401) #406
No reviewers
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS!406
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-402"
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?
@tiagonogueiraa-bit on GitHub · 2026-11-27 16:55 UTC · original
tiagonogueiraa-bit:shader-cvt-pk-u16→main· +75 −0 · 3 files · 1 commits · merged 2026-11-28 00:28 UTCRefs #405
Shape.
v_cvt_pk_u16_u32(VOP3 0x36a) was refused by name in 9 pixel shaders. It packs two 32-bit integers into one dword, src0 in the low half and src1 in the high one, each saturated to 16 bits. Mesa's ACO selects NIR'spack_uint_2x16andpack_sint_2x16, which NIR defines as clamping, tov_cvt_pk_u16_u32andv_cvt_pk_i16_i32.Change. In
Lower::valu_op, both are lowered:0..=0xffff;-32768..=32767and keeps the low 16 bits;Nothing else changes.
By-output corpus sweep. 26,849 containers from my own runs (Series S, boot to the story load), native host options, main
b998bb6against this head:Gained:
28e8d398fb691e37,312178ad7218ccd3,422f7a28d73c331e,95e450f40c72b9b0,a574d44728bcfe55,e72b5ea82a653237,ebfb717fd259810a,f1d1ccf768189e23,f218c31ec76c0efe.Test.
split_wave_tests::integer_pairs_pack_to_16_bits_with_saturation(victory-gpu, on Metal with MSC 4.0 beta 3). Over 32 lanes, each form packs values that cross both limits:i << 12past0xffff, and0x10002 - i;(i << 12) - 0x10000below -32768 and above 32767.The values are checked against Rust's
min/clamp. On main the program fails at translation.Checks.
cargo test -p victory-shader -p victory-hle -p victory -p victory-gpu -p victory-metal -p xtask: 1054 passed, 0 failed, 11 ignored.-D warnings: clean.cargo xtask policy: ok.docs/native-host.mdhas a short section on it. @Olima34, for the board.