I've implemented MPR on the CPU and in pixel shaders (long story!) and there seems to be unavoidable conditional loops both to find the starting portal as well as to find the final solution. I know that there is middleware that runs physics on the GPU though. Have they found ways to make MPR or GJK more GPU friendly, such as going branchless? Is it proprietary or published knowledge? Thanks!
1 Answer
\$\begingroup\$
\$\endgroup\$
1
GPUs can branch conditionally. It's just more expensive when not all threads in the SIMD execution follow the same path.
What will actually happen is that the pixels that break out of the loop will "disable" themselves so that when all pixels in the group are out of the loop some will have the variables from earlier loops iterations.
-
\$\begingroup\$ Right. I'm just wondering if they have improved versions of the algorithm that run better in GPUs vs what you are describing. Are you saying that they don't? (: \$\endgroup\$ Commented Apr 18, 2015 at 17:34