1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE book PUBLIC
"-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
3 "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
4 <refentry id=
"glGetProgramResourceIndex">
9 <holder>Khronos Group
</holder>
12 <refentrytitle>glGetProgramResourceIndex
</refentrytitle>
13 <manvolnum>3G
</manvolnum>
16 <refname>glGetProgramResourceIndex
</refname>
17 <refpurpose>query the index of a named resource within a program
</refpurpose>
19 <refsynopsisdiv><title>C Specification
</title>
22 <funcdef>GLuint
<function>glGetProgramResourceIndex
</function></funcdef>
23 <paramdef>GLuint
<parameter>program
</parameter></paramdef>
24 <paramdef>GLenum
<parameter>programInterface
</parameter></paramdef>
25 <paramdef>const char *
<parameter>name
</parameter></paramdef>
29 <refsect1 id=
"parameters"><title>Parameters
</title>
32 <term><parameter>program
</parameter></term>
35 The name of a program object whose resources to query.
40 <term><parameter>programInterface
</parameter></term>
43 A token identifying the interface within
<parameter>program
</parameter> containing the resource named
<parameter>name
</parameter>.
48 <term><parameter>name
</parameter></term>
51 The name of the resource to query the index of.
57 <refsect1 id=
"description"><title>Description
</title>
59 <function>glGetProgramResourceIndex
</function> returns the unsigned
60 integer index assigned to a resource named
<parameter>name
</parameter> in
61 the interface type
<parameter>programInterface
</parameter> of program object
<parameter>program
</parameter>.
64 <parameter>program
</parameter> must be the name of an existing program object.
<parameter>programInterface
</parameter>
65 is the name of the interface within
<parameter>program
</parameter> which contains the resource named
66 <parameter>name
</parameter>and must be one of the following
71 <term><constant>GL_UNIFORM
</constant></term>
74 The query is targeted at the set of active uniforms within
<parameter>program
</parameter>.
79 <term><constant>GL_UNIFORM_BLOCK
</constant></term>
82 The query is targeted at the set of active uniform blocks within
<parameter>program
</parameter>.
87 <term><constant>GL_PROGRAM_INPUT
</constant></term>
90 The query is targeted at the set of active input variables used by the first shader stage of
<parameter>program
</parameter>.
91 If
<parameter>program
</parameter> contains multiple shader stages then input variables from any stage other than the first
92 will not be enumerated.
97 <term><constant>GL_PROGRAM_OUTPUT
</constant></term>
100 The query is targeted at the set of active output variables produced by the last shader stage of
<parameter>program
</parameter>.
101 If
<parameter>program
</parameter> contains multiple shader stages then output variables from any stage other than the last
102 will not be enumerated.
107 <term><constant>GL_VERTEX_SUBROUTINE
</constant></term>,
108 <term><constant>GL_TESS_CONTROL_SUBROUTINE
</constant></term>,
109 <term><constant>GL_TESS_EVALUATION_SUBROUTINE
</constant></term>,
110 <term><constant>GL_GEOMETRY_SUBROUTINE
</constant></term>,
111 <term><constant>GL_FRAGMENT_SUBROUTINE
</constant></term>,
112 <term><constant>GL_COMPUTE_SUBROUTINE
</constant></term>
115 The query is targeted at the set of active subroutines for the vertex, tessellation control, tessellation evaluation,
116 geometry, fragment and compute shader stages of
<parameter>program
</parameter>, respectively.
121 <term><constant>GL_VERTEX_SUBROUTINE_UNIFORM
</constant></term>,
122 <term><constant>GL_TESS_CONTROL_SUBROUTINE_UNIFORM
</constant></term>,
123 <term><constant>GL_TESS_EVALUATION_SUBROUTINE_UNIFORM
</constant></term>,
124 <term><constant>GL_GEOMETRY_SUBROUTINE_UNIFORM
</constant></term>,
125 <term><constant>GL_FRAGMENT_SUBROUTINE_UNIFORM
</constant></term>,
126 <term><constant>GL_COMPUTE_SUBROUTINE_UNIFORM
</constant></term>
129 The query is targeted at the set of active subroutine uniform variables used by the vertex, tessellation control, tessellation evaluation,
130 geometry, fragment and compute shader stages of
<parameter>program
</parameter>, respectively.
135 <term><constant>GL_TRANSFORM_FEEDBACK_VARYING
</constant></term>
138 The query is targeted at the set of output variables from the last non-fragment stage of
<parameter>program
</parameter> that would be
139 captured if transform feedback were active.
144 <term><constant>GL_BUFFER_VARIABLE
</constant></term>
147 The query is targeted at the set of active buffer variables used by
<parameter>program
</parameter>.
152 <term><constant>GL_SHADER_STORAGE_BLOCK
</constant></term>
155 The query is targeted at the set of active shader storage blocks used by
<parameter>program
</parameter>.
161 If
<parameter>name
</parameter> exactly matches the name string of one of the active resources
162 for
<parameter>programInterface
</parameter>, the index of the matched resource is returned.
163 Additionally, if
<parameter>name
</parameter> would exactly match the name string of an active
164 resource if
"[0]" were appended to
<parameter>name
</parameter>, the index of the matched
165 resource is returned. Otherwise,
<parameter>name
</parameter> is considered not to be the name
166 of an active resource, and
<constant>GL_INVALID_INDEX
</constant> is returned.
169 For the interface
<constant>GL_TRANSFORM_FEEDBACK_VARYING
</constant>, the value
<constant>GL_INVALID_INDEX
</constant>
170 should be returned when querying the index assigned to the special names
171 <code>gl_NextBuffer
</code>,
<code>gl_SkipComponents1
</code>,
<code>gl_SkipComponents2
</code>,
172 <code>gl_SkipComponents3
</code>, or
<code>gl_SkipComponents4
</code>.
175 <refsect1 id=
"errors"><title>Errors
</title>
177 <constant>GL_INVALID_ENUM
</constant> is generated if
<parameter>programInterface
</parameter>
178 is not one of the accepted interface types.
181 Although not an error,
<constant>GL_INVALID_INDEX
</constant> is returned if
<parameter>name
</parameter>
182 is not the name of a resource within the interface identified by
<parameter>programInterface
</parameter>.
185 <refsect1 id=
"seealso"><title>See Also
</title>
187 <citerefentry><refentrytitle>glGetProgramResourceName
</refentrytitle></citerefentry>,
188 <citerefentry><refentrytitle>glGetGetProgramResource
</refentrytitle></citerefentry>,
189 <citerefentry><refentrytitle>glGetProgramResourceLocation
</refentrytitle></citerefentry>,
190 <citerefentry><refentrytitle>glGetProgramResourceLocationIndex
</refentrytitle></citerefentry>.
193 <refsect1 id=
"Copyright"><title>Copyright
</title>
195 Copyright
<trademark class=
"copyright"></trademark> 2012 Khronos Group.
196 This material may be distributed subject to the terms and conditions set forth in
197 the Open Publication License, v
1.0,
8 June
1999.
198 <ulink url=
"http://opencontent.org/openpub/">http://opencontent.org/openpub/
</ulink>.