From OpenGL Reference
Jump to navigation Jump to search

Atomically compares supplied data with that in memory and conditionally stores it to memory.


uint imageAtomicCompSwap( gimage1D image, int P, uint compare, uint data );
uint imageAtomicCompSwap( gimage2D image, ivec2 P, uint compare, uint data );
uint imageAtomicCompSwap( gimage3D image, ivec3 P, uint compare, uint data );
uint imageAtomicCompSwap( gimage2DRect image, ivec2 P, uint compare, uint data );
uint imageAtomicCompSwap( gimageCube image, ivec3 P, uint compare, uint data );
uint imageAtomicCompSwap( gbufferImage image, int P, uint compare, uint data );
uint imageAtomicCompSwap( gimage1DArray image, ivec2 P, uint compare, uint data );
uint imageAtomicCompSwap( gimage2DArray image, ivec3 P, uint compare, uint data );
uint imageAtomicCompSwap( gimageCubeArray image, ivec3 P, uint compare, uint data );
uint imageAtomicCompSwap( gimage2DMS image, ivec2 P, int sample, uint compare, uint data );
uint imageAtomicCompSwap( gimage2DMSArray image, ivec3 P, int sample, uint compare, uint data );
int imageAtomicCompSwap( gimage1D image, int P, int compare, int data );
int imageAtomicCompSwap( gimage2D image, ivec2 P, int compare, int data );
int imageAtomicCompSwap( gimage3D image, ivec3 P, int compare, int data );
int imageAtomicCompSwap( gimage2DRect image, ivec2 P, int compare, int data );
int imageAtomicCompSwap( gimageCube image, ivec3 P, int compare, int data );
int imageAtomicCompSwap( gbufferImage image, int P, int compare, int data );
int imageAtomicCompSwap( gimage1DArray image, ivec2 P, int compare, int data );
int imageAtomicCompSwap( gimage2DArray image, ivec3 P, int compare, int data );
int imageAtomicCompSwap( gimageCubeArray image, ivec3 P, int compare, int data );
int imageAtomicCompSwap( gimage2DMS image, ivec2 P, int sample, int compare, int data );
int imageAtomicCompSwap( gimage2DMSArray image, ivec3 P, int sample, int compare, int data );


image - Specify the image unit into which to compare and conditionally store data .
P - Specify the coordinate at which to compare and conditionally store the data.
sample - When present, specifies the sample within the image to compare and conditionally store into.
compare - Specifies the value to compare with the content of the image.
data - Specifies the value to store in the image if compare is equal to the existing image content.


 imageAtomicCompSwap atomically compares the value of compare with that of the texel at coordinate P and sample (for multisampled forms) in the image bound to uint image . If the values are equal, data is stored into the texel, otherwise it is discarded. It returns the original value of the texel regardless of the result of the comparison operation.

Version Support[edit]

imageAtomicCompSwap 4.2+

See Also[edit]

 imageLoad , imageStore , imageAtomicAdd , imageAtomicMin , imageAtomicMax , imageAtomicXor , imageAtomicOr , imageAtomicAnd , imageAtomicCompSwap 


Copyright© 2011-2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999.