IMAGEATOMICXOR(3G)

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

πŸ’– IMAGEATOMICXOR πŸ’– (that's imageAtomicXor(3G) bestie, from the 3G manual section, GLSL gang πŸŽ€)

okay so. imagine you have a texel. you want to XOR a number into it. but like β€” atomically, so nobody else can sneak in and mess with it halfway through. that's this function. it's giving ✨responsible multithreading✨ and honestly? obsessed.


🌸 NAME 🌸

imageAtomicXor β€” atomically compute the logical exclusive 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's the whole roster of glow-ups. uint flavor first, bestie:

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

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

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

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

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

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

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

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

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

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

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

and now the int flavor, same energy different signedness πŸ¦‹:

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

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

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

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

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

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

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

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

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

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

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

twelve overloads each way, twenty-two total. she's thorough. she's committed. she ate. πŸ‘‘


🌈 PARAMETERS 🌈

  • image β€” which image unit you're storing data into. point her at the right one bestie, please.
  • P β€” the coordinate where the data goes. where we dropping, queens? πŸ“
  • sample β€” when it's present, it says which sample inside the image we're storing into. (only the MS flavors get this one, iykyk.)
  • data β€” the actual data being logically XOR'd into the image. this is the payload. this is the moment. πŸ’œ

🧚 DESCRIPTION 🧚

okay so here's the tea, fr fr:

imageAtomicXor atomically computes a new value by logically XORing 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 that again. it gives you back the OLD value, not the new one. the original. the before-picture. πŸ“Έ

and it does all of it atomically β€” meaning the whole read-XOR-write-return sequence happens as one indivisible glow-up. nobody gets to peek mid-transformation. that's the whole point. that's the main character energy. ✨


πŸ‘‘ VERSION SUPPORT πŸ‘‘

which GLSL versions does she serve? let's vibe check the timeline, bestie:

  • imageAtomicXor with OpenGL Shading Language 1.10 β€” - πŸ™ˆ
  • imageAtomicXor with OpenGL Shading Language 1.20 β€” - πŸ™ˆ
  • imageAtomicXor with OpenGL Shading Language 1.30 β€” - πŸ™ˆ
  • imageAtomicXor with OpenGL Shading Language 1.40 β€” - πŸ™ˆ
  • imageAtomicXor with OpenGL Shading Language 1.50 β€” - πŸ™ˆ
  • imageAtomicXor with OpenGL Shading Language 3.30 β€” - πŸ™ˆ
  • imageAtomicXor with OpenGL Shading Language 4.00 β€” - πŸ™ˆ
  • imageAtomicXor with OpenGL Shading Language 4.10 β€” - πŸ™ˆ
  • imageAtomicXor with OpenGL Shading Language 4.20 β€” βœ” πŸ”₯
  • imageAtomicXor with OpenGL Shading Language 4.30 β€” βœ” πŸ”₯
  • imageAtomicXor with OpenGL Shading Language 4.40 β€” βœ” πŸ”₯
  • imageAtomicXor with OpenGL Shading Language 4.50 β€” βœ” πŸ”₯

so basically she didn't exist until 4.20 and then she arrived and slayed immediately. a true 4.20 era icon. 🌿✨


🫢 SEE ALSO 🫢

go read her friends, they're all iconic too:

  • imageLoad()
  • imageStore()
  • imageAtomicAdd()
  • imageAtomicMin()
  • imageAtomicMax()
  • imageAtomicOr()
  • imageAtomicAnd()
  • 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


πŸ’Œ okay that's the whole page bestie, you're officially an imageAtomicXor girlie now. go XOR something atomically. i believe in you. πŸŽ€

and finally, the lil sign-off at the bottom of the page said source [FIXME: source], dated 01/03/2018, and it went out under the IMAGEATOMICXOR(3G) banner. so cute. so official. so 2018. πŸ’–βœ¨

πŸ“¦ where this page comes from