CPU or GPU ray-casting ?

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
yanbo2u
Posts: 21
Joined: Sun Oct 04, 2015 4:41 pm

CPU or GPU ray-casting ?

Post by yanbo2u »

this may not be the right place to ask for my question.

I have the same BEPU physics game which does a ton of ray-casting at 10Hz, for which I am doing it in a separate thread while locking on "space.BroadPhase.Locker".

My desktop is i7-4790k and Geforece GTX980. As soon as I turn on ray-casting, the draw rate drops from 60fps to 18 fps. Surprisingly, i tried it on my 4 years old laptop, i7-2670QM and Qurado 1000M. The laptop is doing really smooth at 60fps draw rate.

I guess my desktop has some funny issue. How does the ray-casting work behind the scene? Is it software based ? Or GPU plays an important role?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: CPU or GPU ray-casting ?

Post by Norbo »

BEPUphysics only uses the CPU. It sounds like the main thread is bottlenecking against the ray casting. If the ray thread takes more than a millisecond or so to relinquish its lock, it would cause the main thread to hitch. If it's taking closer to 50-100 milliseconds to complete, that would explain the framerate drop. If this is indeed the case, then splitting the ray loop across multiple locks would help.

Also, taking 10+ milliseconds of a single thread on that kind of desktop CPU should require at least a thousand rays on a very complex scene. If that doesn't match up with what your observations, something wonky could be going on.

That doesn't explain why the laptop runs acceptably. Maybe some architectural difference, like a ton of nasty numerical corner cases like denorms, NaNs or infinities that the 4790k handles more slowly than the 2670QM. (I'd be a little surprised if the architecture actually regressed like that, though.)
Post Reply