Well yes, there are Atomic Counters that can be incremented and decremented with atomic operations. They live in buffers and that's pretty much all.

Shader Storage Blocks are capable of these basic operations and even more.

So what's the point of Counters at all, in what situations are they superior to Storage Blocks if any?

Thanks

Alfonse Reinheart

02-09-2015, 02:57 PM

You could ask the exact same question about SSBO's relative to Image Load/Store with Buffer Textures. And SSBOs would have no advantages on any hardware (in terms of functionality), unlike atomic counters.

Atomic counters can only be used for increment/decrement operations. They have a much more limited interface, compared to Image Load/Store or SSBOs; you can't even set them. Because of that, they can use much simpler hardware. AMD for example has specialized hardware for them.

Also, atomic counters are not incoherent memory accesses (https://www.opengl.org/wiki/Incoherent Memory Access). So you can treat them like transform feedbacks and so forth.

Lastly, atomic counters don't count as outputs, so they don't count against GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES.