From ec734ada879b6e973795f7b133374c4d2c6cfec3 Mon Sep 17 00:00:00 2001 From: "erwin.coumans" Date: Tue, 10 Apr 2012 23:36:07 +0000 Subject: [PATCH] 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) --- .../gpu_rigidbody_pipeline2/CLPhysicsDemo.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Extras/RigidBodyGpuPipeline/opencl/gpu_rigidbody_pipeline2/CLPhysicsDemo.cpp b/Extras/RigidBodyGpuPipeline/opencl/gpu_rigidbody_pipeline2/CLPhysicsDemo.cpp index 363f57525..8347423a8 100644 --- a/Extras/RigidBodyGpuPipeline/opencl/gpu_rigidbody_pipeline2/CLPhysicsDemo.cpp +++ b/Extras/RigidBodyGpuPipeline/opencl/gpu_rigidbody_pipeline2/CLPhysicsDemo.cpp @@ -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;i0) { 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(g_deviceCL,MAX_CONVEX_BODIES_CL); m_data->m_angVelBuf = new adl::Buffer(g_deviceCL,MAX_CONVEX_BODIES_CL); m_data->m_bodyTimes = new adl::Buffer(g_deviceCL,MAX_CONVEX_BODIES_CL); - + m_data->m_localShapeAABB = new adl::Buffer(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() } -} +} \ No newline at end of file