diff --git a/Demos/DX11ClothDemo/CMakeLists.txt b/Demos/DX11ClothDemo/CMakeLists.txt index e591c21a2..7485e959a 100644 --- a/Demos/DX11ClothDemo/CMakeLists.txt +++ b/Demos/DX11ClothDemo/CMakeLists.txt @@ -63,7 +63,11 @@ ENDIF(COMMAND cmake_policy) SET(DXSDK_DIR $ENV{DXSDK_DIR}) SET(DX11_INCLUDE_PATH "${DXSDK_DIR}Include" CACHE DOCSTRING "Microsoft directX SDK include path") -SET(DX11_LIB_PATH "${DXSDK_DIR}Lib/x86" CACHE DOCSTRING "Microsoft DirectX SDK library path") +IF (CMAKE_CL_64) + SET(DX11_LIB_PATH "${DXSDK_DIR}Lib/x64" CACHE DOCSTRING "Microsoft DirectX SDK library path") +ELSE() + SET(DX11_LIB_PATH "${DXSDK_DIR}Lib/x86" CACHE DOCSTRING "Microsoft DirectX SDK library path") +ENDIF() SET(BulletClothExample_SRCS DXUT/Core/DXUT.cpp diff --git a/Extras/Serialize/BulletFileLoader/btBulletFile.cpp b/Extras/Serialize/BulletFileLoader/btBulletFile.cpp index 154dc983c..0307b3163 100644 --- a/Extras/Serialize/BulletFileLoader/btBulletFile.cpp +++ b/Extras/Serialize/BulletFileLoader/btBulletFile.cpp @@ -46,7 +46,8 @@ using namespace bParse; btBulletFile::btBulletFile() :bFile("", "BULLET ") { - mMemoryDNA = new bDNA(); + mMemoryDNA = new bDNA(); //this memory gets released in the bFile::~bFile destructor,@todo not consistent with the rule 'who allocates it, has to deallocate it" + m_DnaCopy = 0; @@ -97,6 +98,15 @@ btBulletFile::~btBulletFile() { if (m_DnaCopy) btAlignedFree(m_DnaCopy); + + + while (m_dataBlocks.size()) + { + char* dataBlock = m_dataBlocks[m_dataBlocks.size()-1]; + delete[] dataBlock; + m_dataBlocks.pop_back(); + } + } @@ -211,7 +221,8 @@ void btBulletFile::parseData() void btBulletFile::addDataBlock(char* dataBlock) { - //mMain->addDatablock(dataBlock); + m_dataBlocks.push_back(dataBlock); + } diff --git a/Extras/Serialize/BulletFileLoader/btBulletFile.h b/Extras/Serialize/BulletFileLoader/btBulletFile.h index eda4134ce..2575cdb4e 100644 --- a/Extras/Serialize/BulletFileLoader/btBulletFile.h +++ b/Extras/Serialize/BulletFileLoader/btBulletFile.h @@ -50,6 +50,7 @@ namespace bParse { btAlignedObjectArray m_triangleInfoMaps; + btAlignedObjectArray m_dataBlocks; btBulletFile(); btBulletFile(const char* fileName); diff --git a/Extras/Serialize/BulletWorldImporter/btBulletWorldImporter.h b/Extras/Serialize/BulletWorldImporter/btBulletWorldImporter.h index 0d0579fcf..ff043a7c4 100644 --- a/Extras/Serialize/BulletWorldImporter/btBulletWorldImporter.h +++ b/Extras/Serialize/BulletWorldImporter/btBulletWorldImporter.h @@ -96,7 +96,7 @@ public: ///delete all memory collision shapes, rigid bodies, constraints etc. allocated during the load. ///make sure you don't use the dynamics world containing objects after you call this method - void deleteAllData(); + virtual void deleteAllData(); bool loadFile(const char* fileName); diff --git a/src/BulletMultiThreaded/btParallelConstraintSolver.cpp b/src/BulletMultiThreaded/btParallelConstraintSolver.cpp index 1aae42f43..8423f554d 100644 --- a/src/BulletMultiThreaded/btParallelConstraintSolver.cpp +++ b/src/BulletMultiThreaded/btParallelConstraintSolver.cpp @@ -745,9 +745,14 @@ void CustomSolveConstraintsParallel( uint32_t tmpBytes = poolBytes - 2 * (sizeof(PfxParallelGroup) + sizeof(PfxParallelBatch)*(PFX_MAX_SOLVER_PHASES*PFX_MAX_SOLVER_BATCHES) + 128); void *tmpBuff = pool.allocate(tmpBytes); - CustomSplitConstraints(contactPairs,numContactPairs,*cgroup,cbatches,maxTasks,numRigidBodies,tmpBuff,tmpBytes); - CustomSplitConstraints(jointPairs,numJointPairs,*jgroup,jbatches,maxTasks,numRigidBodies,tmpBuff,tmpBytes); + { + BT_PROFILE("CustomSplitConstraints"); + CustomSplitConstraints(contactPairs,numContactPairs,*cgroup,cbatches,maxTasks,numRigidBodies,tmpBuff,tmpBytes); + CustomSplitConstraints(jointPairs,numJointPairs,*jgroup,jbatches,maxTasks,numRigidBodies,tmpBuff,tmpBytes); + } + { + BT_PROFILE("PFX_CONSTRAINT_SOLVER_CMD_SOLVE_CONSTRAINTS"); //#define SOLVE_SEQUENTIAL #ifdef SOLVE_SEQUENTIAL CustomSolveConstraintsTask( @@ -802,10 +807,12 @@ void CustomSolveConstraintsParallel( threadSupport->waitForResponse(&arg0,&arg1); } #endif + } pool.clear(); } { + BT_PROFILE("PFX_CONSTRAINT_SOLVER_CMD_POST_SOLVER"); int batch = ((int)numRigidBodies + maxTasks - 1) / maxTasks; int rest = (int)numRigidBodies; int start = 0; @@ -954,6 +961,7 @@ struct btParallelSolverMemoryCache }; + btConstraintSolverIO* createSolverIO(int numThreads) { return new btConstraintSolverIO[numThreads]; @@ -974,6 +982,7 @@ btParallelConstraintSolver::btParallelConstraintSolver(btThreadSupportInterface* btParallelConstraintSolver::~btParallelConstraintSolver() { delete m_memoryCache; + delete m_solverIO; }