Repository navigation
|
Hello! |
Replies: 1 comment
|
This is a real bug in Good news: this is already fixed upstream. Commit // unsigned compares are not supported on x86
PX_FORCE_INLINE VecU16V V4U16CompareGt(VecU16V a, VecU16V b)
{
const PxU16 signMask = 0x8000;
const __m128i signBit = _mm_set1_epi16(PxI16(signMask));
const __m128i a_i = _mm_xor_si128(_mm_castps_si128(a), signBit);
const __m128i b_i = _mm_xor_si128(_mm_castps_si128(b), signBit);
const __m128i result = _mm_cmpgt_epi16(a_i, b_i);
return _mm_castsi128_ps(result); // Back to __m128
}It flips the sign bit on both operands and does a signed So the proper fix is to take PhysX at Since you're pulling PhysX through vcpkg: the --- a/include/foundation/PxVecMathSSE.h
+++ b/include/foundation/PxVecMathSSE.h
@@ -2676,15 +2676,14 @@
// unsigned compares are not supported on x86
PX_FORCE_INLINE VecU16V V4U16CompareGt(VecU16V a, VecU16V b)
{
- VecU16V result;
- result.m128_u16[0] = PxU16((a).m128_u16[0] > (b).m128_u16[0]);
- result.m128_u16[1] = PxU16((a).m128_u16[1] > (b).m128_u16[1]);
- result.m128_u16[2] = PxU16((a).m128_u16[2] > (b).m128_u16[2]);
- result.m128_u16[3] = PxU16((a).m128_u16[3] > (b).m128_u16[3]);
- result.m128_u16[4] = PxU16((a).m128_u16[4] > (b).m128_u16[4]);
- result.m128_u16[5] = PxU16((a).m128_u16[5] > (b).m128_u16[5]);
- result.m128_u16[6] = PxU16((a).m128_u16[6] > (b).m128_u16[6]);
- result.m128_u16[7] = PxU16((a).m128_u16[7] > (b).m128_u16[7]);
- return result;
+ const PxU16 signMask = 0x8000;
+ const __m128i signBit = _mm_set1_epi16(PxI16(signMask));
+
+ const __m128i a_i = _mm_xor_si128(_mm_castps_si128(a), signBit);
+ const __m128i b_i = _mm_xor_si128(_mm_castps_si128(b), signBit);
+ const __m128i result = _mm_cmpgt_epi16(a_i, b_i);
+ return _mm_castsi128_ps(result); // Back to __m128
}and wire it in with |

This is a real bug in
V4U16CompareGt()inphysx/include/foundation/PxVecMathSSE.h: it reaches intoVecU16V(which is just__m128) via a.m128_u16union member that only exists in the MSVC/Unix headers, not for clang-cl's generic<xmmintrin.h>handling of__m128. So it breaks specifically for clang-cl builds on Windows going through the SSE path.Good news: this is already fixed upstream. Commit
3ca45ad3("update ovphysx 0.5.10", 2026-08-07, tagovphysx-0.5.10) rewroteV4U16CompareGtto avoid the union entirely: