GL_SAMPLEMASK(3G)
π NAME
gl_SampleMask β bestie, this one specifies the sample coverage mask for the current fragment β¨
(also hi, you're reading the GL_SAMPLEMASK(3G) page, welcome π«Ά)
π DECLARATION
out int gl_SampleMask[] ;
that's literally it. that's the whole declaration. icon.
β¨ DESCRIPTION
okay so gl_SampleMask is a fragment language output array π₯ and its whole job is setting the sample mask for the fragment being processed. simple as that.
here's the tea though π β coverage for the current fragment becomes the logical AND of the coverage mask and the output gl_SampleMask. so like, if you set a bit in gl_SampleMask to zero, that corresponding sample gets treated as uncovered for the purposes of multisample fragment operations. bye sample π
but listen: setting sample mask bits back to one will never enable samples not covered by the original primitive. that's a one-way street, no take-backs, no cap π ββοΈ
the indexing, bestie: bit B of mask gl_SampleMask[M] corresponds to sample 32 * M + B. write that down π
this array must be sized in the fragment shader β either implicitly or explicitly β to be the same size as the implementation-dependent maximum sample-mask (as an array of 32-bit elements), determined by the maximum number of samples. okay so it's giving "size it right or perish" π
and now the spicy parts πΆοΈ:
- If the fragment shader statically assigns a value to
gl_SampleMask, the sample mask will be undefined for any array elements of any fragment shader invocation that fails to assign a value. (yes, undefined. we don't love that for you π) - If a shader does not statically assign a value to
gl_SampleMask, the sample mask has no effect on the processing of a fragment. nothing. zero. it's just vibes. - If the fragment shader is being evaluated at any frequency other than per-fragment, bits within the sample mask not corresponding to the current fragment shader invocation are ignored. π
π VERSION SUPPORT
the version support table, but make it a vibe check π β variable name gl_SampleMask, versus OpenGL Shading Language Version:
- 1.10 β
-(nope) - 1.20 β
-(nope) - 1.30 β
-(nope) - 1.40 β
-(nope) - 1.50 β
-(nope) - 3.30 β
-(still nope) - 4.00 β
β(ATE π ) - 4.10 β
β - 4.20 β
β - 4.30 β
β - 4.40 β
β - 4.50 β
β
so basically 4.00 and onward, she's booked and busy π¦ periodt.
πΈ SEE ALSO
go read these next, bestie, they're all in the family π«Ά
gl_SampleMaskIn()gl_SampleID()gl_SamplePosition()gl_FragCoord()
π 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 (again, yes really)
Copyright Β© 2011-2014 Khronos Group
π§ mwah, that's the whole page! it came from[FIXME: source]and it's dated 08/09/2021, so if you're citing it in your essay, that's the receipt π stay slay, go readgl_SampleMaskIn()next, bye bestie! πβ¨
π¦ 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