startup: float-result conversions refuse output modifiers (5 of 29 loading-screen shader refusals) #1698

Closed
opened 2026-11-24 17:28:24 +00:00 by triggered02 · 0 comments
triggered02 commented 2026-11-24 17:28:24 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T17:28:24Z.


Found while triaging the refusals in the first main-game loading-screen shader cache (#870). 5 of 29 refused shaders.

Problem

gfx2hlsl refuses any output modifier on the table-driven conversions, even though the same modifiers are implemented for other float results:

v_cvt_f32_i32_e64 v1, v1 mul:2
-> REFUSED: v_cvt_f32_i32 with ['mul:2']

Cause: the float-result conversions (v_cvt_f32_i32, v_cvt_f32_u32, v_cvt_f32_ubyte0..3, v_cvt_f32_f16) sit in VEC_U, the uint-result table, whose dispatch rejects every modifier before looking at the instruction. Stage.set_vf() already implements clamp, mul:2, mul:4 and div:2 for float results.

Measured

VOP1-as-VOP3 encodings built in the test (0b110101 prefix, opcode 0x180 + 0x05, omod in w1[28:27]), main at 68969ed8:

form before after
v_cvt_f32_i32_e64 v1, v1 v1 = U(float(int(v1))); unchanged
v_cvt_f32_i32_e64 v1, v1 mul:2 refused v1 = U((float(int(v1))) * 2.0);
v_cvt_f32_i32_e64 v1, v1 mul:4 refused ... * 4.0
v_cvt_f32_i32_e64 v1, v1 div:2 refused ... * 0.5
v_cvt_f32_i32_e64 v1, v1 clamp refused U(saturate(float(int(v1))))
v_cvt_f32_u32_e64, v_cvt_f32_f16_e64 with mul:2 refused same rule
v_cvt_f16_f32_e64 v1, v1 mul:2 (uint result) refused stays refused
v_cvt_f32_i32_e64 v1, -v1 (source negation) refused stays refused

Done when

  • The float-result conversions accept exactly clamp, mul:2, mul:4, div:2, and emit the same text as before when no modifier is present.
  • op_sel and source modifiers are still refused on a conversion rather than silently ignored.
  • Uint-result conversions keep refusing output modifiers.
  • A ctest starts from synthetic encoded instructions, decodes, then translates, and fails if the dispatch is removed.
  • docs/experiments.md records the accepted modifiers.

Not in this slice: op_sel/abs/neg on conversions (still refused), and proving the loading screen gets further (census counts are aggregates only).

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6587613876 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1705). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T17:28:24Z. --- Found while triaging the refusals in the first main-game loading-screen shader cache (#870). **5 of 29** refused shaders. ## Problem `gfx2hlsl` refuses any output modifier on the table-driven conversions, even though the same modifiers are implemented for other float results: ``` v_cvt_f32_i32_e64 v1, v1 mul:2 -> REFUSED: v_cvt_f32_i32 with ['mul:2'] ``` Cause: the float-result conversions (`v_cvt_f32_i32`, `v_cvt_f32_u32`, `v_cvt_f32_ubyte0..3`, `v_cvt_f32_f16`) sit in `VEC_U`, the uint-result table, whose dispatch rejects every modifier before looking at the instruction. `Stage.set_vf()` already implements `clamp`, `mul:2`, `mul:4` and `div:2` for float results. ## Measured VOP1-as-VOP3 encodings built in the test (`0b110101` prefix, opcode `0x180 + 0x05`, omod in `w1[28:27]`), `main` at `68969ed8`: | form | before | after | |---|---|---| | `v_cvt_f32_i32_e64 v1, v1` | `v1 = U(float(int(v1)));` | unchanged | | `v_cvt_f32_i32_e64 v1, v1 mul:2` | refused | `v1 = U((float(int(v1))) * 2.0);` | | `v_cvt_f32_i32_e64 v1, v1 mul:4` | refused | `... * 4.0` | | `v_cvt_f32_i32_e64 v1, v1 div:2` | refused | `... * 0.5` | | `v_cvt_f32_i32_e64 v1, v1 clamp` | refused | `U(saturate(float(int(v1))))` | | `v_cvt_f32_u32_e64`, `v_cvt_f32_f16_e64` with `mul:2` | refused | same rule | | `v_cvt_f16_f32_e64 v1, v1 mul:2` (uint result) | refused | stays refused | | `v_cvt_f32_i32_e64 v1, -v1` (source negation) | refused | stays refused | ## Done when - The float-result conversions accept exactly `clamp`, `mul:2`, `mul:4`, `div:2`, and emit the same text as before when no modifier is present. - `op_sel` and source modifiers are still refused on a conversion rather than silently ignored. - Uint-result conversions keep refusing output modifiers. - A ctest starts from **synthetic** encoded instructions, decodes, then translates, and fails if the dispatch is removed. - `docs/experiments.md` records the accepted modifiers. Not in this slice: `op_sel`/`abs`/`neg` on conversions (still refused), and proving the loading screen gets further (census counts are aggregates only). AI-assisted (Claude Code).
Sign in to join this conversation.
No labels
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.

Reference
R0Y00/Xbox2Windows#1698
No description provided.