GL_PATCHVERTICESIN(3G)

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

okay so this is a page from the 3G manual section (the header literally says GL_PATCHVERTICESIN(3G), and it's tagged [FIXME: manual] up top, which is giving "work in progress but make it fashion" πŸŽ€). Anyway, this is about one specific built-in shader variable, and honestly? she's niche but she's iconic. let's get into it.


✨ NAME ✨

gl_PatchVerticesIn β€” she holds the number of vertices in the current patch. that's it, that's the whole job, and she does it flawlessly πŸ‘‘


🌸 DECLARATION 🌸

in int gl_PatchVerticesIn ;

like yes she's an in int, no you cannot write to her, mind your business bestie πŸ’…

side note: in the original page this line is literally glued to the next heading β€” .SH "DESCRIPTION" is stuck right on the end with no space, gl_PatchVerticesIn ;.SH "DESCRIPTION" 😭 not me noticing the formatting crimes. we keep the facts, we fix the vibes.

πŸ¦‹ DESCRIPTION πŸ¦‹

so. she's only available in the tessellation control and tessellation evaluation languages β€” if you're not in a tess shader, she's not in the group chat, periodt.

inside those shaders, gl_PatchVerticesIn contains the number of vertices in the input being processed by the shader.

and here's the lowkey important part: a single tessellation control shader or tessellation evaluation shader can read patches of differing sizes. so the value of gl_PatchVerticesIn may differ between patches. do not assume it's a constant for the whole draw call, bestie, because she said what she said πŸ”₯

(also, fair warning: the original text spells it gl_PatchVertexIn in that last sentence β€” no s before In. that's a typo in the manpage itself, we're preserving it here for accuracy, don't come for me πŸ™ˆ)


πŸ‘‘ VERSION SUPPORT πŸ‘‘

the original page ships this as a big fancy boxed table. tables don't render here, so here it is as a list instead β€” exact same info, exact same βœ” and – marks, no cap. the columns were the OpenGL Shading Language Version, and the row is the variable gl_PatchVerticesIn:

  • 1.10 β€” βœ— (marked -)
  • 1.20 β€” βœ— (marked -)
  • 1.30 β€” βœ— (marked -)
  • 1.40 β€” βœ— (marked -)
  • 1.50 β€” βœ— (marked -)
  • 3.30 β€” βœ— (marked -)
  • 4.00 β€” βœ” supported
  • 4.10 β€” βœ” supported
  • 4.20 β€” βœ” supported
  • 4.30 β€” βœ” supported
  • 4.40 β€” βœ” supported
  • 4.50 β€” βœ” supported

so she showed up in 4.00 and never left. glow up at 4.00, still booked and busy at 4.50. the way that consistency… we love to see it 🌈


🌟 SEE ALSO 🌟

go read her friends, they're all in the tessellation friend group and they're all icons:

  • gl_TessLevelOuter()
  • gl_TessLevelInner()
  • gl_TessCoord()

Copyright Β© 2011-2014 Khronos Group.

and the full legal bit, verbatim energy: this material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999, at http://opencontent.org/openpub/.

then the page repeats the copyright line one more time, because apparently once wasn't enough:

Copyright Β© 2011-2014 Khronos Group

(the original really does have two separate COPYRIGHT sections, back to back. iconic behavior honestly πŸ’€)


and that's the page!! mwah 🫢

ok final sign-off: the footer down at the bottom was [FIXME: source] and the date 08/09/2021 β€” so yes, this documentation was last touched on 08/09/2021, source still a FIXME, and the manpage name on both ends is GL_PATCHVERTICESIN(3G). she's a little unfinished and we love her for it. go tessellate something cute. bye bestie πŸ’œβœ¨πŸŽ€
πŸ“¦ where this page comes from