ExtensionQuickLoad::createConvexMesh assert

Working on Playstation Vita, using the following software:
Microsoft Visual Studio 2010 Professional SP1
Unreal Engine 3
Vita SDK 3.000.061
PhysX Source 2.8.4

I turned on quick loading (UE3 #define “USE_QUICKLOAD_CONVEX”) which causes the game engine to attempt to load convex physics assets from cooked data rather than constructing everything at runtime. Specifically, this causes FKAggregateGeom::InstanceNovodexGeom to call GNovodeXQuickLoad->createConvexMesh. In order to support this, I had to compile my own libPhysXExtensions.a for the Vita.

The problem is that in the majority of cases, ExtensionQuickLoad::createConvexMesh returns NULL. The underlying cause turned out to be that ExtensionQuickLoad::malloc is overrunning the PermAllocate pre-allocated buffer on the Vita. After a decent amount of investigation, and comparing runs of our title on Win32 and Vita, it turns out that usage of the ICE_NEW and ICE_NEW_MEM macros, compile to need 1 more DWORD on Vita when using new (the C++ new array constructor). For example:

OPC_OptimizedTree.cpp (631)
mNodes = ICE_NEW_MEM(AABBStacklessQuantizedNoLeafNode[mNbNodes],AABBCollisionNode);
Sample Object: sizeof(AABBStacklessQuantizedNoLeafTree) is 0x14, mNbNodes is 3, so total is 0x3C
Win32 malloc call: 0x40
NGP malloc call: 0x44

OPC_HybridModel.cpp (448)
mTriangles = ICE_NEW(LeafTriangles)[mNbLeaves];
Sample Object: sizeof(LeafTriangles) is 0x4, mNbLeaves is 4, so total is 0x10
Win32 malloc call: 0x14
NGP malloc call: 0x18

I was wondering if anyone has had experience running into this problem, and knows how to cook the PhysX data taking the target platform’s larger size needs into account.

Ouch. It sounds like you would need the source code for PhysX-2.8.4 for VITA. The Quickload extension was never ported/tested on VITA.