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:
parent
be8c731890
commit
8f3b2e12eb
18 changed files with 1161 additions and 138 deletions
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue