ffx: define float-to-integer conversion at NaN and saturation boundaries #443
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/449"
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 R0Y00/Xbox2Windows. Originally posted by descent81 on 2026-11-22T04:06:57Z.
Fixes #439.
The dispatch translator used bare HLSL casts for both float-to-integer instructions. The new helpers convert NaN to zero and clamp the operand to a finite, representable value before the cast. Positive overflow selects the integer maximum explicitly, since that maximum is not exactly representable in binary32.
Verification
The previous casts also matched in this D3D11 harness on these drivers. The change removes undefined cast inputs. Whether a normal dispatch supplies exceptional values remains unmeasured.
Reproduce after a dev build:
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T04:21:48Z.
The 19 runtime pairs cover the agreed boundaries, but the old casts also pass this readback. The independent report in #439 found a distinguishing case: converting immediate +Inf and folding the result into a UAV store made DXC reject the old shader with “Assignment of undefined values to UAV.” Please add that immediate case through the FFX emitter to the Windows regression, verify the guarded shader compiles and reads back 0xffffffff / 0x7fffffff, and record the old-cast result with the compiler version. The existing runtime cases should stay.