5
\$\begingroup\$

I am considering replacing an atomic counter in my shader code with a SSBO an atomicAdd operation. What I need to know is the difference in performance of these two. I know the atomic counter executes in roughly 3 clock cycles on my Geforce 840m. The reason behind this is that I would like to add an arbitrary number to the counter rather than just increment by 1.

\$\endgroup\$
1
\$\begingroup\$

According to https://software.intel.com/en-us/articles/opengl-performance-tips-atomic-counter-buffers-versus-shader-storage-buffer-objects there is no difference in performance between the two on Intel's integrated GPUs. I suspect that the argument that they are implemented with the same instruction under the hood is valid on other vendor GPUs as well, so the performance difference between them, if it ever exited, should decrease with time.

\$\endgroup\$
  • \$\begingroup\$ Thank you for the timely response. I would like to add that my experience would confirm this. The only further optimization would be to have multiple counters and a method to distribute the load over them and afterwards perform a parallel sum. \$\endgroup\$ – Andreas Mar 8 '17 at 0:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.