Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
@wduk GPU memory is many more times slower than a CPU memory (to access) due to higher latency. However, once the data starts streaming, the bandwidth is much larger than a CPU's mem bandwidth. I've updated the answer and added some screen captures demonstrating latency hiding!
@PaulFerris Well yeah, I agree with you. I think the shader is buggy and the correction would be ` float nv = dot(n, -v);` as the parameter passed in is a ViewRay, pointing away from the camera. In this sense, the nv should be between n and -v. Doing that also fixes the ugly horizontal line on one of the spheres.
Exactly. At the end of the day, the code will run on the hardware and the hardware will determine the performance. Understanding the resource usage of a shader program through the right tools and figuring out how the algorithm scales over different architectures / configurations through little experimentation is the way to go in my humble opinion. It would be interesting to hear from the more seasoned programmers though.
That would depend on the hardware that'll be running the threads, and how exactly your algorithm is implemented (its hardware usage). If you experiment with the different thread numbers and run your hardware vendor's performance profiler tools, you can get an idea of how the thread groups are utilizing your hardware in general. To my (little) experience, there's no general solution to this and it always depends on the hardware and the shader code specifics.