IMAGEATOMICEXCHANGE(3G)
π imageAtomicExchange π
okay bestie, welcome to IMAGEATOMICEXCHANGE(3G) β yes that's the manual section, 3G is giving library-functions-but-make-it-shaders energy and we're gonna get through it together, no cap π«Ά
β¨ NAME β¨
imageAtomicExchange β atomically store supplied data into memory and return the original value from memory πΈ
like, it swaps. it returns the old one. it does it atomically. that's the whole vibe. periodt.
π DECLARATION π
bestie there are SO many overloads, buckle up, here they all are verbatim:
uint imageAtomicExchange(gimage1D image, int P, uint data);
uint imageAtomicExchange(gimage2D image, ivec2 P, uint data);
uint imageAtomicExchange(gimage3D image, ivec3 P, uint data);
uint imageAtomicExchange(gimage2DRect image, ivec2 P, uint data);
uint imageAtomicExchange(gimageCube image, ivec3 P, uint data);
uint imageAtomicExchange(gbufferImage image, int P, uint data);
uint imageAtomicExchange(gimage1DArray image, ivec2 P, uint data);
uint imageAtomicExchange(gimage2DArray image, ivec3 P, uint data);
uint imageAtomicExchange(gimageCubeArray image, ivec3 P, uint data);
uint imageAtomicExchange(gimage2DMS image, ivec2 P, int sample,
uint data);
uint imageAtomicExchange(gimage2DMSArray image, ivec3 P, int sample,
uint data);
int imageAtomicExchange(gimage1D image, int P, int data);
int imageAtomicExchange(gimage2D image, ivec2 P, int data);
int imageAtomicExchange(gimage3D image, ivec3 P, int data);
int imageAtomicExchange(gimage2DRect image, ivec2 P, int data);
int imageAtomicExchange(gimageCube image, ivec3 P, int data);
int imageAtomicExchange(gbufferImage image, int P, int data);
int imageAtomicExchange(gimage1DArray image, ivec2 P, int data);
int imageAtomicExchange(gimage2DArray image, ivec3 P, int data);
int imageAtomicExchange(gimageCubeArray image, ivec3 P, int data);
int imageAtomicExchange(gimage2DMS image, ivec2 P, int sample,
int data);
int imageAtomicExchange(gimage2DMSArray image, ivec3 P, int sample,
int data);
int imageAtomicExchange(gimage1D image, int P, float data);
int imageAtomicExchange(gimage2D image, ivec2 P, float data);
int imageAtomicExchange(gimage3D image, ivec3 P, float data);
int imageAtomicExchange(gimage2DRect image, ivec2 P, float data);
int imageAtomicExchange(gimageCube image, ivec3 P, float data);
int imageAtomicExchange(gbufferImage image, int P, float data);
int imageAtomicExchange(gimage1DArray image, ivec2 P, float data);
int imageAtomicExchange(gimage2DArray image, ivec3 P, float data);
int imageAtomicExchange(gimageCubeArray image, ivec3 P, float data);
int imageAtomicExchange(gimage2DMS image, ivec2 P, int sample,
float data);
int imageAtomicExchange(gimage2DMSArray image, ivec3 P, int sample,
float data);
look at that wall of signatures. it's giving thorough. we love a function that covers every image type fr fr π
π PARAMETERS π
imageβ Specify the image unit into which to storedata. it's the lil target, the destination, the place we're sliding into πPβ Specify the coordinate at which to store thedata. basically the address, the where, the spot π¦sampleβ When present, specifies the sample within the image to store into. only shows up in some overloads, so don't panic if you don't see it πdataβ Specifies the data to exchange with that stored in the image. this is the new stuff going in, and whatever was already there comes back out to you π
πΈ DESCRIPTION πΈ
okay so here's the tea: imageAtomicExchange atomically stores the value of data into the texel at coordinate P and sample in the image bound to unit image, and returns the original value of the texel. π₯
read that again. it stores your thing, and it hands you back the old thing. atomically. nobody in between. no race conditions crashing the party. iconic behaviour honestly β¨
π VERSION SUPPORT π
the original had a whole big grid here, so lemme lay it out for you in list form because we keep every detail, bestie. the columns were OpenGL Shading Language Versions: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 4.00, 4.10, 4.20, 4.30, 4.40, 4.50.
imageAtomicExchange(uint and int data) β1.10:-,1.20:-,1.30:-,1.40:-,1.50:-,3.30:-,4.00:-,4.10:-,4.20: β,4.30: β,4.40: β,4.50: βimageAtomicExchange(float data) β1.10:-,1.20:-,1.30:-,1.40:-,1.50:-,3.30:-,4.00:-,4.10:-,4.20:-,4.30:-,4.40:-,4.50: β
so the uint/int version showed up in 4.20 like the queen it is π and the float version was fashionably late, arriving only in 4.50 π
π¦ SEE ALSO π¦
go read these next, they're all in the same friend group:
imageLoad(), imageStore(), imageAtomicAdd(), imageAtomicMin(), imageAtomicMax(), imageAtomicXor(), imageAtomicOr(), imageAtomicAnd(), imageAtomicCompSwap()
β COPYRIGHT β
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. http://opencontent.org/openpub/.
π COPYRIGHT π
Copyright Β© 2011-2014 Khronos Group
and that's the whole page, bestie!! π this came from source [FIXME: source], dated 01/03/2018, and yeah the manual name was IMAGEATOMICEXCHANGE(3G) the entire time π
slay, go atomically exchange something, i'm obsessed with you π«Άβ¨
π¦ where this page comes from
- ubuntu jammy: opengl-4-man-doc 1.0~svn33624-1 Β· SGI-Free-Software-B-License-2
- ubuntu noble: opengl-4-man-doc 1.0~svn33624-1 Β· SGI-Free-Software-B-License-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms