GLGETACTIVEUNIFORMBL(3G)
π NAME π
okay so glGetActiveUniformBlock β literally the function that lets you query info about an active uniform block. that's it, that's the whole vibe check π
this one lives in the 3G manual, bestie, so keep that in mind β¨
β¨ C SPECIFICATION β¨
void glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex,
GLenum pname, GLint *params);
like, copy that exactly, no cap π
π«Ά PARAMETERS π«Ά
programβ specifies the name of a program containing the uniform block. that's your program object, bestie πuniformBlockIndexβ specifies the index of the uniform block withinprogram. yeah, the index, not the name π’pnameβ specifies the name of the parameter to query. this is the "what do you wanna know" slot πΈparamsβ specifies the address of a variable to receive the result of the query. this is where the answer goes, so point it somewhere real π―
π₯ DESCRIPTION π₯
okay so glGetActiveUniformBlockiv retrieves information about an active uniform block within program. literally its whole job π
program must be the name of a program object for which the command glLinkProgram() must have been called in the past β although it is not required that glLinkProgram() must have succeeded. and yes, the link could have failed because the number of active uniforms exceeded the limit. messy, but valid π
uniformBlockIndex is an active uniform block index of program, and must be less than the value of GL_ACTIVE_UNIFORM_BLOCKS. mind that ceiling, bestie π§
upon success, the uniform block parameter(s) specified by pname are returned in params. if an error occurs, nothing will be written to params β like, zero, nada, ghosted π
π the pname menu, item by item π
if pname is GL_UNIFORM_BLOCK_BINDING, then the index of the uniform buffer binding point last selected by the uniform block specified by uniformBlockIndex for program is returned. if no uniform block has been previously specified, zero is returned. default 0, iconic π
if pname is GL_UNIFORM_BLOCK_DATA_SIZE, then the implementation-dependent minimum total buffer object size, in basic machine units, required to hold all active uniforms in the uniform block identified by uniformBlockIndex is returned. and listen β it is neither guaranteed nor expected that a given implementation will arrange uniform values as tightly packed in a buffer object. the exception to this is the std140 uniform block layout, which guarantees specific packing behavior and does not require the application to query for offsets and strides. in this case the minimum size may still be queried, even though it is determined in advance based only on the uniform block declaration. so yeah, std140 is the main character here π
if pname is GL_UNIFORM_BLOCK_NAME_LENGTH, then the total length (including the nul terminator) of the name of the uniform block identified by uniformBlockIndex is returned. including the nul terminator, don't forget that extra byte, bestie π
if pname is GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS, then the number of active uniforms in the uniform block identified by uniformBlockIndex is returned. a count, that's it π
if pname is GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES, then a list of the active uniform indices for the uniform block identified by uniformBlockIndex is returned. the number of elements that will be written to params is the value of GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS for uniformBlockIndex. so go query that count first, or you're gonna have a bad time π
if pname is GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER, GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER, GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER, GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER, GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER, or GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER then a boolean value indicating whether the uniform block identified by uniformBlockIndex is referenced by the vertex, tessellation control, tessellation evaluation, geometry, fragment or compute programming stages of program, respectively, is returned. yes, one boolean, and the order in that sentence maps to the order of the tokens. matching game, slay β
π ERRORS π
GL_INVALID_VALUEis generated ifuniformBlockIndexis greater than or equal to the value ofGL_ACTIVE_UNIFORM_BLOCKSor is not the index of an active uniform block inprogram. out of bounds? nope π«GL_INVALID_ENUMis generated ifpnameis not one of the accepted tokens. that token's not on the list, babe πGL_INVALID_OPERATIONis generated ifprogramis not the name of a program object for whichglLinkProgram()has been called in the past. no link, no query, periodt π
πΈ NOTES πΈ
glGetActiveUniformBlockiv is available only if the GL version is 3.1 or greater. age check, sorry π
GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER is accepted only if the GL version is 4.3 or greater. that one's a newer-token privilege, iykyk π
π VERSION SUPPORT π
here's the vibe: the function is glGetActiveUniformBlockiv and its support across the OpenGL versions goes like this π«
2.0β-nope π2.1β-nope π3.0β-nope π3.1β β yes bestie π3.2β β π3.3β β π4.0β β π4.1β β π4.2β β π4.3β β π4.4β β π4.5β β π
so it pops off starting at 3.1 and never stops. ate and left no crumbs π
π¦ SEE ALSO π¦
glGetActiveUniformBlockName(), glGetUniformBlockIndex(), glLinkProgram() β go read those too, they're the friend group π«Ά
π 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
ok that's the whole page, bestie, you're officially caught up π β¨
and a lil sign-off: this cutie came from [FIXME: source], dated 08/09/2021, filed under GLGETACTIVEUNIFORMBL(3G). mwah ππ
π¦ 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