GL_WORKGROUPID(3G)

πŸ’… GL_WORKGROUPID πŸ’…

okay bestie, so this is a page from the 3G manual section and it's literally all about gl_WorkGroupID β€” the little built-in that tells your compute shader which workgroup it's currently vibing in. let's get into it ✨


🌸 NAME 🌸

gl_WorkGroupID β€” contains the index of the workgroup currently being operated on by a compute shader 🫢


πŸŽ€ DECLARATION πŸŽ€

in uvec3 gl_WorkGroupID ;

(no cap, that's the whole decl β€” inside your shader, you just write gl_WorkGroupID and the compiler already knows her πŸ’…)


✨ DESCRIPTION ✨

so, in the compute language, gl_WorkGroupID holds the 3-dimensional index of the global work group that the current compute shader invocation is executing within πŸ¦‹ like, the bigger bucket your invocation lives in, iykyk.

the possible values range across the parameters you pass into glDispatchCompute, okay? so it goes from (0, 0, 0) all the way up to (gl_NumWorkGroups.x - 1, gl_NumWorkGroups.y - 1, gl_NumWorkGroups.z - 1). that's the whole range, bestie β€” no sneaky extras πŸ‘‘


πŸ”₯ VERSION SUPPORT πŸ”₯

here's the vibe check on which GLSL versions support her β€” the original page lays this out in a big table, so let me translate it into something readable 🌈

  • 1.10 β€” nope, - πŸ’€
  • 1.20 β€” nope, - πŸ’€
  • 1.30 β€” nope, - πŸ’€
  • 1.40 β€” nope, - πŸ’€
  • 1.50 β€” nope, - πŸ’€
  • 3.30 β€” nope, - πŸ’€
  • 4.00 β€” nope, - πŸ’€
  • 4.10 β€” nope, - πŸ’€
  • 4.20 β€” nope, - πŸ’€
  • 4.30 β€” YES, βœ” πŸŽ‰
  • 4.40 β€” YES, βœ” πŸŽ‰
  • 4.50 β€” YES, βœ” πŸŽ‰

so the variable name row is gl_WorkGroupID and the OpenGL Shading Language Version columns are the ones above β€” she shows up starting at 4.30 and stays iconic through 4.50 πŸ’–


🧚 SEE ALSO 🧚

  • gl_NumWorkGroups()
  • gl_WorkGroupID()
  • gl_LocalInvocationID()

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 a wrap, bestie 🫢 this absolute icon of a page is sourced from [FIXME: source] and dated 08/09/2021 β€” go forth and dispatch those workgroups responsibly πŸ’œπŸŽ€

πŸ“¦ where this page comes from