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:
@@ -63,7 +63,11 @@ ENDIF(COMMAND cmake_policy)
|
|||||||
|
|
||||||
SET(DXSDK_DIR $ENV{DXSDK_DIR})
|
SET(DXSDK_DIR $ENV{DXSDK_DIR})
|
||||||
SET(DX11_INCLUDE_PATH "${DXSDK_DIR}Include" CACHE DOCSTRING "Microsoft directX SDK include path")
|
SET(DX11_INCLUDE_PATH "${DXSDK_DIR}Include" CACHE DOCSTRING "Microsoft directX SDK include 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")
|
SET(DX11_LIB_PATH "${DXSDK_DIR}Lib/x86" CACHE DOCSTRING "Microsoft DirectX SDK library path")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
SET(BulletClothExample_SRCS
|
SET(BulletClothExample_SRCS
|
||||||
DXUT/Core/DXUT.cpp
|
DXUT/Core/DXUT.cpp
|
||||||
|
|||||||
@@ -46,7 +46,8 @@ using namespace bParse;
|
|||||||
btBulletFile::btBulletFile()
|
btBulletFile::btBulletFile()
|
||||||
:bFile("", "BULLET ")
|
: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;
|
m_DnaCopy = 0;
|
||||||
|
|
||||||
|
|
||||||
@@ -97,6 +98,15 @@ btBulletFile::~btBulletFile()
|
|||||||
{
|
{
|
||||||
if (m_DnaCopy)
|
if (m_DnaCopy)
|
||||||
btAlignedFree(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)
|
void btBulletFile::addDataBlock(char* dataBlock)
|
||||||
{
|
{
|
||||||
//mMain->addDatablock(dataBlock);
|
m_dataBlocks.push_back(dataBlock);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ namespace bParse {
|
|||||||
|
|
||||||
btAlignedObjectArray<bStructHandle*> m_triangleInfoMaps;
|
btAlignedObjectArray<bStructHandle*> m_triangleInfoMaps;
|
||||||
|
|
||||||
|
btAlignedObjectArray<char*> m_dataBlocks;
|
||||||
btBulletFile();
|
btBulletFile();
|
||||||
|
|
||||||
btBulletFile(const char* fileName);
|
btBulletFile(const char* fileName);
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ public:
|
|||||||
|
|
||||||
///delete all memory collision shapes, rigid bodies, constraints etc. allocated during the load.
|
///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
|
///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);
|
bool loadFile(const char* fileName);
|
||||||
|
|
||||||
|
|||||||
@@ -745,9 +745,14 @@ void CustomSolveConstraintsParallel(
|
|||||||
uint32_t tmpBytes = poolBytes - 2 * (sizeof(PfxParallelGroup) + sizeof(PfxParallelBatch)*(PFX_MAX_SOLVER_PHASES*PFX_MAX_SOLVER_BATCHES) + 128);
|
uint32_t tmpBytes = poolBytes - 2 * (sizeof(PfxParallelGroup) + sizeof(PfxParallelBatch)*(PFX_MAX_SOLVER_PHASES*PFX_MAX_SOLVER_BATCHES) + 128);
|
||||||
void *tmpBuff = pool.allocate(tmpBytes);
|
void *tmpBuff = pool.allocate(tmpBytes);
|
||||||
|
|
||||||
|
{
|
||||||
|
BT_PROFILE("CustomSplitConstraints");
|
||||||
CustomSplitConstraints(contactPairs,numContactPairs,*cgroup,cbatches,maxTasks,numRigidBodies,tmpBuff,tmpBytes);
|
CustomSplitConstraints(contactPairs,numContactPairs,*cgroup,cbatches,maxTasks,numRigidBodies,tmpBuff,tmpBytes);
|
||||||
CustomSplitConstraints(jointPairs,numJointPairs,*jgroup,jbatches,maxTasks,numRigidBodies,tmpBuff,tmpBytes);
|
CustomSplitConstraints(jointPairs,numJointPairs,*jgroup,jbatches,maxTasks,numRigidBodies,tmpBuff,tmpBytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
BT_PROFILE("PFX_CONSTRAINT_SOLVER_CMD_SOLVE_CONSTRAINTS");
|
||||||
//#define SOLVE_SEQUENTIAL
|
//#define SOLVE_SEQUENTIAL
|
||||||
#ifdef SOLVE_SEQUENTIAL
|
#ifdef SOLVE_SEQUENTIAL
|
||||||
CustomSolveConstraintsTask(
|
CustomSolveConstraintsTask(
|
||||||
@@ -802,10 +807,12 @@ void CustomSolveConstraintsParallel(
|
|||||||
threadSupport->waitForResponse(&arg0,&arg1);
|
threadSupport->waitForResponse(&arg0,&arg1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
pool.clear();
|
pool.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
BT_PROFILE("PFX_CONSTRAINT_SOLVER_CMD_POST_SOLVER");
|
||||||
int batch = ((int)numRigidBodies + maxTasks - 1) / maxTasks;
|
int batch = ((int)numRigidBodies + maxTasks - 1) / maxTasks;
|
||||||
int rest = (int)numRigidBodies;
|
int rest = (int)numRigidBodies;
|
||||||
int start = 0;
|
int start = 0;
|
||||||
@@ -954,6 +961,7 @@ struct btParallelSolverMemoryCache
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
btConstraintSolverIO* createSolverIO(int numThreads)
|
btConstraintSolverIO* createSolverIO(int numThreads)
|
||||||
{
|
{
|
||||||
return new btConstraintSolverIO[numThreads];
|
return new btConstraintSolverIO[numThreads];
|
||||||
@@ -974,6 +982,7 @@ btParallelConstraintSolver::btParallelConstraintSolver(btThreadSupportInterface*
|
|||||||
btParallelConstraintSolver::~btParallelConstraintSolver()
|
btParallelConstraintSolver::~btParallelConstraintSolver()
|
||||||
{
|
{
|
||||||
delete m_memoryCache;
|
delete m_memoryCache;
|
||||||
|
delete m_solverIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user