ATOMICAND(3G)
π ATOMICAND π (that's section 3G bestie, the GL one)
okay so real talk, this is the manual page for atomicAnd, and it lives in section 3G of the manual. it's giving shader-core, it's giving concurrency, and honestly? it ate. let's get into it. π¦
β¨ NAME β¨
atomicAnd β do an atomic logical AND operation to a variable. that's it, that's the whole job. π
πΈ DECLARATION πΈ
here's the two flavors, copy them exactly bestie, do not freestyle:
int atomicAnd(inout int mem, int data);
uint atomicAnd(inout uint mem, uint data);
two overloads. int version and uint version. iconic of them. π
π PARAMETERS π
memβ the variable you're using as the target of the operation. this is the thing getting ANDed, the main character fr.dataβ the data that gets logically ANDed withmem. the sidekick that shows up and changes everything. π
π« DESCRIPTION π«
okay so atomicAnd performs an atomic logical AND of data with the contents of memβ¦ and then β and this is the good part β it returns the original contents of mem from before the logical operation occured. yes, before. the past version. the pre-glow-up value. β¨
and the contents of the memory being updated by the atomic operation are guaranteed not to be modified by any other assignment or atomic memory function in any shader invocation between the time the original value is read and the time the new value is written. so nobody's out here sneaking in and messing with your variable mid-operation. no cap. the lock is locked, the vibe is protected, we love a race-condition-free queen. π«Ά
β οΈ now the important part, listen up: atomic memory functions are supported only for a limited set of variables. a shader will fail to compile if the value passed to the mem argument of an atomic memory function does not correspond to a buffer or shared variable. so don't just pass whatever, bestie, the compiler WILL clock you. π
but! it IS acceptable to pass an element of an array or a single component of a vector to the mem argument of an atomic memory function, as long as the underlying array or vector is a buffer or shared variable. so array elements and vector components? totally fine, slay. π
π VERSION SUPPORT π
here's the vibe check across every OpenGL Shading Language version, function name atomicAnd:
- 1.10 β
-nope, not invited π - 1.20 β
-still no π - 1.30 β
-nope - 1.40 β
-nope - 1.50 β
-nope - 3.30 β
-nope - 4.00 β
-nope - 4.10 β
-nope - 4.20 β
-nope - 4.30 β
βFINALLY. she arrived. π - 4.40 β
βstill here, still thriving β¨ - 4.50 β
βand still eating π₯
so like, 4.30 and up only. anything before that is a no from her. periodt.
π¦ SEE ALSO π¦
go give these siblings some love, they're all in the same atomic family:
atomicAdd()atomicOr()atomicXor()atomicMin()atomicMax()atomicExchange()atomicCompSwap()
π 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 π (yes, again, they said it twice)
Copyright Β© 2012-2014 Khronos Group
and that's the whole page bestie!! ππ the source line is literally [FIXME: source] (they left it as a placeholder, we respect the honesty) and this version is dated 01/03/2018. it's the ATOMICAND(3G) page, it's giving Khronos, it's giving atomic, and it's done. iykyk. β¨π¦π
π¦ 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