GL_SAMPLEID(3G)
π GL_SAMPLEID (3G) β the manual, bestie edition β¨
okay so real talk, we're in the 3G manual and the header on this thing literally says GL_SAMPLEID(3G) with a [FIXME: manual] in the middle, so likeβ¦ that's the vibe we're working with π«Ά
πΈ NAME πΈ
gl_SampleID β the variable that holds the index of the sample you're currently processing, no cap π
β¨ DECLARATION β¨
in int gl_SampleID ;
π DESCRIPTION π
So gl_SampleID is a fragment language input variable, and it contains the index of the sample that's currently being processed. Iconic. It lives in the range 0 to gl_NumSamples() - 1, where gl_NumSamples() is the total number of samples in each fragment for the current framebuffer β which means it's 1 if you're rendering to a non-multisample buffer π¦
β οΈ heads up bestie: any static use of this variable in a fragment shader causes the entire shader to be evaluated per-sample rather than per-fragment. the whole thing. not a drill π
When you're rendering to a non-multisample buffer, or if multisample rasterization is disabled, gl_SampleID will always be zero. and just so we're clear β gl_NumSamples() is the sample count of the framebuffer regardless of whether multisample rasterization is enabled or not. two separate things, don't mix them up π
π₯ VERSION SUPPORT π₯
the table energy, but make it a list β this is which OpenGL Shading Language Version numbers actually have gl_SampleID:
1.10β nope π1.20β nope1.30β nope1.40β nope1.50β nope3.30β nope4.00β βοΈ yes queen π4.10β βοΈ4.20β βοΈ4.30β βοΈ4.40β βοΈ4.50β βοΈ
so like, 4.00 and up only. everything before that is giving "not invited to the party" π
π SEE ALSO π
gl_SamplePosition()gl_NumSamples()
go read those too, iykyk π
π COPYRIGHT π
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 (yes, again) π
Copyright Β© 2011-2014 Khronos Group
okay that's the whole page, bestie! and for the cute sign-off: this one came from [FIXME: source] and it's dated 08/09/2021 β so it's a lil vintage, but she still slays βπΈπ
π¦ where this page comes from
- centos-stream 9: gl-manpages 1.1-24.20190306.el9 Β· MIT and Open Publication
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms