Repository navigation
Conversation
Assign the half-float sign only when the scaled magnitude is nonzero. Add bit-exact synthetic zero-crossing and exhaustive scaling checks against independent arithmetic. Keep the separate minimum-endpoint fix in PR ItsNotRexed#6120 independent. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
AI-assisted Windows CPU check at The two published commits currently have the same round-44 parent. Exact #6175 alone therefore lacks #6120’s minimum-endpoint correction. Composing the two changes in a disposable in-memory check corrected those same eight zero words, retained all nine All four compressed DDS outputs stayed byte-identical, and decoding them reproduced the direct results. The focused suite passed seven with one exporter-dependent skip at #6175. Synthetic inputs only. |
Claimed in the coordination issue as: #6089 (comment)
Depends on: #6120
What and why
Fix the pre-existing signed BC6H zero-sign defect reported at #6089 (comment). An interpolant of -1 scales to integer zero, so its half-word must be 0x0000 rather than 0x8000. Only restore the negative sign when the final magnitude is nonzero.
One production line changes. Add bit-exact tests against an independent signed-integer truncation oracle, all 16 interpolation weights of 272 synthetic mode-14 blocks crossing zero, and a short format note. Reference: Microsoft BC6H finalization. No Microsoft source code or game content is copied.
Conflict, not a code dependency: based independently on main at 561b65a. #6120 at a574976 fixes a different defect (the -32768 endpoint) in the same
_bc6h_finishhunk. Its branch was not changed and its fix is not included here. Whichever lands second must preserve both changes: on #6120's implementation the final condition becomesval < 0 and h. The separate minimum-endpoint behavior is unchanged by this PR.Tested
Windows CPU, Python standard library, synthetic inputs only:
python -I tests\test_ttpf_mips.py -k bc6h_finish_scalingpython -I tests\test_ttpf_mips.py -k bc6h_signed_mode14_zeropython -I tests\test_ttpf_mips.pypython -I tests\test_bcpack.pypython -I tests\test_bcpack_history_calib.pypython -I tests\test_ttpf_assets.pypython -m compileall -q make_game.py tools testsgit diff --checkpython -I -(in-memory compatibility experiment)Across all 65,536 signed and 65,536 unsigned interpolants, comparison with the base implementation found exactly one changed result: signed -1, 0x8000 -> 0x0000. The persisted oracle test covers signed -32767..32767 and unsigned 0..65535; it deliberately leaves #6120's separate -32768 defect alone. Scaling division is exact in binary before truncation for these bounded integers.
Also loaded #6120's two production functions in memory, applied this zero-sign guard, and combined its revised BC6H tests with this branch's suite: 80 tests passed. All 65,536 signed interpolants then matched the independent arithmetic oracle, including -32768 -> 0xfc00. No checkout or modification of the author's branch was needed.
No new GPU run in this PR. The prior independent native D3D11 measurement on RTX 4070 Ti / driver 610.88 is linked in the original finding and #6120 review; it is not presented as a new run. Shader-translator validation: not applicable.
AI-assisted: yes
Checklist
docs/design.md, with how it was confirmed.The translator-rule item is not applicable: no translator changes.