Great write-up! Your speedups look like they line up as expected. Would you happen to know why Aras's look a bit weird, is it the devices he's using? I'm referring to his Metal timings being more than 10x slower than D3D, and being almost comparable to C++.
> One of my goals was “use as much of the same code as possible on the CPU and GPU”.
Great idea, it's hard to debug GPU code, and super convenient to have something that you can run & debug on the CPU, then just flip a switch and get GPU speedups!
> Another obvious limitation is that GPU code cannot recurse.
Yep. I bet this changes relatively soon, since you can sometimes use recursion in OpenCL & CUDA.
> One of my goals was “use as much of the same code as possible on the CPU and GPU”.
Great idea, it's hard to debug GPU code, and super convenient to have something that you can run & debug on the CPU, then just flip a switch and get GPU speedups!
> Another obvious limitation is that GPU code cannot recurse.
Yep. I bet this changes relatively soon, since you can sometimes use recursion in OpenCL & CUDA.
It's a fun exercise in ShaderToy to write a recursive ray tracer. Here's mine: https://www.shadertoy.com/view/XllBRf
And here's a much better one: https://www.shadertoy.com/view/4scfz4