GL_OES_shader_image_atomic#
Supported Hardware#
Series6, Series6XE, Series6XT
Valid APIs#
OpenGL ES 3.x
Description#
This extension adds GLSL built-ins that provide guaranteed atomic read/write access to images when called. Image atomic operations perform a guaranteed read/modify/write operation to a given pixel in an image without overlapping with any other shader performing another atomic operation at the same time (causing a race condition). These operations can only work on integer or unsigned integer textures. They are all labelled as imageAtomic*(), and perform the same types of atomic operations added by ES 3.1 and in many Operating Systems on the CPU:
imageAtomicAdd
imageAtomicMin
imageAtomicMax
imageAtomicAnd
imageAtomicOr
imageAtomicXor
imageAtomicExchange
imageAtomicCompSwap
These are identical to the already available atomic operations for buffer objects, but function on images instead. These functions only operate on integer or unsigned integer images.
Registry Link#
http://www.khronos.org/registry/gles/extensions/OES/OES_shader_image_atomic.txt
Example#
layout(binding = 0) coherent uimage2D exampleImage;
void main()
{
...
// Increment the value at the current fragment coordinate in the example image.
imageAtomicAdd(exampleImage, gl_FragCoord.xy, 1);
...
}