From 0ed7b5c508484e0c137b467f9d34346e351ad484 Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Thu, 16 Jan 2014 15:53:53 -0800 Subject: [PATCH] adding check on low number of vertices fixes Mac OSX crash --- .../NarrowphaseCollision/kernels/satClipHullContacts.cl | 8 ++++---- .../NarrowphaseCollision/kernels/satClipHullContacts.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Bullet3OpenCL/NarrowphaseCollision/kernels/satClipHullContacts.cl b/src/Bullet3OpenCL/NarrowphaseCollision/kernels/satClipHullContacts.cl index 9e9440531..c5c57cab0 100644 --- a/src/Bullet3OpenCL/NarrowphaseCollision/kernels/satClipHullContacts.cl +++ b/src/Bullet3OpenCL/NarrowphaseCollision/kernels/satClipHullContacts.cl @@ -189,8 +189,8 @@ int clipFaceGlobal(__global const float4* pVtxIn, int numVertsIn, float4 planeNo float ds, de; int numVertsOut = 0; //double-check next test - // if (numVertsIn < 2) - // return 0; + if (numVertsIn < 2) + return 0; float4 firstVertex=pVtxIn[numVertsIn-1]; float4 endVertex = pVtxIn[0]; @@ -239,8 +239,8 @@ int clipFace(const float4* pVtxIn, int numVertsIn, float4 planeNormalWS,float pl float ds, de; int numVertsOut = 0; //double-check next test -// if (numVertsIn < 2) -// return 0; + if (numVertsIn < 2) + return 0; float4 firstVertex=pVtxIn[numVertsIn-1]; float4 endVertex = pVtxIn[0]; diff --git a/src/Bullet3OpenCL/NarrowphaseCollision/kernels/satClipHullContacts.h b/src/Bullet3OpenCL/NarrowphaseCollision/kernels/satClipHullContacts.h index f5250b192..5d863b487 100644 --- a/src/Bullet3OpenCL/NarrowphaseCollision/kernels/satClipHullContacts.h +++ b/src/Bullet3OpenCL/NarrowphaseCollision/kernels/satClipHullContacts.h @@ -568,8 +568,8 @@ static const char* satClipKernelsCL= \ " float ds, de;\n" " int numVertsOut = 0;\n" " //double-check next test\n" -" // if (numVertsIn < 2)\n" -" // return 0;\n" +" if (numVertsIn < 2)\n" +" return 0;\n" " \n" " float4 firstVertex=pVtxIn[numVertsIn-1];\n" " float4 endVertex = pVtxIn[0];\n" @@ -615,8 +615,8 @@ static const char* satClipKernelsCL= \ " float ds, de;\n" " int numVertsOut = 0;\n" "//double-check next test\n" -"// if (numVertsIn < 2)\n" -"// return 0;\n" +" if (numVertsIn < 2)\n" +" return 0;\n" " float4 firstVertex=pVtxIn[numVertsIn-1];\n" " float4 endVertex = pVtxIn[0];\n" " \n"