IMAGEATOMICOR(3G)

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

πŸ’– IMAGEATOMICOR πŸ’– (that's imageAtomicOr, manual section 3G, bestie)

okay so picture this: you've got a texel just sitting there in memory, living its little life, and you want to OR some bits into it β€” but like, atomically, so nobody else can sneak in halfway and mess up your vibe. that's this function. it's giving "read, OR, write, and nobody can interrupt me" energy. πŸ’…


✨ NAME ✨

imageAtomicOr β€” atomically compute the logical OR of a value with an existing value in memory, store that value and return the original value 🫢

no cap, that's literally the whole job description.


πŸŽ€ DECLARATION πŸŽ€

here come all of them, every single overload, and yes we are listing all of them because nobody gets left behind:

uint imageAtomicOr(gimage1D image, int P, uint data);

uint imageAtomicOr(gimage2D image, ivec2 P, uint data);

uint imageAtomicOr(gimage3D image, ivec3 P, uint data);

uint imageAtomicOr(gimage2DRect image, ivec2 P, uint data);

uint imageAtomicOr(gimageCube image, ivec3 P, uint data);

uint imageAtomicOr(gbufferImage image, int P, uint data);

uint imageAtomicOr(gimage1DArray image, ivec2 P, uint data);

uint imageAtomicOr(gimage2DArray image, ivec3 P, uint data);

uint imageAtomicOr(gimageCubeArray image, ivec3 P, uint data);

uint imageAtomicOr(gimage2DMS image, ivec2 P, int sample, uint data);

uint imageAtomicOr(gimage2DMSArray image, ivec3 P, int sample,
                   uint data);

int imageAtomicOr(gimage1D image, int P, int data);

int imageAtomicOr(gimage2D image, ivec2 P, int data);

int imageAtomicOr(gimage3D image, ivec3 P, int data);

int imageAtomicOr(gimage2DRect image, ivec2 P, int data);

int imageAtomicOr(gimageCube image, ivec3 P, int data);

int imageAtomicOr(gbufferImage image, int P, int data);

int imageAtomicOr(gimage1DArray image, ivec2 P, int data);

int imageAtomicOr(gimage2DArray image, ivec3 P, int data);

int imageAtomicOr(gimageCubeArray image, ivec3 P, int data);

int imageAtomicOr(gimage2DMS image, ivec2 P, int sample, int data);

int imageAtomicOr(gimage2DMSArray image, ivec3 P, int sample, int data);

twenty-two of them. iconic. they all return uint or int depending on which lane you're in, and they all take an image, a coordinate P, and some data. the multisample girlies (gimage2DMS, gimage2DMSArray) also bring a sample along for the ride. πŸ’–


🌸 PARAMETERS 🌸

  • image β€” bestie, this is the image unit you're storing your data into. that's the destination. that's the home. 🏠
  • P β€” the coordinate where the data goes. where exactly in the image we're doing the thing. πŸ“
  • sample β€” when it's present, it says which sample within the image you're storing into. (only the MS overloads have this one, iykyk.) πŸ”
  • data β€” the actual data you're logically OR-ing into the image. this is the payload. πŸ’Œ

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea: imageAtomicOr atomically computes a new value by logically ORing 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 it again slowly. it computes, it stores, and it hands you back what was there before β€” all in one atomic lil moment. the way that it returns the original value and not the new one?? that's the whole point, don't get it twisted. ✨


πŸ‘‘ VERSION SUPPORT πŸ‘‘

which OpenGL Shading Language versions have imageAtomicOr? let's do a vibe check, one version at a time:

  • OpenGL Shading Language 1.10 β€” - (nope, not yet, babe 😭)
  • OpenGL Shading Language 1.20 β€” -
  • OpenGL Shading Language 1.30 β€” -
  • OpenGL Shading Language 1.40 β€” -
  • OpenGL Shading Language 1.50 β€” -
  • OpenGL Shading Language 3.30 β€” -
  • OpenGL Shading Language 4.00 β€” -
  • OpenGL Shading Language 4.10 β€” -
  • OpenGL Shading Language 4.20 β€” βœ” (SHE'S HERE πŸ’…)
  • OpenGL Shading Language 4.30 β€” βœ”
  • OpenGL Shading Language 4.40 β€” βœ”
  • OpenGL Shading Language 4.50 β€” βœ”

so yeah: imageAtomicOr didn't show up until 4.20, and she's been booked and busy ever since. πŸ”₯


🌈 SEE ALSO 🌈

go read these next, they're all in the same friend group:

  • imageLoad()
  • imageStore()
  • imageAtomicAdd()
  • imageAtomicMin()
  • imageAtomicMax()
  • imageAtomicAnd()
  • imageAtomicXor()
  • imageAtomicExchange()
  • imageAtomicCompSwap()

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


lowkey important: this page came out of [FIXME: source] and is dated 01/03/2018 β€” so if you're citing it, that's the receipt. 🧾

and that's the whole page, bestie. go forth and OR some bits atomically. you ate. periodt. πŸŽ€πŸ’–βœ¨

πŸ“¦ where this page comes from