OpenCL GPU rigid body pipeline2: initialize the host/gpu velocities so that the demo also works with NVIDIA GPUs
(apparently AMD Radeon initializes the memory with zero, hiding this bug)
This commit is contained in:
@@ -98,6 +98,12 @@ struct InternalData
|
||||
m_linVelHost= new btVector3[MAX_CONVEX_BODIES_CL];
|
||||
m_angVelHost = new btVector3[MAX_CONVEX_BODIES_CL];
|
||||
m_bodyTimesHost = new float[MAX_CONVEX_BODIES_CL];
|
||||
for (int i=0;i<MAX_CONVEX_BODIES_CL;i++)
|
||||
{
|
||||
m_linVelHost[i].setZero();
|
||||
m_angVelHost[i].setZero();
|
||||
m_bodyTimesHost[i] = 0.f;
|
||||
}
|
||||
}
|
||||
~InternalData()
|
||||
{
|
||||
@@ -146,8 +152,6 @@ void InitCL(int preferredDeviceIndex, int preferredPlatformIndex, bool useIntero
|
||||
if (numDev>0)
|
||||
{
|
||||
g_device= btOpenCLUtils::getDevice(g_cxMainContext,0);
|
||||
btOpenCLDeviceInfo clInfo;
|
||||
btOpenCLUtils::getDeviceInfo(g_device,clInfo);
|
||||
btOpenCLUtils::printDeviceInfo(g_device);
|
||||
g_cqCommandQue = clCreateCommandQueue(g_cxMainContext, g_device, 0, &ciErrNum);
|
||||
oclCHECKERROR(ciErrNum, CL_SUCCESS);
|
||||
@@ -282,14 +286,14 @@ void CLPhysicsDemo::init(int preferredDevice, int preferredPlatform, bool useInt
|
||||
m_data->m_linVelBuf = new adl::Buffer<btVector3>(g_deviceCL,MAX_CONVEX_BODIES_CL);
|
||||
m_data->m_angVelBuf = new adl::Buffer<btVector3>(g_deviceCL,MAX_CONVEX_BODIES_CL);
|
||||
m_data->m_bodyTimes = new adl::Buffer<float>(g_deviceCL,MAX_CONVEX_BODIES_CL);
|
||||
|
||||
|
||||
m_data->m_localShapeAABB = new adl::Buffer<btAABBHost>(g_deviceCL,MAX_CONVEX_SHAPES_CL);
|
||||
|
||||
gLinVelMem = (cl_mem)m_data->m_linVelBuf->m_ptr;
|
||||
gAngVelMem = (cl_mem)m_data->m_angVelBuf->m_ptr;
|
||||
gBodyTimes = (cl_mem)m_data->m_bodyTimes->m_ptr;
|
||||
|
||||
|
||||
writeVelocitiesToGpu();
|
||||
|
||||
|
||||
narrowphaseAndSolver = new btGpuNarrowphaseAndSolver(g_deviceCL);
|
||||
@@ -526,4 +530,4 @@ void CLPhysicsDemo::stepSimulation()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user