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=
"glGetProgramResourceName">
9 <holder>Khronos Group
</holder>
12 <refentrytitle>glGetProgramResourceName
</refentrytitle>
13 <manvolnum>3G
</manvolnum>
16 <refname>glGetProgramResourceName
</refname>
17 <refpurpose>query the name of an indexed resource within a program
</refpurpose>
19 <refsynopsisdiv><title>C Specification
</title>
22 <funcdef>void
<function>glGetProgramResourceName
</function></funcdef>
23 <paramdef>GLuint
<parameter>program
</parameter></paramdef>
24 <paramdef>GLenum
<parameter>programInterface
</parameter></paramdef>
25 <paramdef>GLuint
<parameter>index
</parameter></paramdef>
26 <paramdef>GLsizei
<parameter>bufSize
</parameter></paramdef>
27 <paramdef>GLsizei *
<parameter>length
</parameter></paramdef>
28 <paramdef>char *
<parameter>name
</parameter></paramdef>
32 <refsect1 id=
"parameters"><title>Parameters
</title>
35 <term><parameter>program
</parameter></term>
38 The name of a program object whose resources to query.
43 <term><parameter>programInterface
</parameter></term>
46 A token identifying the interface within
<parameter>program
</parameter> containing the indexed resource.
51 <term><parameter>index
</parameter></term>
54 The index of the resource within
<parameter>programInterface
</parameter> of
<parameter>program
</parameter>.
59 <term><parameter>bufSize
</parameter></term>
62 The size of the character array whose address is given by
<parameter>name
</parameter>.
67 <term><parameter>length
</parameter></term>
70 The address of a variable which will receive the length of the resource name.
75 <term><parameter>name
</parameter></term>
78 The address of a character array into which will be written the name of the resource.
84 <refsect1 id=
"description"><title>Description
</title>
86 <function>glGetProgramResourceName
</function> retrieves the name string
87 assigned to the single active resource with an index of
<parameter>index
</parameter>
88 in the interface
<parameter>programInterface
</parameter> of program object
89 <parameter>program
</parameter>.
<parameter>index
</parameter> must be less than
90 the number of entries in the active resource list for
<parameter>programInterface
</parameter>.
93 <parameter>program
</parameter> must be the name of an existing program object.
<parameter>programInterface
</parameter>
94 is the name of the interface within
<parameter>program
</parameter> which contains the resource and must be one of the following
99 <term><constant>GL_UNIFORM
</constant></term>
102 The query is targeted at the set of active uniforms within
<parameter>program
</parameter>.
107 <term><constant>GL_UNIFORM_BLOCK
</constant></term>
110 The query is targeted at the set of active uniform blocks within
<parameter>program
</parameter>.
115 <term><constant>GL_PROGRAM_INPUT
</constant></term>
118 The query is targeted at the set of active input variables used by the first shader stage of
<parameter>program
</parameter>.
119 If
<parameter>program
</parameter> contains multiple shader stages then input variables from any stage other than the first
120 will not be enumerated.
125 <term><constant>GL_PROGRAM_OUTPUT
</constant></term>
128 The query is targeted at the set of active output variables produced by the last shader stage of
<parameter>program
</parameter>.
129 If
<parameter>program
</parameter> contains multiple shader stages then output variables from any stage other than the last
130 will not be enumerated.
135 <term><constant>GL_VERTEX_SUBROUTINE
</constant></term>,
136 <term><constant>GL_TESS_CONTROL_SUBROUTINE
</constant></term>,
137 <term><constant>GL_TESS_EVALUATION_SUBROUTINE
</constant></term>,
138 <term><constant>GL_GEOMETRY_SUBROUTINE
</constant></term>,
139 <term><constant>GL_FRAGMENT_SUBROUTINE
</constant></term>,
140 <term><constant>GL_COMPUTE_SUBROUTINE
</constant></term>
143 The query is targeted at the set of active subroutines for the vertex, tessellation control, tessellation evaluation,
144 geometry, fragment and compute shader stages of
<parameter>program
</parameter>, respectively.
149 <term><constant>GL_VERTEX_SUBROUTINE_UNIFORM
</constant></term>,
150 <term><constant>GL_TESS_CONTROL_SUBROUTINE_UNIFORM
</constant></term>,
151 <term><constant>GL_TESS_EVALUATION_SUBROUTINE_UNIFORM
</constant></term>,
152 <term><constant>GL_GEOMETRY_SUBROUTINE_UNIFORM
</constant></term>,
153 <term><constant>GL_FRAGMENT_SUBROUTINE_UNIFORM
</constant></term>,
154 <term><constant>GL_COMPUTE_SUBROUTINE_UNIFORM
</constant></term>
157 The query is targeted at the set of active subroutine uniform variables used by the vertex, tessellation control, tessellation evaluation,
158 geometry, fragment and compute shader stages of
<parameter>program
</parameter>, respectively.
163 <term><constant>GL_TRANSFORM_FEEDBACK_VARYING
</constant></term>
166 The query is targeted at the set of output variables from the last non-fragment stage of
<parameter>program
</parameter> that would be
167 captured if transform feedback were active.
172 <term><constant>GL_BUFFER_VARIABLE
</constant></term>
175 The query is targeted at the set of active buffer variables used by
<parameter>program
</parameter>.
180 <term><constant>GL_SHADER_STORAGE_BLOCK
</constant></term>
183 The query is targeted at the set of active shader storage blocks used by
<parameter>program
</parameter>.
189 The name string assigned to the active resource identified by
<parameter>index
</parameter> is
190 returned as a null-terminated string in the character array whose address is given in
<parameter>name
</parameter>. The actual number of
191 characters written into
<parameter>name
</parameter>, excluding the null terminator, is returned
192 in
<parameter>length
</parameter>. If
<parameter>length
</parameter> is NULL, no length is returned. The maximum
193 number of characters that may be written into
<parameter>name
</parameter>, including the null
194 terminator, is specified by
<parameter>bufSize
</parameter>. If the length of the name string
195 <emphasis>including the null terminator
</emphasis> is greater than
<parameter>bufSize
</parameter>, the first
196 <parameter>bufSize
</parameter>-
1 characters of the name string will be written to
<parameter>name
</parameter>,
197 followed by a null terminator. If
<parameter>bufSize
</parameter> is zero, no error will be
198 generated but no characters will be written to
<parameter>name
</parameter>. The length of the
199 longest name string for
<parameter>programInterface
</parameter>>, including a null terminator,
200 can be queried by calling
<citerefentry><refentrytitle>glGetProgramInterface
</refentrytitle></citerefentry> with a
<parameter>pname
</parameter> of
201 <constant>GL_MAX_NAME_LENGTH
</constant>.
204 <refsect1 id=
"errors"><title>Errors
</title>
206 <constant>GL_INVALID_ENUM
</constant> is generated if
<parameter>programInterface
</parameter>
207 is not one of the accepted interface types.
210 <constant>GL_INVALID_VALUE
</constant> is generated if
<parameter>progam
</parameter> is not
211 the name of an existing program.
214 <constant>GL_INVALID_VALUE
</constant> is generated if
<parameter>index
</parameter> is greater
215 than or equal to the number of entries in the active resource list for
216 <parameter>programInterface
</parameter>.
219 <refsect1 id=
"seealso"><title>See Also
</title>
221 <citerefentry><refentrytitle>glGetProgramResourceIndex
</refentrytitle></citerefentry>,
222 <citerefentry><refentrytitle>glGetGetProgramResource
</refentrytitle></citerefentry>,
223 <citerefentry><refentrytitle>glGetProgramResourceLocation
</refentrytitle></citerefentry>,
224 <citerefentry><refentrytitle>glGetProgramResourceLocationIndex
</refentrytitle></citerefentry>.
227 <refsect1 id=
"Copyright"><title>Copyright
</title>
229 Copyright
<trademark class=
"copyright"></trademark> 2012 Khronos Group.
230 This material may be distributed subject to the terms and conditions set forth in
231 the Open Publication License, v
1.0,
8 June
1999.
232 <ulink url=
"http://opencontent.org/openpub/">http://opencontent.org/openpub/
</ulink>.