ATOMICMAX(3G)

πŸ“¦
version 1.0~svn33624 Β· 4 versions
, in ubuntu jammy, ubuntu noble

✨ 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 to mem

⭐ 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 the mem argument 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 the mem argument 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 Β© 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 Β© 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