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=
"glGetSubroutineIndex">
9 <holder>Khronos Group.
</holder>
12 <refentrytitle>glGetSubroutineIndex
</refentrytitle>
13 <manvolnum>3G
</manvolnum>
16 <refname>glGetSubroutineIndex
</refname>
17 <refpurpose>retrieve the index of a subroutine uniform of a given shader stage within a program
</refpurpose>
19 <refsynopsisdiv><title>C Specification
</title>
22 <funcdef>GLuint
<function>glGetSubroutineIndex
</function></funcdef>
23 <paramdef>GLuint
<parameter>program
</parameter></paramdef>
24 <paramdef>GLenum
<parameter>shadertype
</parameter></paramdef>
25 <paramdef>const GLchar *
<parameter>name
</parameter></paramdef>
29 <!-- eqn: ignoring delim $$ -->
30 <refsect1 id=
"parameters"><title>Parameters
</title>
33 <term><parameter>program
</parameter></term>
36 Specifies the name of the program containing shader stage.
41 <term><parameter>shadertype
</parameter></term>
44 Specifies the shader stage from which to query for subroutine uniform index.
45 <parameter>shadertype
</parameter>
46 must be one of
<constant>GL_VERTEX_SHADER
</constant>,
<constant>GL_TESS_CONTROL_SHADER
</constant>,
47 <constant>GL_TESS_EVALUATION_SHADER
</constant>,
<constant>GL_GEOMETRY_SHADER
</constant> or
48 <constant>GL_FRAGMENT_SHADER
</constant>.
53 <term><parameter>name
</parameter></term>
56 Specifies the name of the subroutine uniform whose index to query.
62 <refsect1 id=
"description"><title>Description
</title>
64 <function>glGetSubroutineIndex
</function> returns the index of a subroutine uniform within a shader stage attached to a program object.
65 <parameter>program
</parameter> contains the name of the program to which the shader is attached.
<parameter>shadertype
</parameter>
66 specifies the stage from which to query shader subroutine index.
<parameter>name
</parameter> contains the null-terminated
67 name of the subroutine uniform whose name to query.
70 If
<parameter>name
</parameter> is not the name of a subroutine uniform in the shader stage,
<constant>GL_INVALID_INDEX
</constant>
71 is returned, but no error is generated. If
<parameter>name
</parameter> is the name of a subroutine uniform in the shader stage,
72 a value between zero and the value of
<constant>GL_ACTIVE_SUBROUTINES
</constant> minus one will be returned. Subroutine indices
73 are assigned using consecutive integers in the range from zero to the value of
<constant>GL_ACTIVE_SUBROUTINES
</constant> minus
74 one for the shader stage.
77 <refsect1 id=
"errors"><title>Errors
</title>
79 <constant>GL_INVALID_ENUM
</constant> is generated if
<parameter>shadertype
</parameter> or
<parameter>pname
</parameter>
80 is not one of the accepted values.
83 <constant>GL_INVALID_VALUE
</constant> is generated if
<parameter>program
</parameter> is not the name of an
84 existing program object.
87 <refsect1 id=
"seealso"><title>See Also
</title>
89 <citerefentry><refentrytitle>glGetProgram
</refentrytitle></citerefentry>,
90 <citerefentry><refentrytitle>glGetActiveSubroutineUniform
</refentrytitle></citerefentry>,
91 <citerefentry><refentrytitle>glGetActiveSubroutineUniformName
</refentrytitle></citerefentry>
94 <refsect1 id=
"Copyright"><title>Copyright
</title>
96 Copyright
<trademark class=
"copyright"></trademark> 2010 Khronos Group.
97 This material may be distributed subject to the terms and conditions set forth in
98 the Open Publication License, v
1.0,
8 June
1999.
99 <ulink url=
"http://opencontent.org/openpub/">http://opencontent.org/openpub/
</ulink>.