shader: lower v_cvt_pknorm_i16_f32 and v_cvt_pknorm_u16_f32 in direct DXIL #3296

Closed
opened 2026-11-28 05:48:58 +00:00 by github-bot · 0 comments
Owner

@⁠legacy-code-archaeologist on GitHub · 2026-11-28 05:46 UTC · original

Refs #2935.

Lower VOP3 v_cvt_pknorm_i16_f32 (0x368) and v_cvt_pknorm_u16_f32 (0x369) in DirectCompute::float_alu() (src/gfx1013_direct_compute.inl) for both direct Compute and Pixel DXIL:

  • Pack cvt_norm(S0.f32) into D[15:0] and cvt_norm(S1.f32) into D[31:16] (round_rne(clamp(x, -1, 1) * 32767) and round_rne(clamp(x, 0, 1) * 65535)).
  • Evaluate in exact 32-bit unsigned integer round-to-nearest-even arithmetic (m * (2^k - 1) split at bit k), avoiding desktop float rounding/ftz differences and i64 dependency.
  • Handle NaN -> 0, |x| >= 1.0 (±Inf included) saturation, < 2^-17 underflow to 0, VOP3 abs[1:0]/neg[1:0], and VGPR/SGPR/literal/inline sources, while keeping clamp, omod, op_sel, third-operand abs/neg, nonzero src2, and DPP/SDWA encodings refused.

AI-assisted.

**@⁠legacy-code-archaeologist** on GitHub · 2026-11-28 05:46 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/3294) Refs #2935. Lower VOP3 `v_cvt_pknorm_i16_f32` (`0x368`) and `v_cvt_pknorm_u16_f32` (`0x369`) in `DirectCompute::float_alu()` (`src/gfx1013_direct_compute.inl`) for both direct Compute and Pixel DXIL: - Pack `cvt_norm(S0.f32)` into `D[15:0]` and `cvt_norm(S1.f32)` into `D[31:16]` (`round_rne(clamp(x, -1, 1) * 32767)` and `round_rne(clamp(x, 0, 1) * 65535)`). - Evaluate in exact 32-bit unsigned integer round-to-nearest-even arithmetic (`m * (2^k - 1)` split at bit `k`), avoiding desktop float rounding/ftz differences and `i64` dependency. - Handle NaN -> `0`, `|x| >= 1.0` (`±Inf` included) saturation, `< 2^-17` underflow to `0`, VOP3 `abs[1:0]`/`neg[1:0]`, and VGPR/SGPR/literal/inline sources, while keeping `clamp`, `omod`, `op_sel`, third-operand `abs`/`neg`, nonzero `src2`, and DPP/SDWA encodings refused. AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 05:48:58 +00:00
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/R0Y00--Xbox2Windows#3296
No description provided.