libgpcogl - Advanced

These features require higher version of OpenGL and may run on fewer GPUs than the standard array features. However, there are tasks which can not be solved without these advanced APIs.

Atomic counters

It is possible to create 32 bit unsigned integer atomic counters that are shared among all shader instances within a context. When used properly, these counters are incrementer or decremented without race conditions and can be used for locking or indexin other shared resources (e.g. buffers) or to count number of events or matches.

Shared buffers

Normally a shader instace has only a single cell output in the output array. This is useful for tasks where all cells of a large array needs to be calculated. However, in some tasks a search is performed on an array and only a few matches should be collected on a list. This requires a different output which:

In gpcogl this is realized using buffers. To avoid race condition it is useful to combine buffers with atomic counters, e.g. using a counter to index the buffer with.