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

@ -2,8 +2,11 @@
// SPDX-License-Identifier: MIT
#include "block_allocator.h"
#include "core.h"
#include "test_macros.h"
#include "box3d/types.h"
typedef struct
{
int value1;
@ -40,10 +43,57 @@ static int TestBlockClear( void )
return 0;
}
// The free list link is a pointer stored in the element, so a stride that is not a multiple
// of the alignment leaves odd elements on a bad boundary. See issue #78.
static int TestBlockAlignment( void )
{
// The manifold sizes are the reported case
int elementSizes[] = { 12, (int)sizeof( b3Manifold ), 3 * (int)sizeof( b3Manifold ) };
for ( int i = 0; i < ARRAY_COUNT( elementSizes ); ++i )
{
b3BlockAllocator allocator = b3CreateBlockAllocator( elementSizes[i], 0 );
// Hold the elements so the indices advance and a block boundary is crossed
void* elements[B3_BLOCK_SIZE + 8];
int count = ARRAY_COUNT( elements );
for ( int j = 0; j < count; ++j )
{
elements[j] = b3AllocateElement( &allocator );
ENSURE( elements[j] != NULL );
ENSURE( ( (uintptr_t)elements[j] & ( B3_ALIGNMENT - 1 ) ) == 0 );
}
for ( int j = 0; j < count; ++j )
{
b3FreeElement( &allocator, elements[j] );
}
// Now drain the free list
for ( int j = 0; j < count; ++j )
{
elements[j] = b3AllocateElement( &allocator );
ENSURE( elements[j] != NULL );
ENSURE( ( (uintptr_t)elements[j] & ( B3_ALIGNMENT - 1 ) ) == 0 );
}
for ( int j = 0; j < count; ++j )
{
b3FreeElement( &allocator, elements[j] );
}
b3DestroyBlockAllocator( &allocator );
}
return 0;
}
int AllocatorTest( void )
{
RUN_SUBTEST( TestBlockAllocate );
RUN_SUBTEST( TestBlockClear );
RUN_SUBTEST( TestBlockAlignment );
return 0;
}