3
\$\begingroup\$

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!

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

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.

\$\endgroup\$
1
  • \$\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\$
    – Alan Wolfe
    Commented Apr 18, 2015 at 17:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .