PDA

View Full Version : atomic_counter vs image_load_store



charliejay
08-09-2011, 06:41 AM
shader_atomic_counter seems to me to be a subset of shader_image_load_store, with perhaps a more convenient/simpler API.

I'm curious to enquire of the wiser heads out there why atomic_counter might be preferable, and for what sorts of things?

Alfonse Reinheart
08-09-2011, 10:08 AM
Because it's a subset. You can only atomically increase or decrease integer values stored in buffer objects. This means that implementations are almost certainly going to be faster, requiring less overhead for when multiple threads are poking at the same bits of memory. You don't have to use heavyweight synchronization mechanisms like MemoryBarrier and such; just bump a number.

charliejay
08-10-2011, 12:46 AM
Right, that makes sense - thanks, Alfonse.