GLGETSUBROUTINEUNIFO(3G)
๐ โจ GLGETSUBROUTINEUNIFO(3G) โจ๐
okay so bestie, welcome to the 3G manual page, and no cap this one is a little baddie. sit down, grab a matcha ๐, and let's get into it.
๐ธ NAME ๐ธ
glGetSubroutineUniformLocation โ it literally retrieves the location of a subroutine uniform of a given shader stage within a program. that's it. that's the whole job. iconic behavior honestly ๐
๐ C SPECIFICATION ๐
GLint glGetSubroutineUniformLocation(GLuint program, GLenum shadertype,
const GLchar *name);
keep it verbatim bestie, don't touch the signature, she's perfect ๐
๐ฆ PARAMETERS ๐ฆ
programโ specifies the name of the program containing shader stage. like, which program are we even talking about, give her a name ๐ซถshadertypeโ specifies the shader stage from which to query for subroutine uniform index. and it must be one ofGL_VERTEX_SHADER,GL_TESS_CONTROL_SHADER,GL_TESS_EVALUATION_SHADER,GL_GEOMETRY_SHADERorGL_FRAGMENT_SHADER. no improvising, no freestyling, those are the options periodt ๐nameโ specifies the name of the subroutine uniform whose index to query. it's giving "tell me who you're looking for" โจ
๐ DESCRIPTION ๐
okay so glGetSubroutineUniformLocation returns the location of the subroutine uniform variable name in the shader stage of type shadertype attached to program, and its behavior is otherwise identical to glGetUniformLocation(). same energy, different function, iykyk ๐
now the important part, listen up ๐ข โ if name is not the name of a subroutine uniform in the shader stage, -1 is returned, but no error is generated. like she just shrugs and gives you a negative one, no drama, no exception, nothing ๐ญ
but if name is the name of a subroutine uniform in the shader stage, a value between zero and the value of GL_ACTIVE_SUBROUTINE_LOCATIONS minus one will be returned. lowkey math but stay with me ๐งฎ
subroutine locations are assigned using consecutive integers in the range from zero to the value of GL_ACTIVE_SUBROUTINE_LOCATIONS minus one for the shader stage. and for active subroutine uniforms declared as arrays, the declared array elements are assigned consecutive locations too. consecutive, consecutive, consecutive โ she does not skip numbers, that's the whole vibe ๐ฏ
๐ฅ ERRORS ๐ฅ
yes bestie, things can go wrong, here's the receipts:
GL_INVALID_ENUMis generated ifshadertypeorpnameis not one of the accepted values. (yes it sayspnamein the original, i'm just the messenger ๐)GL_INVALID_VALUEis generated ifprogramis not the name of an existing program object. like girl that program does not exist, stop playing ๐
โ ๏ธ fr fr read these before you ship, these errors are not a cute look in a debug session.
๐ VERSION SUPPORT ๐
the original is a big glossy table with a Function / Feature Name column, and the feature name is literally glGetSubroutineUniformLocation. so here's the tea in list form, every single version, nothing skipped ๐ซถ
- OpenGL 2.0 โ
-(nope) - OpenGL 2.1 โ
-(nope) - OpenGL 3.0 โ
-(nope) - OpenGL 3.1 โ
-(nope) - OpenGL 3.2 โ
-(nope) - OpenGL 3.3 โ
-(nope) - OpenGL 4.0 โ
โ(HERE SHE IS โญ) - OpenGL 4.1 โ
โ - OpenGL 4.2 โ
โ - OpenGL 4.3 โ
โ - OpenGL 4.4 โ
โ - OpenGL 4.5 โ
โ
so like, 2.0 through 3.3 said "not today", and 4.0 through 4.5 said "main character energy" ๐ โจ
๐ SEE ALSO ๐
go read these next, bestie, they're all in the group chat too ๐ซถ
glGetProgram()glGetActiveSubroutineUniform()glGetActiveSubroutineUniformName()glGetUniformLocation()
๐ COPYRIGHT ๐
Copyright ยฉ 2010-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 ยฉ 2010-2014 Khronos Group.
(both of them, bestie โ the original says it twice, so we say it twice, we don't skip lines in this house ๐)
and that's the whole page! the source line is [FIXME: source] and the date is 08/09/2021, which honestly is a lil vintage but she ate anyway. mwah, study up, ily, bye ๐ง๐
๐ฆ 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