Manifold allocation cap (#227)

Degenerate scenarios can lead to a huge number of manifolds per contact.
This creates memory and performance problems. So I'm capping them to 8
using cheap heuristics for culling.
This commit is contained in:
Erin Catto 2026-11-17 13:51:59 -08:00 • committed by GitHub
commit 8f3b2e12eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 1161 additions and 138 deletions

View file

@ -49,6 +49,7 @@ static SampleContext s_context;
static int s_frame = 0;
static int s_frameLimit = -1;
static int s_sampleOverride = -1;
static bool s_openReplay = false;
static int s_exitCode = 0;
static int CompareSamples( const void* a, const void* b )
@ -135,6 +136,12 @@ static void OnInit( void )
index = s_sampleOverride;
}
// Resolved here rather than at parse time because sorting moves the slot.
if ( s_openReplay && g_replayIndex >= 0 )
{
index = g_replayIndex;
}
SelectSample( &s_context, index, false );
}
@ -535,11 +542,8 @@ static sapp_desc BuildAppDesc( int argc, char** argv )
{
const char* path = argv[++i];
if ( g_replayIndex >= 0 )
{
snprintf( s_context.replayFile, sizeof( s_context.replayFile ), "%s", path );
s_sampleOverride = g_replayIndex;
}
snprintf( s_context.replayFile, sizeof( s_context.replayFile ), "%s", path );
s_openReplay = true;
}
else if ( strcmp( argv[i], "--zup" ) == 0 )
{