ATOMICMAX(3G)
β¨ ATOMICMAX β the 3G girlies' guide to atomic maxing β¨
okay so bestie, welcome to the atomicMax page from section 3G of the manual π this is the one where we make a number go as big as it can go, and we do it atomically, which is giving main character energy fr fr.
πΈ NAME πΈ
atomicMax β perform an atomic max operation to a variable π
π DECLARATION π
no cap, here's exactly how it shows up in your shader:
int atomicMax(inout int mem, int data);
uint atomicMax(inout uint mem, uint data);
π¦ PARAMETERS π¦
memβ the variable you're using as the target of the operation, aka the lil guy getting updated πdataβ the data that's getting compared tomem
β DESCRIPTION β
okay so here's the tea β atomicMax does an atomic comparison of data against whatever's chillin' inside mem, writes the maximum value into mem, and then returns the original contents of mem from before the comparison happened. it's giving "here's what you were, now here's what you are" π
and the way that it's guaranteed β the contents of the memory being updated by the atomic operation are not going 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. locked in. protected. periodt πβ¨
β οΈ now the important part bestie, don't skip this one: atomic memory functions are supported only for a limited set of variables. a shader will fail to compile if the value you pass to thememargument of an atomic memory function doesn't correspond to a buffer or shared variable. it is acceptable to pass an element of an array or a single component of a vector to thememargument of an atomic memory function, as long as the underlying array or vector is a buffer or shared variable. so likeβ¦ check your types first, i'm begging π
π VERSION SUPPORT π
okay so the vibe check on which OpenGL Shading Language Versions are carrying atomicMax. here's the full lineup, no values skipped, i promised π«Ά
Function Name: atomicMax
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 basically she showed up at 4.30 and has been iconic ever since π before that? not me getting a - across the whole board π
π SEE ALSO π
the whole friend group, go say hi:
atomicAdd()atomicAnd()atomicOr()atomicXor()atomicMin()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 πΈ
Copyright Β© 2012-2014 Khronos Group
okay that's the whole page bestie, go forth and max atomically πβ¨ the source is [FIXME: source] and the date on this one is 01/03/2018, 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