Hmmm, good, I found my issue:
#define MAX_SPU_COMPOUND_SUBSHAPES 16
I understand there might be a reason for these arrays to have constant sizes, however it is very error-prone and could easily lead to some crash...
Couldn't these arrays be extendable (btAlignedArray) ?
For instance, there is no way to control how many child shapes are being created during the "ConvexBuilder" process (only the recursion depth can be), so I have no way to make sure the number of children is < MAX_SPU_COMPOUND_SUBSHAPES in any case...
So basically there is no way the software will not crash without controlling all data that could be virtually used. As the user might add his own data, the situation looks very dangerous to me..
Some assert() would help as well here in my opinion.
Or maybe I missed something ?
I have increased the value of MAX_SPU_COMPOUND_SUBSHAPES to 64 and recompiled. Now, my framerate is much lower (1 FPS now) so I started a quick profiling session.
Nearly 90% of the time is spent in ProcessConvexConcaveSpuCollision(), see the results below. One static mesh, one vehicle, 60 cinematic convex hull decomposition shapes.
I am not sure I am doing everything correctly. But I came to the conclusion that the multithreaded stuff is not usable yet...
