IMAGEATOMICADD(3G)
π IMAGEATOMICADD π
okay bestie, welcome to the imageAtomicAdd(3G) page β yes the 3G means she lives in the OpenGL section of the manual, we love a labeled queen π
β¨ NAME β¨
imageAtomicAdd β atomically add a value to an existing value in memory and return the original value π«Ά
like. she adds, she stores, she hands you back what was there before. no cap.
πΈ DECLARATION πΈ
okay so there are so many overloads here and you're gonna want to just skim until you find your image type, bestie. she comes in uint flavour and int flavour, and every image shape gets a glow-up. here's the whole roster, verbatim, no edits π
uint imageAtomicAdd(gimage1D image, int P, uint data);
uint imageAtomicAdd(gimage2D image, ivec2 P, uint data);
uint imageAtomicAdd(gimage3D image, ivec3 P, uint data);
uint imageAtomicAdd(gimage2DRect image, ivec2 P, uint data);
uint imageAtomicAdd(gimageCube image, ivec3 P, uint data);
uint imageAtomicAdd(gbufferImage image, int P, uint data);
uint imageAtomicAdd(gimage1DArray image, ivec2 P, uint data);
uint imageAtomicAdd(gimage2DArray image, ivec3 P, uint data);
uint imageAtomicAdd(gimageCubeArray image, ivec3 P, uint data);
uint imageAtomicAdd(gimage2DMS image, ivec2 P, int sample, uint data);
uint imageAtomicAdd(gimage2DMSArray image, ivec3 P, int sample,
uint data);
int imageAtomicAdd(gimage1D image, int P, int data);
int imageAtomicAdd(gimage2D image, ivec2 P, int data);
int imageAtomicAdd(gimage3D image, ivec3 P, int data);
int imageAtomicAdd(gimage2DRect image, ivec2 P, int data);
int imageAtomicAdd(gimageCube image, ivec3 P, int data);
int imageAtomicAdd(gbufferImage image, int P, int data);
int imageAtomicAdd(gimage1DArray image, ivec2 P, int data);
int imageAtomicAdd(gimage2DArray image, ivec3 P, int data);
int imageAtomicAdd(gimageCubeArray image, ivec3 P, int data);
int imageAtomicAdd(gimage2DMS image, ivec2 P, int sample, int data);
int imageAtomicAdd(gimage2DMSArray image, ivec3 P, int sample,
int data);
the way that multsample ones (gimage2DMS, gimage2DMSArray) get an extra int sample in there? main character energy fr fr πβ¨
π PARAMETERS π
imageβ bestie this is the image unit you're addingdatainto. your lil target canvas πΌοΈPβ the coordinate where the adding happens. where's the party? right here πsampleβ when she's present, this says which sample inside the image you're adding into π§dataβ the actual value you're adding into the image. the gift π
π« DESCRIPTION π«
okay so here's the whole vibe: imageAtomicAdd atomically computes a new value by adding the value of data to the contents of the texel at coordinate P and sample in the image bound to uint image, stores that value into the image, and returns the original value.
read that again. atomically. as in nobody else is gonna sneak in between your read and your write. she's doing the math, she's putting the answer back, and she's handing you the number that was sitting there before she touched it. iconic behaviour, honestly π
π VERSION SUPPORT π
vibe check time β imageAtomicAdd is a late bloomer and we respect her journey. here's the whole grid, every GLSL version accounted for, nothing skipped, periodt:
- Function name:
imageAtomicAdd - GLSL 1.10 β
- - GLSL 1.20 β
- - GLSL 1.30 β
- - GLSL 1.40 β
- - GLSL 1.50 β
- - GLSL 3.30 β
- - GLSL 4.00 β
- - GLSL 4.10 β
- - GLSL 4.20 β β
- GLSL 4.30 β β
- GLSL 4.40 β β
- GLSL 4.50 β β
so basically: a whole lotta - and then 4.20 shows up and she ATE π₯ everything from 4.20 through 4.50 is a yes, bestie, go off π
π¦ SEE ALSO π¦
the friend group π«Ά go say hi:
imageLoad()imageStore()imageAtomicMin()imageAtomicMax()imageAtomicAnd()imageAtomicOr()imageAtomicXor()imageAtomicExchange()imageAtomicCompSwap()
iykyk π
π 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 Β© 2011-2014 Khronos Group
and that's the page, bestie πΈ the footer said the source is [FIXME: source] and the date is 01/03/2018 β so yeah, a lil retro, a lil mysterious, still absolutely serving. mwah π
π¦ 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