GLGETPROGRAMRESOURCE(3G)

πŸ’… NAME πŸ’…

Okay bestie, welcome to GLGETPROGRAMRESOURCE(3G) β€” the manual page for glGetProgramResourceIndex, aka the call that asks β€œhey program, what’s the index of this named resource in this interface?” πŸŽ€

✨ C SPECIFICATION ✨

GLuint glGetProgramResourceIndex(GLuint program,
                                 GLenum programInterface,
                                 const char * name);

πŸŽ€ PARAMETERS πŸŽ€

  • program β€” the name of a program object whose resources you want to query. Like, which program are we snooping through? πŸ‘€
  • programInterface β€” a token identifying the interface inside program that contains the resource named name. It’s giving β€œwhich lil section are we checking?” energy.
  • name β€” the name of the resource whose index you’re trying to find. Slay, specific. πŸ’…

πŸ¦‹ DESCRIPTION πŸ¦‹

glGetProgramResourceIndex returns the unsigned integer index assigned to a resource named name in the interface type programInterface of program object program. It’s giving β€œresource index lookup, but make it OpenGL.” ✨

program must be the name of an existing program object. programInterface is the name of the interface within program which contains the resource named name and must be one of these values β€” no improvising, 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_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. First stage only, periodt.
  • GL_PROGRAM_OUTPUT β€” the query is targeted at the set of active output variables produced by the last shader stage of program. If program contains multiple shader stages then output variables from any stage other than the last will not be enumerated. Last stage main character energy only.
  • 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. Respectively is doing a lot of work there, but okay πŸ’…
  • 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. Subroutine uniforms, but make it stage-specific. 🌈
  • 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. β€œWould be captured” is the key vibe.
  • 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.
  • 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.

If name exactly matches the name string of one of the active resources for programInterface, the index of the matched resource is returned. Additionally, if name would exactly match the name string of an active resource if "[0]" were appended to name, the index of the matched resource is returned. Otherwise, name is considered not to be the name of an active resource, and GL_INVALID_INDEX is returned. No match, no index, bestie. πŸ™ˆ

For the interface GL_TRANSFORM_FEEDBACK_VARYING, the value GL_INVALID_INDEX should be returned when querying the index assigned to the special names gl_NextBuffer, gl_SkipComponents1, gl_SkipComponents2, gl_SkipComponents3, or gl_SkipComponents4. Those special names are not getting a cute little index from this call. πŸ’€

πŸ”₯ ERRORS πŸ”₯

  • GL_INVALID_ENUM is generated if programInterface is not one of the accepted interface types. Like, if you made up a token? Not iconic.
  • GL_INVALID_ENUM is generated if 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. So don’t come for them with a name lookup, okay?
  • Although not an error, GL_INVALID_INDEX is returned if name is not the name of a resource within the interface identified by programInterface. It’s not a scream, it’s just a β€œno index for you” moment.

πŸ‘‘ VERSION SUPPORT πŸ‘‘

Version support for glGetProgramResourceIndex β€” the function/feature name in the table β€” is fully here, just in cute list form: 🌟

  • OpenGL 2.0: -
  • OpenGL 2.1: -
  • OpenGL 3.0: -
  • OpenGL 3.1: -
  • OpenGL 3.2: -
  • OpenGL 3.3: -
  • OpenGL 4.0: -
  • OpenGL 4.1: -
  • OpenGL 4.2: -
  • OpenGL 4.3: βœ”
  • OpenGL 4.4: βœ”
  • OpenGL 4.5: βœ”

So yeah, it’s a 4.3+ girlie. No cap. πŸ”₯

🌈 SEE ALSO 🌈

  • glGetProgramResourceName()
  • glGetProgramResource()
  • glGetProgramResourceLocation()
  • glGetProgramResourceLocationIndex()

These are the besties to check next. 🫢

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


Okay bye bestie! This page came from [FIXME: source], version/date 08/09/2021, and the manual name stamp is GLGETPROGRAMRESOURCE(3G). Stay slaying those resource indexes! πŸ’…βœ¨

πŸ“¦ where this page comes from