You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes three related 16-bit VALU / SDWA lowering bugs in crates/victory-shader/src/emit/lower.rs:
Honor SDWA destination selection and UNUSED_SEXT in write_half()
Previously, write_half() rejected byte dst_sel (0..=3) and ignored dst_unused == 1 (UNUSED_SEXT), zero-extending even negative 16-bit results instead of sign-extending them across the upper bits.
Delegate SDWA dst_sel0..=5 (BYTE_0..BYTE_3, WORD_0, WORD_1) and dst_unused0..=2 (UNUSED_PAD, UNUSED_SEXT, UNUSED_PRESERVE) directly to place_bits(), matching 32-bit SDWA writes.
Support SDWA byte source selections and sext on 16-bit integer sources in half_src_typed()
Previously, half_src() rejected byte src_sel (0..=3) and ignored sd.sext.
Route SDWA src_sel0..=5 through select_bits(x, sel, sext) (applying sd.sext for 16-bit integer ops, masked to 16 bits as the operand width).
Decode inline float constants (240..=248) using f32 bit patterns for 16-bit integer instructions (half_int_src())
On GFX10/RDNA2, 16-bit integer instructions (v_add_nc_u16, v_cvt_f16_i16, v_cmp_*_u16/i16, etc.) read the low/high halves of the 32-bit float constant rather than the f16 encoding (matching how packed_src(..., float) already distinguishes v_pk_*_f16 from v_pk_*_i16/u16).
Added half_int_src() for the 16-bit integer call sites while keeping half_src() for f16 instructions.
Verification
Added 3 end-to-end tests in crates/victory-shader/src/emit/valu_tests.rs:
sdwa_16bit_dst_word0_sext_and_byte_placement
sdwa_16bit_src_byte_select_and_sext
int16_inline_float_constants_use_f32_bits
Verified on Windows 11 with dxil.dll, NVIDIA GeForce RTX 4060, and WARP (cargo test --workspace --locked: 345 passed, 0 failed, 6 ignored; all 3 new tests fail on unpatched mainffe310e).
cargo clippy --workspace --all-targets --locked -- -D warnings and --all-features both pass cleanly.
cargo xtask policy passed (2 files ok, no game files/assets).
Fixes three related 16-bit VALU / SDWA lowering bugs in
crates/victory-shader/src/emit/lower.rs:UNUSED_SEXTinwrite_half()write_half()rejected bytedst_sel(0..=3) and ignoreddst_unused == 1(UNUSED_SEXT), zero-extending even negative 16-bit results instead of sign-extending them across the upper bits.dst_sel0..=5(BYTE_0..BYTE_3,WORD_0,WORD_1) anddst_unused0..=2(UNUSED_PAD,UNUSED_SEXT,UNUSED_PRESERVE) directly toplace_bits(), matching 32-bit SDWA writes.sexton 16-bit integer sources inhalf_src_typed()half_src()rejected bytesrc_sel(0..=3) and ignoredsd.sext.src_sel0..=5throughselect_bits(x, sel, sext)(applyingsd.sextfor 16-bit integer ops, masked to 16 bits as the operand width).240..=248) using f32 bit patterns for 16-bit integer instructions (half_int_src())v_add_nc_u16,v_cvt_f16_i16,v_cmp_*_u16/i16, etc.) read the low/high halves of the 32-bit float constant rather than the f16 encoding (matching howpacked_src(..., float)already distinguishesv_pk_*_f16fromv_pk_*_i16/u16).half_int_src()for the 16-bit integer call sites while keepinghalf_src()for f16 instructions.Verification
crates/victory-shader/src/emit/valu_tests.rs:sdwa_16bit_dst_word0_sext_and_byte_placementsdwa_16bit_src_byte_select_and_sextint16_inline_float_constants_use_f32_bitsdxil.dll, NVIDIA GeForce RTX 4060, and WARP (cargo test --workspace --locked: 345 passed, 0 failed, 6 ignored; all 3 new tests fail on unpatchedmainffe310e).cargo clippy --workspace --all-targets --locked -- -D warningsand--all-featuresboth pass cleanly.cargo xtask policypassed (2 files ok, no game files/assets).