MEMORYBARRIERSHARED(3G)

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

πŸ’– MEMORYBARRIERSHARED πŸ’–

okay bestie, welcome to the 3G manual page for memoryBarrierShared β€” she's a lil GLSL function and she's about to fix your entire shared-memory situation, no cap 🫢


✨ NAME ✨

memoryBarrierShared β€” controls the ordering of operations on shared variables issued by a single shader invocation

like... she's the traffic cop of your shared variables, fr fr πŸ‘‘


🌸 DECLARATION 🌸

void memoryBarrierShared(void);

takes zero args, returns nothing, does everything. the way that she's just void in and void out?? iconic πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea β˜• β€” memoryBarrierShared waits on the completion of all memory accesses resulting from the use of shared variables, and then returns with no other effect. that's it, that's the whole job, and she does it flawlessly.

when this function returns, the results of any modifications to the content of shared variables will be visible to any access to the same buffer from other shader invocations. yes bestie, that's the synchronization you've been craving 😭

and specifically?? any modifications made in one shader stage are guaranteed to be visible to accesses performed by shader invocations in subsequent stages when those invocations were triggered by the execution of the original shader invocation (e.g., fragment shader invocations for a primitive resulting from a particular geometry shader invocation). like, the pipeline stays in formation, periodt.

⚠️ important vibe check: memoryBarrierShared is available only in the compute language. if you're not in compute, she's not coming to the party, sorry babes πŸ™ˆ

🌈 VERSION SUPPORT 🌈

okay so the original gave us a big gorgeous grid of OpenGL Shading Language Versions, and I'm handing it to you as a list because tables aren't it in this format. same facts, same energy ✨

memoryBarrierShared support across the OpenGL Shading Language versions:

  1. 1.10 β€” βœ— (nope)
  2. 1.20 β€” βœ— (nope)
  3. 1.30 β€” βœ— (nope)
  4. 1.40 β€” βœ— (nope)
  5. 1.50 β€” βœ— (nope)
  6. 3.30 β€” βœ— (nope)
  7. 4.00 β€” βœ— (nope)
  8. 4.10 β€” βœ— (nope)
  9. 4.20 β€” βœ— (nope)
  10. 4.30 β€” βœ” (SHE'S HERE πŸ’–)
  11. 4.40 β€” βœ” (here πŸ’–)
  12. 4.50 β€” βœ” (here πŸ’–)

so basically she ghosted every version until 4.30 and then showed up and slayed. the glow-up is real 🧚


πŸŽ€ SEE ALSO πŸŽ€

go give these other barriers some love too, they're all in the same friend group:

  • memoryBarrier()
  • memoryBarrierImage()
  • memoryBarrierBuffer()
  • groupMemoryBarrier()

iykyk πŸ’œ


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


and that's the whole page, bestie!! this one came from <code>[FIXME: source]</code>, dated <code>01/03/2018</code>, and lives under the manual name <code>MEMORYBARRIERSHARED(3G)</code> β€” go forth and synchronize your shared variables responsibly, mwah πŸ’‹

πŸ“¦ where this page comes from