ATOMICOR(3G)
β¨ ATOMICOR β¨ (that's atomicOr from the 3G manual section, bestie π)
πΈ NAME πΈ
atomicOr β do an atomic logical OR operation on a variable, no cap π
π DECLARATION π
int atomicOr(inout int mem, int data);
uint atomicOr(inout uint mem, uint data);
π«Ά PARAMETERS π«Ά
memβ the variable that's gonna be the target of the operation, aka the thing we're messing with πdataβ the data that gets logically ORed withmemβ¨
π DESCRIPTION π
So atomicOr does an atomic logical OR of data into whatever's living in mem, and it hands back the original contents of mem from before the logical operation happened. Like, the receipts from before, not after. π§Ύ
And the way the memory being updated by the atomic operation is guaranteed not to be touched by any other assignment or atomic memory function in any shader invocation between the moment the original value gets read and the moment the new value gets written? That's the whole point. Periodt. π
Lowkey important caveat: atomic memory functions are only supported for a limited set of variables. If the value you pass to the mem argument of an atomic memory function doesn't correspond to a buffer or shared variable, the shader will fail to compile. π So don't do that.
Good news though: 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. Slay π
β VERSION SUPPORT β
Here's the vibe check on which OpenGL Shading Language Versions have atomicOr in their life π¦
atomicOr:
- 1.10 β
-(nope) - 1.20 β
-(nope) - 1.30 β
-(nope) - 1.40 β
-(nope) - 1.50 β
-(nope) - 3.30 β
-(nope) - 4.00 β
-(nope) - 4.10 β
-(nope) - 4.20 β
-(nope) - 4.30 β
β(okay we're so back) - 4.40 β
β(still iconic) - 4.50 β
β(ate, obviously)
π SEE ALSO π
Your other atomic besties, go say hi:
atomicAdd()atomicAnd()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 (again, bc they said it twice) π
Copyright Β© 2012-2014 Khronos Group
okay that's the whole page, mwah π«Ά this came from the [FIXME: source] source, dated 01/03/2018, and yeah it's filed under ATOMICOR(3G) in case you lost the plot. bye bestie, go compile something cute π
β¨
π¦ 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