further work towards sharing structures/code between C++ and OpenCL

(could break the build in C++/OpenCL)
This commit is contained in:
erwincoumans
2013-08-03 10:13:13 -07:00
parent 906415429c
commit 18eed5b067
8 changed files with 1031 additions and 831 deletions

View File

@@ -1,6 +1,47 @@
//this file is autogenerated using stringify.bat (premake --stringify) in the build folder of this project
static const char* primitiveContactsKernelsCL= \
"#define TRIANGLE_NUM_CONVEX_FACES 5\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"struct MyTest\n"
"{\n"
" int bla;\n"
"};\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
" typedef float4 b3Float4;\n"
"\n"
"\n"
"\n"
"\n"
"typedef struct\n"
"{\n"
" b3Float4 m_worldPos[4];\n"
" b3Float4 m_worldNormal; // w: m_nPoints\n"
" unsigned int m_coeffs;\n"
" unsigned int m_batchIdx;\n"
"\n"
" int m_bodyAPtrAndSignBit;//x:m_bodyAPtr, y:m_bodyBPtr\n"
" int m_bodyBPtrAndSignBit;\n"
"\n"
" int m_childIndexA;\n"
" int m_childIndexB;\n"
" int m_unused1;\n"
" int m_unused2;\n"
"\n"
"} b3Contact4Data;\n"
"\n"
"\n"
"\n"
"#define SHAPE_CONVEX_HULL 3\n"
"#define SHAPE_PLANE 4\n"
@@ -42,22 +83,6 @@ static const char* primitiveContactsKernelsCL= \
"\n"
"\n"
"\n"
"typedef struct\n"
"{\n"
" float4 m_worldPos[4];\n"
" float4 m_worldNormal; // w: m_nPoints\n"
" u32 m_coeffs;\n"
" u32 m_batchIdx;\n"
"\n"
" int m_bodyAPtrAndSignBit;//x:m_bodyAPtr, y:m_bodyBPtr\n"
" int m_bodyBPtrAndSignBit;\n"
"\n"
" int m_childIndexA;\n"
" int m_childIndexB;\n"
" int m_unused1;\n"
" int m_unused2;\n"
"\n"
"} Contact4;\n"
"\n"
"typedef struct \n"
"{\n"
@@ -363,7 +388,7 @@ static const char* primitiveContactsKernelsCL= \
" __global const float4* convexVertices,\n"
" __global const int* convexIndices,\n"
" __global const btGpuFace* faces,\n"
" __global Contact4* restrict globalContactsOut,\n"
" __global b3Contact4Data* restrict globalContactsOut,\n"
" counter32_t nGlobalContactsOut,\n"
" int maxContactCapacity,\n"
" float4 spherePos2,\n"
@@ -484,7 +509,7 @@ static const char* primitiveContactsKernelsCL= \
" \n"
" if (1)//dstIdx < maxContactCapacity)\n"
" {\n"
" __global Contact4* c = &globalContactsOut[dstIdx];\n"
" __global b3Contact4Data* c = &globalContactsOut[dstIdx];\n"
" c->m_worldNormal = normalOnSurfaceB1;\n"
" c->m_coeffs = (u32)(0.f*0xffff) | ((u32)(0.7f*0xffff)<<16);\n"
" c->m_batchIdx = pairIndex;\n"
@@ -608,7 +633,7 @@ static const char* primitiveContactsKernelsCL= \
" __global const float4* convexVertices,\n"
" __global const int* convexIndices,\n"
" __global const btGpuFace* faces,\n"
" __global Contact4* restrict globalContactsOut,\n"
" __global b3Contact4Data* restrict globalContactsOut,\n"
" counter32_t nGlobalContactsOut,\n"
" int maxContactCapacity,\n"
" float4 posB,\n"
@@ -710,7 +735,7 @@ static const char* primitiveContactsKernelsCL= \
" if (dstIdx < maxContactCapacity)\n"
" {\n"
" resultIndex = dstIdx;\n"
" __global Contact4* c = &globalContactsOut[dstIdx];\n"
" __global b3Contact4Data* c = &globalContactsOut[dstIdx];\n"
" c->m_worldNormal = planeNormalWorld;\n"
" //c->setFrictionCoeff(0.7);\n"
" //c->setRestituitionCoeff(0.f);\n"
@@ -750,7 +775,7 @@ static const char* primitiveContactsKernelsCL= \
" __global const BodyData* rigidBodies, \n"
" __global const btCollidableGpu* collidables,\n"
" __global const btGpuFace* faces,\n"
" __global Contact4* restrict globalContactsOut,\n"
" __global b3Contact4Data* restrict globalContactsOut,\n"
" counter32_t nGlobalContactsOut,\n"
" int maxContactCapacity)\n"
"{\n"
@@ -793,7 +818,7 @@ static const char* primitiveContactsKernelsCL= \
" \n"
" if (dstIdx < maxContactCapacity)\n"
" {\n"
" __global Contact4* c = &globalContactsOut[dstIdx];\n"
" __global b3Contact4Data* c = &globalContactsOut[dstIdx];\n"
" c->m_worldNormal = normalOnSurfaceB1;\n"
" c->m_coeffs = (u32)(0.f*0xffff) | ((u32)(0.7f*0xffff)<<16);\n"
" c->m_batchIdx = pairIndex;\n"
@@ -816,7 +841,7 @@ static const char* primitiveContactsKernelsCL= \
" __global const float4* uniqueEdges,\n"
" __global const btGpuFace* faces,\n"
" __global const int* indices,\n"
" __global Contact4* restrict globalContactsOut,\n"
" __global b3Contact4Data* restrict globalContactsOut,\n"
" counter32_t nGlobalContactsOut,\n"
" int numPairs, int maxContactCapacity)\n"
"{\n"
@@ -971,7 +996,7 @@ static const char* primitiveContactsKernelsCL= \
" \n"
" if (dstIdx < maxContactCapacity)\n"
" {\n"
" __global Contact4* c = &globalContactsOut[dstIdx];\n"
" __global b3Contact4Data* c = &globalContactsOut[dstIdx];\n"
" c->m_worldNormal = -normalOnSurfaceB;\n"
" c->m_coeffs = (u32)(0.f*0xffff) | ((u32)(0.7f*0xffff)<<16);\n"
" c->m_batchIdx = pairIndex;\n"
@@ -1005,7 +1030,7 @@ static const char* primitiveContactsKernelsCL= \
" __global const int* indices,\n"
" __global btAabbCL* aabbs,\n"
" __global const btGpuChildShape* gpuChildShapes,\n"
" __global Contact4* restrict globalContactsOut,\n"
" __global b3Contact4Data* restrict globalContactsOut,\n"
" counter32_t nGlobalContactsOut,\n"
" int numCompoundPairs, int maxContactCapacity\n"
" )\n"
@@ -1184,7 +1209,7 @@ static const char* primitiveContactsKernelsCL= \
" __global const BodyData* rigidBodies, \n"
" __global const btCollidableGpu* collidables,\n"
" const float4* triangleVertices,\n"
" __global Contact4* restrict globalContactsOut,\n"
" __global b3Contact4Data* restrict globalContactsOut,\n"
" counter32_t nGlobalContactsOut,\n"
" int maxContactCapacity,\n"
" float4 spherePos2,\n"
@@ -1311,7 +1336,7 @@ static const char* primitiveContactsKernelsCL= \
" \n"
" if (dstIdx < maxContactCapacity)\n"
" {\n"
" __global Contact4* c = &globalContactsOut[dstIdx];\n"
" __global b3Contact4Data* c = &globalContactsOut[dstIdx];\n"
" c->m_worldNormal = normalOnSurfaceB1;\n"
" c->m_coeffs = (u32)(0.f*0xffff) | ((u32)(0.7f*0xffff)<<16);\n"
" c->m_batchIdx = pairIndex;\n"
@@ -1343,7 +1368,7 @@ static const char* primitiveContactsKernelsCL= \
" __global const btGpuFace* faces,\n"
" __global const int* indices,\n"
" __global btAabbCL* aabbs,\n"
" __global Contact4* restrict globalContactsOut,\n"
" __global b3Contact4Data* restrict globalContactsOut,\n"
" counter32_t nGlobalContactsOut,\n"
" int numConcavePairs, int maxContactCapacity\n"
" )\n"