Allow to link the DX11ClothDemo against the 64bit DirectX SDK for x64 builds

Fix memory leaks in btBulletFile and btParallelConstraintSolver (and added some additional profile timers)
This commit is contained in:
erwin.coumans
2010-08-19 20:03:23 +00:00
parent f89ddcc86e
commit 32433aa8b3
5 changed files with 31 additions and 6 deletions

View File

@@ -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

View File

@@ -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);
}

View File

@@ -50,6 +50,7 @@ namespace bParse {
btAlignedObjectArray<bStructHandle*> m_triangleInfoMaps;
btAlignedObjectArray<char*> m_dataBlocks;
btBulletFile();
btBulletFile(const char* fileName);

View File

@@ -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);

View File

@@ -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);
{
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;
}