bt -> b3 rename

add docs
This commit is contained in:
erwin coumans
2013-04-15 18:26:09 -07:00
parent 76e74523f6
commit faabffc23d
88 changed files with 720 additions and 6695 deletions

View File

@@ -1,9 +1,9 @@
#include "btGpuSapBroadphase.h"
#include "b3GpuSapBroadphase.h"
#include "BulletCommon/btVector3.h"
#include "parallel_primitives/host/btLauncherCL.h"
#include "BulletCommon/btQuickprof.h"
#include "basic_initialize/btOpenCLUtils.h"
#include "basic_initialize/b3OpenCLUtils.h"
#include "../kernels/sapKernels.h"
@@ -11,7 +11,7 @@
#include "BulletCommon/btMinMax.h"
btGpuSapBroadphase::btGpuSapBroadphase(cl_context ctx,cl_device_id device, cl_command_queue q )
b3GpuSapBroadphase::b3GpuSapBroadphase(cl_context ctx,cl_device_id device, cl_command_queue q )
:m_context(ctx),
m_device(device),
m_queue(q),
@@ -28,44 +28,44 @@ m_currentBuffer(-1)
cl_int errNum=0;
cl_program sapProg = btOpenCLUtils::compileCLProgramFromString(m_context,m_device,sapSrc,&errNum,"","opencl/gpu_broadphase/kernels/sap.cl");
cl_program sapProg = b3OpenCLUtils::compileCLProgramFromString(m_context,m_device,sapSrc,&errNum,"","opencl/gpu_broadphase/kernels/sap.cl");
btAssert(errNum==CL_SUCCESS);
cl_program sapFastProg = btOpenCLUtils::compileCLProgramFromString(m_context,m_device,sapFastSrc,&errNum,"","opencl/gpu_broadphase/kernels/sapFast.cl");
cl_program sapFastProg = b3OpenCLUtils::compileCLProgramFromString(m_context,m_device,sapFastSrc,&errNum,"","opencl/gpu_broadphase/kernels/sapFast.cl");
btAssert(errNum==CL_SUCCESS);
//m_sapKernel = btOpenCLUtils::compileCLKernelFromString(m_context, m_device,sapSrc, "computePairsKernelOriginal",&errNum,sapProg );
//m_sapKernel = btOpenCLUtils::compileCLKernelFromString(m_context, m_device,sapSrc, "computePairsKernelBarrier",&errNum,sapProg );
//m_sapKernel = btOpenCLUtils::compileCLKernelFromString(m_context, m_device,sapSrc, "computePairsKernelLocalSharedMemory",&errNum,sapProg );
//m_sapKernel = b3OpenCLUtils::compileCLKernelFromString(m_context, m_device,sapSrc, "computePairsKernelOriginal",&errNum,sapProg );
//m_sapKernel = b3OpenCLUtils::compileCLKernelFromString(m_context, m_device,sapSrc, "computePairsKernelBarrier",&errNum,sapProg );
//m_sapKernel = b3OpenCLUtils::compileCLKernelFromString(m_context, m_device,sapSrc, "computePairsKernelLocalSharedMemory",&errNum,sapProg );
m_sap2Kernel = btOpenCLUtils::compileCLKernelFromString(m_context, m_device,sapSrc, "computePairsKernelTwoArrays",&errNum,sapProg );
m_sap2Kernel = b3OpenCLUtils::compileCLKernelFromString(m_context, m_device,sapSrc, "computePairsKernelTwoArrays",&errNum,sapProg );
btAssert(errNum==CL_SUCCESS);
#if 0
m_sapKernel = btOpenCLUtils::compileCLKernelFromString(m_context, m_device,sapSrc, "computePairsKernelOriginal",&errNum,sapProg );
m_sapKernel = b3OpenCLUtils::compileCLKernelFromString(m_context, m_device,sapSrc, "computePairsKernelOriginal",&errNum,sapProg );
btAssert(errNum==CL_SUCCESS);
#else
#ifndef __APPLE__
m_sapKernel = btOpenCLUtils::compileCLKernelFromString(m_context, m_device,sapFastSrc, "computePairsKernel",&errNum,sapFastProg );
m_sapKernel = b3OpenCLUtils::compileCLKernelFromString(m_context, m_device,sapFastSrc, "computePairsKernel",&errNum,sapFastProg );
btAssert(errNum==CL_SUCCESS);
#else
m_sapKernel = btOpenCLUtils::compileCLKernelFromString(m_context, m_device,sapSrc, "computePairsKernelLocalSharedMemory",&errNum,sapProg );
m_sapKernel = b3OpenCLUtils::compileCLKernelFromString(m_context, m_device,sapSrc, "computePairsKernelLocalSharedMemory",&errNum,sapProg );
btAssert(errNum==CL_SUCCESS);
#endif
#endif
m_flipFloatKernel = btOpenCLUtils::compileCLKernelFromString(m_context, m_device,sapSrc, "flipFloatKernel",&errNum,sapProg );
m_flipFloatKernel = b3OpenCLUtils::compileCLKernelFromString(m_context, m_device,sapSrc, "flipFloatKernel",&errNum,sapProg );
m_copyAabbsKernel= btOpenCLUtils::compileCLKernelFromString(m_context, m_device,sapSrc, "copyAabbsKernel",&errNum,sapProg );
m_copyAabbsKernel= b3OpenCLUtils::compileCLKernelFromString(m_context, m_device,sapSrc, "copyAabbsKernel",&errNum,sapProg );
m_scatterKernel = btOpenCLUtils::compileCLKernelFromString(m_context, m_device,sapSrc, "scatterKernel",&errNum,sapProg );
m_scatterKernel = b3OpenCLUtils::compileCLKernelFromString(m_context, m_device,sapSrc, "scatterKernel",&errNum,sapProg );
m_sorter = new btRadixSort32CL(m_context,m_device,m_queue);
}
btGpuSapBroadphase::~btGpuSapBroadphase()
b3GpuSapBroadphase::~b3GpuSapBroadphase()
{
delete m_sorter;
clReleaseKernel(m_scatterKernel);
@@ -97,7 +97,7 @@ static unsigned int FloatFlip(float fl)
return f ^ mask;
};
void btGpuSapBroadphase::init3dSap()
void b3GpuSapBroadphase::init3dSap()
{
if (m_currentBuffer<0)
{
@@ -123,7 +123,7 @@ void btGpuSapBroadphase::init3dSap()
}
}
}
void btGpuSapBroadphase::calculateOverlappingPairsHostIncremental3Sap()
void b3GpuSapBroadphase::calculateOverlappingPairsHostIncremental3Sap()
{
btAssert(m_currentBuffer>=0);
if (m_currentBuffer<0)
@@ -155,7 +155,7 @@ void btGpuSapBroadphase::calculateOverlappingPairsHostIncremental3Sap()
}
void btGpuSapBroadphase::calculateOverlappingPairsHost()
void b3GpuSapBroadphase::calculateOverlappingPairsHost()
{
//test
//if (m_currentBuffer>=0)
@@ -249,7 +249,7 @@ void btGpuSapBroadphase::calculateOverlappingPairsHost()
}
void btGpuSapBroadphase::calculateOverlappingPairs()
void b3GpuSapBroadphase::calculateOverlappingPairs()
{
int axis = 0;//todo on GPU for now hardcode
@@ -512,7 +512,7 @@ void btGpuSapBroadphase::calculateOverlappingPairs()
}
void btGpuSapBroadphase::writeAabbsToGpu()
void b3GpuSapBroadphase::writeAabbsToGpu()
{
m_allAabbsGPU.copyFromHost(m_allAabbsCPU);//might not be necessary, the 'setupGpuAabbsFull' already takes care of this
m_smallAabbsGPU.copyFromHost(m_smallAabbsCPU);
@@ -520,10 +520,10 @@ void btGpuSapBroadphase::writeAabbsToGpu()
}
void btGpuSapBroadphase::createLargeProxy(const btVector3& aabbMin, const btVector3& aabbMax, int userPtr ,short int collisionFilterGroup,short int collisionFilterMask)
void b3GpuSapBroadphase::createLargeProxy(const btVector3& aabbMin, const btVector3& aabbMax, int userPtr ,short int collisionFilterGroup,short int collisionFilterMask)
{
int index = userPtr;
btSapAabb aabb;
b3SapAabb aabb;
for (int i=0;i<4;i++)
{
aabb.m_min[i] = aabbMin[i];
@@ -535,10 +535,10 @@ void btGpuSapBroadphase::createLargeProxy(const btVector3& aabbMin, const btVec
m_allAabbsCPU.push_back(aabb);
}
void btGpuSapBroadphase::createProxy(const btVector3& aabbMin, const btVector3& aabbMax, int userPtr ,short int collisionFilterGroup,short int collisionFilterMask)
void b3GpuSapBroadphase::createProxy(const btVector3& aabbMin, const btVector3& aabbMax, int userPtr ,short int collisionFilterGroup,short int collisionFilterMask)
{
int index = userPtr;
btSapAabb aabb;
b3SapAabb aabb;
for (int i=0;i<4;i++)
{
aabb.m_min[i] = aabbMin[i];
@@ -550,16 +550,16 @@ void btGpuSapBroadphase::createProxy(const btVector3& aabbMin, const btVector3&
m_allAabbsCPU.push_back(aabb);
}
cl_mem btGpuSapBroadphase::getAabbBufferWS()
cl_mem b3GpuSapBroadphase::getAabbBufferWS()
{
return m_allAabbsGPU.getBufferCL();
}
int btGpuSapBroadphase::getNumOverlap()
int b3GpuSapBroadphase::getNumOverlap()
{
return m_overlappingPairs.size();
}
cl_mem btGpuSapBroadphase::getOverlappingPairBuffer()
cl_mem b3GpuSapBroadphase::getOverlappingPairBuffer()
{
return m_overlappingPairs.getBufferCL();
}

View File

@@ -6,11 +6,11 @@
class btVector3;
#include "parallel_primitives/host/btRadixSort32CL.h"
#include "btSapAabb.h"
#include "b3SapAabb.h"
class btGpuSapBroadphase
class b3GpuSapBroadphase
{
cl_context m_context;
@@ -30,24 +30,24 @@ class btGpuSapBroadphase
public:
btOpenCLArray<btSapAabb> m_allAabbsGPU;
btAlignedObjectArray<btSapAabb> m_allAabbsCPU;
btOpenCLArray<b3SapAabb> m_allAabbsGPU;
btAlignedObjectArray<b3SapAabb> m_allAabbsCPU;
btOpenCLArray<btSapAabb> m_smallAabbsGPU;
btAlignedObjectArray<btSapAabb> m_smallAabbsCPU;
btOpenCLArray<b3SapAabb> m_smallAabbsGPU;
btAlignedObjectArray<b3SapAabb> m_smallAabbsCPU;
btOpenCLArray<btSapAabb> m_largeAabbsGPU;
btAlignedObjectArray<btSapAabb> m_largeAabbsCPU;
btOpenCLArray<b3SapAabb> m_largeAabbsGPU;
btAlignedObjectArray<b3SapAabb> m_largeAabbsCPU;
btOpenCLArray<btInt2> m_overlappingPairs;
//temporary gpu work memory
btOpenCLArray<btSortData> m_gpuSmallSortData;
btOpenCLArray<btSapAabb> m_gpuSmallSortedAabbs;
btOpenCLArray<b3SapAabb> m_gpuSmallSortedAabbs;
btGpuSapBroadphase(cl_context ctx,cl_device_id device, cl_command_queue q );
virtual ~btGpuSapBroadphase();
b3GpuSapBroadphase(cl_context ctx,cl_device_id device, cl_command_queue q );
virtual ~b3GpuSapBroadphase();
void calculateOverlappingPairs();
void calculateOverlappingPairsHost();

View File

@@ -1,7 +1,7 @@
#ifndef BT_SAP_AABB_H
#define BT_SAP_AABB_H
struct btSapAabb
struct b3SapAabb
{
union
{

View File

@@ -14,8 +14,8 @@ subject to the following restrictions:
#include <stdio.h>
#include "../basic_initialize/btOpenCLUtils.h"
#include "../host/btGpuSapBroadphase.h"
#include "../basic_initialize/b3OpenCLUtils.h"
#include "../host/b3GpuSapBroadphase.h"
#include "BulletCommon/btVector3.h"
#include "parallel_primitives/host/btFillCL.h"
#include "parallel_primitives/host/btBoundSearchCL.h"
@@ -47,17 +47,17 @@ void initCL(int preferredDeviceIndex, int preferredPlatformIndex)
cl_device_type deviceType = CL_DEVICE_TYPE_ALL;
g_context = btOpenCLUtils::createContextFromType(deviceType, &ciErrNum, 0,0,preferredDeviceIndex, preferredPlatformIndex);
g_context = b3OpenCLUtils::createContextFromType(deviceType, &ciErrNum, 0,0,preferredDeviceIndex, preferredPlatformIndex);
oclCHECKERROR(ciErrNum, CL_SUCCESS);
int numDev = btOpenCLUtils::getNumDevices(g_context);
int numDev = b3OpenCLUtils::getNumDevices(g_context);
if (numDev>0)
{
btOpenCLDeviceInfo info;
g_device= btOpenCLUtils::getDevice(g_context,0);
g_device= b3OpenCLUtils::getDevice(g_context,0);
g_queue = clCreateCommandQueue(g_context, g_device, 0, &ciErrNum);
oclCHECKERROR(ciErrNum, CL_SUCCESS);
btOpenCLUtils::printDeviceInfo(g_device);
btOpenCLUtils::getDeviceInfo(g_device,&info);
b3OpenCLUtils::printDeviceInfo(g_device);
b3OpenCLUtils::getDeviceInfo(g_device,&info);
g_deviceName = info.m_deviceName;
}
}
@@ -73,7 +73,7 @@ inline void broadphaseTest()
{
TEST_INIT;
btGpuSapBroadphase* sap = new btGpuSapBroadphase(g_context,g_device,g_queue);
b3GpuSapBroadphase* sap = new b3GpuSapBroadphase(g_context,g_device,g_queue);
int group=1;
int mask=1;
btVector3 aabbMin(0,0,0);

View File

@@ -16,11 +16,11 @@ function createProject(vendor)
files {
"main.cpp",
"../../basic_initialize/btOpenCLInclude.h",
"../../basic_initialize/btOpenCLUtils.cpp",
"../../basic_initialize/btOpenCLUtils.h",
"../host/btGpuSapBroadphase.cpp",
"../host/btGpuSapBroadphase.h",
"../../basic_initialize/b3OpenCLInclude.h",
"../../basic_initialize/b3OpenCLUtils.cpp",
"../../basic_initialize/b3OpenCLUtils.h",
"../host/b3GpuSapBroadphase.cpp",
"../host/b3GpuSapBroadphase.h",
"../../parallel_primitives/host/btFillCL.cpp",
"../../parallel_primitives/host/btFillCL.h",
"../../parallel_primitives/host/btBoundSearchCL.cpp",