shader: translate sample and gather variants with offsets and comparisons #92
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/92"
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 LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-26T14:29:21Z.
What this changes
The translator refused by name the sample variants with texel offsets (
image_sample_lz_o,_l_o,_b_o,_c_o,_c_lz_o,_d_o…) and the comparison gatherimage_gather4_c_lz(_o), used for shadow filtering. The offset was read forimage_sample_oonly, and the level and bias by exact name._ois now a suffix of any sample or gather: the offset is the first address VGPR, then the bias, the comparison value, the derivatives, the coordinates and the level, in the RDNA2 ISA reference's MIMG order (8.2.5). Every sample op takes the offsets (6-bit signed per axis on the console, immediate -8..7 in DXIL); a computed offset, one past -8..7, or one on a cube is refused.image_gather4_c_lzlowers totextureGatherCmp(op 74), with the reference value before the coordinates. Guess, marked: a comparison gather compares the channel dmask picks while DXIL's compares red, so only red is taken and other channels are refused.Tests: a new
sample_tests.rstranslates each variant from hand-assembled GFX10 code and checks the DXIL call and its constant arguments (opcode, offsets, level, bias, comparison). There are no Windows value tests yet.How it was tested
cargo test -p victory-shaderand arm64cargo test --workspace(value probes run only in the Windows CI)cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings, also with--all-featurescargo xtask policyChecklist
VICTORY_*variable and documented (none added)Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T14:54:49Z.
Review: APPROVED
Address order and offset handling match the ISA, and the red-only gather guess is clearly marked. Thanks.