GL_INVOCATIONID(3G)

πŸ’… GL_INVOCATIONID (3G) β€” the manual page, but make it make sense

okay bestie, so this is the manual page for gl_InvocationID β€” it lives in the OpenGL Shading Language docs (the header literally says [FIXME: manual], which is giving "we'll fix it later, and later never came" 😭). Anyway, it's short, it's iconic, let's go 🫢


✨ NAME ✨

gl_InvocationID β€” it's the variable that holds the invocation index of whatever shader invocation is currently running, no cap πŸ‘‘


πŸŽ€ DECLARATION πŸŽ€

Here's the literal declaration, exactly as written, don't touch it:

in int gl_InvocationID ;

πŸ’– DESCRIPTION πŸ’–

So the whole personality of this variable changes depending on which shader language you're in. Two vibes, one variable:

🧚 In the tessellation control language

gl_InvocationID holds the index of the output patch vertex that got assigned to the shader invocation. It's handed an integer value in the range [0, N-1], where N is the number of output patch vertices.

πŸ¦‹ In the geometry language

gl_InvocationID identifies the invocation number that got assigned to the geometry shader invocation. It's handed an integer value in the range [0, N-1], where N is the number of geometry shader invocations per primitive.

TL;DR: same <pink>int variable name, two completely different job descriptions depending on where you're standing. lowkey iconic ✨


🌈 VERSION SUPPORT 🌈

Here's the vibe check across every OpenGL Shading Language version β€” βœ” means it's there, - means she has not arrived yet πŸ’€

  • Variable name: gl_InvocationID
    • 1.10 β€” -
    • 1.20 β€” -
    • 1.30 β€” -
    • 1.40 β€” -
    • 1.50 β€” βœ”
    • 3.30 β€” βœ”
    • 4.00 β€” βœ”
    • 4.10 β€” βœ”
    • 4.20 β€” βœ”
    • 4.30 β€” βœ”
    • 4.40 β€” βœ”
    • 4.50 β€” βœ”
[1] Versions 1.50 to 3.30 β€” geometry shaders only. so clock that πŸ“Œ she was exclusive before she went mainstream, iykyk

πŸ‘€ SEE ALSO πŸ‘€

Go give these a look too, they're in the same friend group:

  • gl_InstanceID()

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, you ate that πŸ“ fr fr. quick cute sign-off: this masterpiece is sourced from [FIXME: source], dated 08/09/2021, and it's GL_INVOCATIONID(3G) all the way down. mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from