fix issue with btDbvt::collideOCL, related to memmove (needs further testing)

only enable OpenCL demo if flag --enable_experimental_opencl is passed to ExampleBrowser
This commit is contained in:
Erwin Coumans
2015-05-02 22:33:33 -07:00
parent 37c788841a
commit 7a0288bf56
6 changed files with 49 additions and 22 deletions

View File

@@ -1193,17 +1193,23 @@ inline void btDbvt::collideOCL( const btDbvtNode* root,
/* Insert 0 */
j=nearest(&stack[0],&stock[0],nes[q].value,0,stack.size());
stack.push_back(0);
//void * memmove ( void * destination, const void * source, size_t num );
#if DBVT_USE_MEMMOVE
memmove(&stack[j+1],&stack[j],sizeof(int)*(stack.size()-j-1));
memmove(&stack[j],&stack[j-1],sizeof(int)*(stack.size()-j-1));
#else
for(int k=stack.size()-1;k>j;--k) stack[k]=stack[k-1];
for(int k=stack.size()-1;k>j;--k)
{
stack[k]=stack[k-1];
}
#endif
stack[j]=allocate(ifree,stock,nes[q]);
/* Insert 1 */
j=nearest(&stack[0],&stock[0],nes[1-q].value,j,stack.size());
stack.push_back(0);
#if DBVT_USE_MEMMOVE
memmove(&stack[j+1],&stack[j],sizeof(int)*(stack.size()-j-1));
memmove(&stack[j],&stack[j-1],sizeof(int)*(stack.size()-j-1));
#else
for(int k=stack.size()-1;k>j;--k) stack[k]=stack[k-1];
#endif