Repository navigation
Fix rounding in SSE byte stores - #357
Nathan Chandrasekar (vera-rubin) wants to merge 3 commits into
Conversation
|
I'll need to look closely at these proposed changes. There are a number of issues where I need to ensure that ARM matches, and that it doesn't negatively impact DirectXTex, etc. which is the primary consumer of these functions. |
|
Yes: |
We should match the behavior of 'scalar', so truncate is probably the right choice. |
|
The DirectXTex and DirectXMesh test suite are quite sensitive to changes in these 'packed' functions, so I think we need to also update DIRECTX_MATH_VERSION to 322 as part of this PR so I can handle the difference in the test suite. |
|
Done: the SSE |
On SSE, storing
XMVectorReplicate(0.75f)withXMStoreByte4orXMStoreUByte4produces0x00000001instead of0x01010101.XMStoreByteN4similarly packs0.25fas0x1f1f1f1finstead of0x20202020. The documented Byte4, UByte4, and ByteN4 operations round each component before packing.We convert each clamped component to an integer before packing with SSE2 instructions, following the short-store implementation.
We checked the reproducer on SSE2, SSE4.1, and AVX2 and added a math3 regression that fails before and passes after, while the full suite retains its five existing math3 failures.
— ChipLab