mirror of
https://github.com/bulletphysics/bullet3
synced 2024-12-14 22:00:05 +00:00
fix OpenCL kernel: NVIDIA crashes in clBuildProgram and AMD reports an error 'irreducable flow detected" ?!?
ray-convex works on GPU
This commit is contained in:
parent
330bf3ea09
commit
92f2f330df
@ -171,11 +171,12 @@ bool rayConvex(float4 rayFromLocal, float4 rayToLocal, int numFaces, int faceOff
|
||||
{
|
||||
rayFromLocal.w = 0.f;
|
||||
rayToLocal.w = 0.f;
|
||||
bool result = true;
|
||||
|
||||
float exitFraction = *hitFraction;
|
||||
float enterFraction = -0.1f;
|
||||
float4 curHitNormal = (float4)(0,0,0,0);
|
||||
for (int i=0;i<numFaces;i++)
|
||||
for (int i=0;i<numFaces && result;i++)
|
||||
{
|
||||
b3GpuFace face = faces[faceOffset+i];
|
||||
float fromPlaneDist = dot(rayFromLocal,face.m_plane)+face.m_plane.w;
|
||||
@ -203,19 +204,21 @@ bool rayConvex(float4 rayFromLocal, float4 rayToLocal, int numFaces, int faceOff
|
||||
}
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
if (exitFraction <= enterFraction)
|
||||
return false;
|
||||
result = false;
|
||||
}
|
||||
|
||||
if (enterFraction < 0.f)
|
||||
return false;
|
||||
result = result && (enterFraction < 0.f);
|
||||
|
||||
if (result)
|
||||
{
|
||||
*hitFraction = enterFraction;
|
||||
*hitNormal = curHitNormal;
|
||||
return true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
@ -173,11 +173,12 @@ static const char* rayCastKernelCL= \
|
||||
"{\n"
|
||||
" rayFromLocal.w = 0.f;\n"
|
||||
" rayToLocal.w = 0.f;\n"
|
||||
" bool result = true;\n"
|
||||
" \n"
|
||||
" float exitFraction = *hitFraction;\n"
|
||||
" float enterFraction = -0.1f;\n"
|
||||
" float4 curHitNormal = (float4)(0,0,0,0);\n"
|
||||
" for (int i=0;i<numFaces;i++)\n"
|
||||
" for (int i=0;i<numFaces && result;i++)\n"
|
||||
" {\n"
|
||||
" b3GpuFace face = faces[faceOffset+i];\n"
|
||||
" float fromPlaneDist = dot(rayFromLocal,face.m_plane)+face.m_plane.w;\n"
|
||||
@ -205,19 +206,21 @@ static const char* rayCastKernelCL= \
|
||||
" }\n"
|
||||
" } else\n"
|
||||
" {\n"
|
||||
" return false;\n"
|
||||
" result = false;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" if (exitFraction <= enterFraction)\n"
|
||||
" return false;\n"
|
||||
" result = false;\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" if (enterFraction < 0.f)\n"
|
||||
" return false;\n"
|
||||
" result = result && (enterFraction < 0.f);\n"
|
||||
" \n"
|
||||
" if (result)\n"
|
||||
" { \n"
|
||||
" *hitFraction = enterFraction;\n"
|
||||
" *hitNormal = curHitNormal;\n"
|
||||
" return true;\n"
|
||||
" }\n"
|
||||
" return result;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"\n"
|
||||
|
Loading…
Reference in New Issue
Block a user