ffx: define float-to-integer conversion at NaN and saturation boundaries #449
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!449
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/449/head"
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?
@descent81 on GitHub · 2026-11-22 04:06 UTC · original
descent81:ffx/defined-float-to-int→main· +132 −13 · 9 files · 2 commits · merged 2026-11-22 04:36 UTCFixes #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:
@R0Y00 on GitHub · 2026-11-22 04:21 UTC · original
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.