SIMD hull collision (#93)

SIMD based hull collision inspired by example code from @cairnc in #54 

<img width="1676" height="1332" alt="image"
src="https://github.com/user-attachments/assets/58b137bd-bf7b-4c99-863c-64341b973a3d"
/>

- Fixed #78
- Fixed #85 and fixed CI to error on UB.
- Updated benchmarks
- Added AMD scalar benchmarks
- Added Neon benchmarks
- More determinism unit tests
- Sample leak detection
- Added b3Body_AllowFastRotation
- Added b3Body_IsFastRotationAllowed
- Bumped b3HullData version
- Bumped b3CompoundData version
This commit is contained in:
Erin Catto 2026-07-18 22:43:03 -07:00 • committed by GitHub
commit c37cfe4cd7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
84 changed files with 3898 additions and 1151 deletions

View file

@ -146,13 +146,13 @@ static int CreateHullMaxVertexTest( void )
// Below the floor: clamps up to 4.
b3HullData* h2 = b3CreateHull( points, count, 1 );
ENSURE( h2 != NULL );
ENSURE( h2->vertexCount >= 4 && h2->vertexCount <= 255 );
ENSURE( h2->vertexCount >= 4 && h2->vertexCount <= B3_MAX_HULL_VERTICES );
b3DestroyHull( h2 );
// Above the ceiling: clamps down to 255.
// Above the ceiling: clamps down to B3_MAX_HULL_VERTICES.
b3HullData* h3 = b3CreateHull( points, count, 1000 );
ENSURE( h3 != NULL );
ENSURE( h3->vertexCount >= 4 && h3->vertexCount <= 255 );
ENSURE( h3->vertexCount >= 4 && h3->vertexCount <= B3_MAX_HULL_VERTICES );
b3DestroyHull( h3 );
return 0;
@ -341,9 +341,8 @@ static void FillCubeSample( b3Vec3* points, int count, uint32_t seed )
// 24*M - 48 in src/hull.c::b3ComputeHullWorkSizes) close to their peak by sweeping M
// on a dense random sphere. If the peak face/edge count exceeds the cap and the free
// list fails to reclaim slots in time, the assertion at src/hull.c::NewFace/NewEdge
// fires (exit code 3). M is held <= 80 because the finalization stage caps the final
// hull's face/edge count at B3_HULL_LIMIT (255), and a fully-triangulated hull with
// V > 87 vertices has 3V - 6 > 255 edges (src/hull.c:2010 returns NULL).
// fires (exit code 3). A dense sphere hull is fully triangulated, so F = 2M - 4 and the
// final face limit B3_MAX_HULL_FACES binds well before the vertex or edge limits.
static int CreateHullSphereStressTest( void )
{
enum { N = 512 };
@ -352,8 +351,8 @@ static int CreateHullSphereStressTest( void )
// Multiple seeds exercise different horizon-size / merge-cascade sequences.
const uint32_t seeds[] = { 12345u, 1u, 0xdeadbeefu, 0xcafef00du };
// M kept <= 40: random sphere inputs at higher M exceed the half edge limit of UINT8_MAX
const int M_values[] = { 16, 24, 32, 40 };
// M kept <= 32 so the final face count 2M - 4 stays under B3_MAX_HULL_FACES
const int M_values[] = { 16, 24, 32 };
for ( int s = 0; s < ARRAY_COUNT( seeds ); ++s )
{