GLGETPROGRAMINTERFAC(3G)

🌸 GLGETPROGRAMINTERFAC(3G) β€” glGetProgramInterface 🌸

okay bestie, welcome to a section 3G man page (the manual slot up top literally just says [FIXME: manual], not my fault, don't come for me πŸ’€). This one's about glGetProgramInterface β€” the little query function that lets you peek at what's inside a program object. Let's get into it 🫢


✨ NAME ✨

glGetProgramInterface β€” query a property of an interface in a program.

That's the whole vibe: you got a program, it's got interfaces, you wanna know a property of one of them. Periodt. πŸ’…


✨ C SPECIFICATION ✨

void glGetProgramInterfaceiv(GLuint program, GLenum programInterface,
                             GLenum pname, GLint * params);

yeah she's iv at the end there, meaning you're getting integers back, no floats invited to the party πŸŽ€


✨ PARAMETERS ✨

  • program β€” the name of a program object whose interface you wanna query. like, the actual program. you need one. πŸ¦‹
  • programInterface β€” a token identifying which interface inside program you're looking at.
  • pname β€” the name of the parameter within programInterface you're asking about.
  • params β€” the address of a variable where the value of pname for that program interface is gonna land.

✨ DESCRIPTION ✨

So glGetProgramInterfaceiv queries the property of the interface identified by programInterface in program, and the property name you're asking about is pname. Iconic, straightforward, no notes. 🌟

program must be the name of an existing program object. non-negotiable.

programInterface is the name of the interface within program you wanna query, and it has to be one of the following, bestie:

  • GL_UNIFORM β€” the query is targeted at the set of active uniforms within program.
  • GL_UNIFORM_BLOCK β€” the query is targeted at the set of active uniform blocks within program.
  • GL_ATOMIC_COUNTER_BUFFER β€” the query is targeted at the set of active atomic counter buffer binding points within program.
  • GL_PROGRAM_INPUT β€” the query is targeted at the set of active input variables used by the first shader stage of program. ⚠️ if program contains multiple shader stages, then input variables from any stage other than the first will not be enumerated. rude but true.
  • GL_PROGRAM_OUTPUT β€” the query is targeted at the set of active output variables produced by the last shader stage of program. same deal: if program contains multiple shader stages, output variables from any stage other than the last will not be enumerated. 😭
  • GL_VERTEX_SUBROUTINE, GL_TESS_CONTROL_SUBROUTINE, GL_TESS_EVALUATION_SUBROUTINE, GL_GEOMETRY_SUBROUTINE, GL_FRAGMENT_SUBROUTINE, GL_COMPUTE_SUBROUTINE β€” the query is targeted at the set of active subroutines for the vertex, tessellation control, tessellation evaluation, geometry, fragment and compute shader stages of program, respectively. (in that order, she's matching them up for you πŸ’–)
  • GL_VERTEX_SUBROUTINE_UNIFORM, GL_TESS_CONTROL_SUBROUTINE_UNIFORM, GL_TESS_EVALUATION_SUBROUTINE_UNIFORM, GL_GEOMETRY_SUBROUTINE_UNIFORM, GL_FRAGMENT_SUBROUTINE_UNIFORM, GL_COMPUTE_SUBROUTINE_UNIFORM β€” the query is targeted at the set of active subroutine uniform variables used by the vertex, tessellation control, tessellation evaluation, geometry, fragment and compute shader stages of program, respectively. again: same order, respectively, iykyk ✨
  • GL_TRANSFORM_FEEDBACK_VARYING β€” the query is targeted at the set of output variables from the last non-fragment stage of program that would be captured if transform feedback were active.
  • GL_BUFFER_VARIABLE β€” the query is targeted at the set of active buffer variables used by program.
  • GL_SHADER_STORAGE_BLOCK β€” the query is targeted at the set of active shader storage blocks used by program.
  • GL_TRANSFORM_FEEDBACK_BUFFER β€” the query is targeted at the set of active buffer binding points to which output variables in the GL_TRANSFORM_FEEDBACK_VARYING interface are written.

πŸŽ€ now, pname β€” the actual question you're asking πŸŽ€

pname identifies the property of programInterface to return in params. here's the roster:

  • If pname is GL_ACTIVE_RESOURCES β€” the value returned is the number of resources in the active resource list for programInterface. If the list of active resources for programInterface is empty, zero is returned. empty list, zero, we move on πŸ’…
  • If pname is GL_MAX_NAME_LENGTH β€” the value returned is the length of the longest active name string for an active resource in programInterface. this length includes an extra character for the null terminator (she's thorough πŸŽ€). If the list of active resources for programInterface is empty, zero is returned. 🚨 It is an error to specify GL_MAX_NAME_LENGTH when programInterface is GL_ATOMIC_COUNTER_BUFFER, because active atomic counter buffer resources are not assigned name strings.
  • If pname is GL_MAX_NUM_ACTIVE_VARIABLES β€” the value returned is the number of active variables belonging to the interface block or atomic counter buffer resource in programInterface with the most active variables. If the list of active resources for programInterface is empty, zero is returned. When pname is GL_MAX_NUM_ACTIVE_VARIABLES, programInterface must be GL_UNIFORM_BLOCK, GL_ATOMIC_COUNTER_BUFFER, or GL_SHADER_STORAGE_BLOCK. no exceptions, bestie.
  • If pname is GL_MAX_NUM_COMPATIBLE_SUBROUTINES β€” the value returned is the number of compatible subroutines belonging to the active subroutine uniform in programInterface with the most compatible subroutines. If the list of active resources for programInterface is empty, zero is returned. When pname is GL_MAX_NUM_COMPATIBLE_SUBROUTINES, programInterface must be one of GL_VERTEX_SUBROUTINE_UNIFORM, GL_TESS_CONTROL_SUBROUTINE_UNIFORM, GL_TESS_EVALUATION_SUBROUTINE_UNIFORM, GL_GEOMETRY_SUBROUTINE_UNIFORM, GL_FRAGMENT_SUBROUTINE_UNIFORM, or GL_COMPUTE_SUBROUTINE_UNIFORM.

⚠️ ERRORS ⚠️

bestie this is the part where you don't freestyle. read carefully:

  • GL_INVALID_ENUM is generated if identifier is not one of the accepted object types.
  • GL_INVALID_VALUE is generated if program is not the name of an existing sync object.
  • GL_INVALID_VALUE is generated if bufSize is zero.
  • GL_INVALID_OPERATION is generated if pname is GL_MAX_NAME_LENGTH and programInterface is GL_ATOMIC_COUNTER_BUFFER or GL_TRANSFORM_FEEDBACK_BUFFER, since active atomic counter and transform feedback buffer resources are not assigned name strings. 😀
  • GL_INVALID_OPERATION error is generated if pname is GL_MAX_NUM_ACTIVE_VARIABLES and programInterface is not GL_UNIFORM_BLOCK, GL_SHADER_STORAGE_BLOCK, GL_ATOMIC_COUNTER_BUFFER, or GL_TRANSFORM_FEEDBACK_BUFFER.
  • If not NULL, length and label should be addresses to which the client has write access β€” otherwise undefined behavior, including process termination, may occur. πŸ’€ yeah. that kind of undefined. do not play with that.
ok and yes, the page does say identifier, sync object, bufSize, length and label up there β€” those aren't in the parameter list, but I'm not about to edit the man page, I'm just the messenger 🫢 it's giving copy-paste from a sibling page, and we love her anyway.

✨ ASSOCIATED GETS ✨

glGet() with argument GL_MAX_LABEL_LENGTH. that's it, that's the list. slay. 🌈


πŸ‘‘ VERSION SUPPORT πŸ‘‘

the original hands you a whole grid here titled Function / Feature Name across the OpenGL Versions β€” I can't do tables in this chat so we're doing it as a list, and the info is identical, promise 🀞

  • OpenGL 2.0 β€” - (not supported)
  • OpenGL 2.1 β€” - (not supported)
  • OpenGL 3.0 β€” - (not supported)
  • OpenGL 3.1 β€” - (not supported)
  • OpenGL 3.2 β€” - (not supported)
  • OpenGL 3.3 β€” - (not supported)
  • OpenGL 4.0 β€” - (not supported)
  • OpenGL 4.1 β€” - (not supported)
  • OpenGL 4.2 β€” - (not supported)
  • OpenGL 4.3 β€” βœ” supported
  • OpenGL 4.4 β€” βœ” supported
  • OpenGL 4.5 β€” βœ” supported

so like… glGetProgramInterfaceiv shows up at 4.3 and stays. she's a late bloomer and honestly? main character energy. πŸ”₯


🌸 SEE ALSO 🌸

  • glPushDebugGroup()
  • glPopDebugGroup()
  • glObjectLabel()
  • glGetObjectLabel()

go read those next, bestie, that's the assignment πŸ“š


Copyright Β© 2013-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 Β© 2013-2014 Khronos Group


and that's the whole page, no cap πŸ’œ this was a section 3G number, source slot reads [FIXME: source], dated 08/09/2021 β€” thanks for reading, go touch grass and then go query some program interfaces, mwah πŸ§šβ€β™€οΈπŸ’–

πŸ“¦ where this page comes from