GLAPI/glGetProgramResourceIndex: Difference between revisions

From OpenGL Wiki
Jump to navigation Jump to search
m (Bot: Adding better formatting.)
Line 32: Line 32:
; {{enum|GL_PROGRAM_OUTPUT}}
; {{enum|GL_PROGRAM_OUTPUT}}
: The query is targeted at the set of active output variables produced by the last shader stage of {{param|program}}. If {{param|program}} contains multiple shader stages then output variables from any stage other than the last will not be enumerated.
: The query is targeted at the set of active output variables produced by the last shader stage of {{param|program}}. If {{param|program}} contains multiple shader stages then output variables from any stage other than the last will not be enumerated.
; {{enum|GL_VERTEX_SUBROUTINE}}{{enum|GL_TESS_CONTROL_SUBROUTINE}}{{enum|GL_TESS_EVALUATION_SUBROUTINE}}{{enum|GL_GEOMETRY_SUBROUTINE}}{{enum|GL_FRAGMENT_SUBROUTINE}}{{enum|GL_COMPUTE_SUBROUTINE}}
; {{enum|GL_VERTEX_SUBROUTINE}}, {{enum|GL_TESS_CONTROL_SUBROUTINE}}{{enum|GL_TESS_EVALUATION_SUBROUTINE}}, {{enum|GL_GEOMETRY_SUBROUTINE}}, {{enum|GL_FRAGMENT_SUBROUTINE}}, {{enum|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 {{param|program}}, respectively.
: The query is targeted at the set of active subroutines for the vertex, tessellation control, tessellation evaluation, geometry, fragment and compute shader stages of {{param|program}}, respectively.
; {{enum|GL_VERTEX_SUBROUTINE_UNIFORM}}{{enum|GL_TESS_CONTROL_SUBROUTINE_UNIFORM}}{{enum|GL_TESS_EVALUATION_SUBROUTINE_UNIFORM}}{{enum|GL_GEOMETRY_SUBROUTINE_UNIFORM}}{{enum|GL_FRAGMENT_SUBROUTINE_UNIFORM}}{{enum|GL_COMPUTE_SUBROUTINE_UNIFORM}}
; {{enum|GL_VERTEX_SUBROUTINE_UNIFORM}}, {{enum|GL_TESS_CONTROL_SUBROUTINE_UNIFORM}}, {{enum|GL_TESS_EVALUATION_SUBROUTINE_UNIFORM}}, {{enum|GL_GEOMETRY_SUBROUTINE_UNIFORM}}, {{enum|GL_FRAGMENT_SUBROUTINE_UNIFORM}}, {{enum|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 {{param|program}}, respectively.
: 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 {{param|program}}, respectively.
; {{enum|GL_TRANSFORM_FEEDBACK_VARYING}}
; {{enum|GL_TRANSFORM_FEEDBACK_VARYING}}
Line 42: Line 42:
; {{enum|GL_SHADER_STORAGE_BLOCK}}
; {{enum|GL_SHADER_STORAGE_BLOCK}}
: The query is targeted at the set of active shader storage blocks used by {{param|program}}.
: The query is targeted at the set of active shader storage blocks used by {{param|program}}.
If {{param|name}} exactly matches the name string of one of the active resources for {{param|programInterface}}, the index of the matched resource is returned. Additionally, if {{param|name}} would exactly match the name string of an active resource if "[0]" were appended to {{param|name}}, the index of the matched resource is returned. Otherwise, {{param|name}} is considered not to be the name of an active resource, and {{enum|GL_INVALID_INDEX}} is returned.
If {{param|name}} exactly matches the name string of one of the active resources for {{param|programInterface}}, the index of the matched resource is returned. Additionally, if {{param|name}} would exactly match the name string of an active resource if "[0]" were appended to {{param|name}}, the index of the matched resource is returned. Otherwise, {{param|name}} is considered not to be the name of an active resource, and {{enum|GL_INVALID_INDEX}} is returned.



Revision as of 01:48, 27 September 2012

glGetProgramResourceIndex
Core in version 4.6
Core since version 4.3
Core ARB extension ARB_program_interface_query

glGetProgramResourceIndex: query the index of a named resource within a program

Function Definition

 GLuint glGetProgramResourceIndex(GLuint program​, GLenum programInterface​, const char * name​);
program
The name of a program object whose resources to query.
programInterface
A token identifying the interface within program​ containing the resource named name​.
name
The name of the resource to query the index of.

Description

glGetProgramResourceIndex returns the unsigned integer index assigned to a resource named name​ in the interface type programInterface​ of program object program​.

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 the following values:

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.
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.
GL_VERTEX_SUBROUTINE, GL_TESS_CONTROL_SUBROUTINEGL_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.
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.
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​.

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.

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.

Errors

GL_INVALID_ENUM is generated if programInterface​ is not one of the accepted interface types.

Although not an error, GL_INVALID_INDEX is returned if name​ is not the name of a resource within the interface identified by programInterface​.

See Also

glGetProgramResourceName, glGetProgramResource, glGetProgramResourceLocation, glGetProgramResourceLocationIndex.

Copyright

Copyright © 2012 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/.