2014-03-28 19:06:55 +00:00
|
|
|
|
<!DOCTYPE refentry [ <!ENTITY % mathent SYSTEM "math.ent"> %mathent; ]>
|
|
|
|
|
|
|
|
|
|
<!-- Converted by db4-upgrade version 1.1 -->
|
|
|
|
|
|
|
|
|
|
<refentry xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="glLinkProgram">
|
|
|
|
|
<info>
|
2013-11-03 11:43:50 +00:00
|
|
|
|
<copyright>
|
|
|
|
|
<year>2003-2005</year>
|
|
|
|
|
<holder>3Dlabs Inc. Ltd.</holder>
|
|
|
|
|
</copyright>
|
|
|
|
|
<copyright>
|
2014-03-28 19:06:55 +00:00
|
|
|
|
<year>2010-2014</year>
|
2013-11-03 11:43:50 +00:00
|
|
|
|
<holder>Khronos Group</holder>
|
|
|
|
|
</copyright>
|
2014-03-28 19:06:55 +00:00
|
|
|
|
</info>
|
2009-03-08 00:46:58 +00:00
|
|
|
|
<refmeta>
|
2013-11-03 11:43:50 +00:00
|
|
|
|
<refentrytitle>glLinkProgram</refentrytitle>
|
|
|
|
|
<manvolnum>3G</manvolnum>
|
2009-03-08 00:46:58 +00:00
|
|
|
|
</refmeta>
|
|
|
|
|
<refnamediv>
|
2013-11-03 11:43:50 +00:00
|
|
|
|
<refname>glLinkProgram</refname>
|
|
|
|
|
<refpurpose>Links a program object</refpurpose>
|
2009-03-08 00:46:58 +00:00
|
|
|
|
</refnamediv>
|
2014-03-28 19:06:55 +00:00
|
|
|
|
<refsynopsisdiv>
|
|
|
|
|
<title>C Specification</title>
|
2010-11-21 14:34:29 +00:00
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcprototype>
|
|
|
|
|
<funcdef>void <function>glLinkProgram</function></funcdef>
|
|
|
|
|
<paramdef>GLuint <parameter>program</parameter></paramdef>
|
|
|
|
|
</funcprototype>
|
|
|
|
|
</funcsynopsis>
|
2009-03-08 00:46:58 +00:00
|
|
|
|
</refsynopsisdiv>
|
2014-03-28 19:06:55 +00:00
|
|
|
|
<refsect1 xml:id="parameters"><title>Parameters</title>
|
2010-11-21 14:34:29 +00:00
|
|
|
|
<variablelist>
|
|
|
|
|
<varlistentry>
|
|
|
|
|
<term><parameter>program</parameter></term>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>Specifies the handle of the program object to be linked.</para>
|
2009-03-08 00:46:58 +00:00
|
|
|
|
|
2010-11-21 14:34:29 +00:00
|
|
|
|
</listitem>
|
|
|
|
|
</varlistentry>
|
|
|
|
|
</variablelist>
|
2009-03-08 00:46:58 +00:00
|
|
|
|
</refsect1>
|
2014-03-28 19:06:55 +00:00
|
|
|
|
<refsect1 xml:id="description"><title>Description</title>
|
|
|
|
|
<para><function>glLinkProgram</function> links the program
|
|
|
|
|
object specified by <parameter>program</parameter>. Shader objects
|
|
|
|
|
of type <constant>GL_VERTEX_SHADER</constant> attached to
|
|
|
|
|
<parameter>program</parameter> are used to
|
|
|
|
|
create an executable that will run on the programmable vertex
|
|
|
|
|
processor. Shader objects of type <constant>GL_FRAGMENT_SHADER</constant>
|
|
|
|
|
attached to <parameter>program</parameter> are used to create an
|
|
|
|
|
executable that will run on the programmable fragment
|
|
|
|
|
processor.</para>
|
2009-03-08 00:46:58 +00:00
|
|
|
|
|
2010-11-21 14:34:29 +00:00
|
|
|
|
<para>The status of the link operation will be stored as part of
|
|
|
|
|
the program object's state. This value will be set to
|
|
|
|
|
<constant>GL_TRUE</constant> if the program object was linked
|
|
|
|
|
without errors and is ready for use, and
|
|
|
|
|
<constant>GL_FALSE</constant> otherwise. It can be queried by
|
|
|
|
|
calling
|
2014-03-28 19:06:55 +00:00
|
|
|
|
<citerefentry><refentrytitle>glGetProgramiv</refentrytitle></citerefentry>
|
2010-11-21 14:34:29 +00:00
|
|
|
|
with arguments <parameter>program</parameter> and
|
|
|
|
|
<constant>GL_LINK_STATUS</constant>.</para>
|
2009-03-08 00:46:58 +00:00
|
|
|
|
|
2010-11-21 14:34:29 +00:00
|
|
|
|
<para>As a result of a successful link operation, all active
|
|
|
|
|
user-defined uniform variables belonging to
|
|
|
|
|
<parameter>program</parameter> will be initialized to 0, and
|
|
|
|
|
each of the program object's active uniform variables will be
|
|
|
|
|
assigned a location that can be queried by calling
|
|
|
|
|
<citerefentry><refentrytitle>glGetUniformLocation</refentrytitle></citerefentry>.
|
2014-03-28 19:06:55 +00:00
|
|
|
|
All active uniforms belonging to the program’s named uniform blocks are
|
|
|
|
|
assigned offsets (and strides for array and matrix type uniforms) within
|
|
|
|
|
the uniform block. Also, any active user-defined attribute variables that have not
|
2010-11-21 14:34:29 +00:00
|
|
|
|
been bound to a generic vertex attribute index will be bound to
|
|
|
|
|
one at this time.</para>
|
2009-03-08 00:46:58 +00:00
|
|
|
|
|
2010-11-21 14:34:29 +00:00
|
|
|
|
<para>Linking of a program object can fail for a number of
|
2014-03-28 19:06:55 +00:00
|
|
|
|
reasons as specified in the <emphasis>OpenGL ES Shading Language
|
2010-11-21 14:34:29 +00:00
|
|
|
|
Specification</emphasis>. The following lists some of the
|
|
|
|
|
conditions that will cause a link error.</para>
|
2009-03-08 00:46:58 +00:00
|
|
|
|
|
2010-11-21 14:34:29 +00:00
|
|
|
|
<itemizedlist>
|
2014-03-28 19:06:55 +00:00
|
|
|
|
<listitem>
|
|
|
|
|
<para>A vertex shader and a fragment shader are not both
|
|
|
|
|
present in the program object.</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>The vertex and fragment shader do not use the same
|
|
|
|
|
shader language version.</para>
|
|
|
|
|
</listitem>
|
2010-11-21 14:34:29 +00:00
|
|
|
|
<listitem>
|
|
|
|
|
<para>The number of active attribute variables supported
|
|
|
|
|
by the implementation has been exceeded.</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>The storage limit for uniform variables has been
|
|
|
|
|
exceeded.</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>The number of active uniform variables supported
|
|
|
|
|
by the implementation has been exceeded.</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>The <function>main</function> function is missing
|
2014-03-28 19:06:55 +00:00
|
|
|
|
for the vertex or fragment shader.</para>
|
2010-11-21 14:34:29 +00:00
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>A varying variable actually used in the fragment
|
|
|
|
|
shader is not declared in the same way (or is not
|
2014-03-28 19:06:55 +00:00
|
|
|
|
declared at all) in the vertex shader.</para>
|
2010-11-21 14:34:29 +00:00
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>A reference to a function or variable name is
|
|
|
|
|
unresolved.</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>A shared global is declared with two different
|
|
|
|
|
types or two different initial values.</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
2014-03-28 19:06:55 +00:00
|
|
|
|
<para>One or more of the attached shader objects has not
|
|
|
|
|
been successfully compiled (via <citerefentry><refentrytitle>glCompileShader</refentrytitle></citerefentry>)
|
|
|
|
|
or loaded with a pre-compiled shader binary
|
|
|
|
|
(via <citerefentry><refentrytitle>glShaderBinary</refentrytitle></citerefentry>).</para>
|
2010-11-21 14:34:29 +00:00
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>Binding a generic attribute matrix caused some
|
|
|
|
|
rows of the matrix to fall outside the allowed maximum
|
|
|
|
|
of <constant>GL_MAX_VERTEX_ATTRIBS</constant>.</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>Not enough contiguous vertex attribute slots could
|
|
|
|
|
be found to bind attribute matrices.</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>Any variable name specified to <citerefentry><refentrytitle>glTransformFeedbackVaryings</refentrytitle></citerefentry>
|
2014-03-28 19:06:55 +00:00
|
|
|
|
in the <parameter>varyings</parameter> array is not declared as an output in the vertex shader.</para>
|
2010-11-21 14:34:29 +00:00
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>Any two entries in the <parameter>varyings</parameter> array given
|
|
|
|
|
<citerefentry><refentrytitle>glTransformFeedbackVaryings</refentrytitle></citerefentry>
|
|
|
|
|
specify the same varying variable.</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>The total number of components to capture in any transform feedback varying variable
|
|
|
|
|
is greater than the constant <constant>GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS</constant>
|
2013-10-23 18:17:08 +00:00
|
|
|
|
and the buffer mode is <constant>GL_SEPARATE_ATTRIBS</constant>.</para>
|
2010-11-21 14:34:29 +00:00
|
|
|
|
</listitem>
|
2014-03-28 19:06:55 +00:00
|
|
|
|
<listitem>
|
|
|
|
|
<para>The total number of components to capture in any transform feedback varying variable
|
|
|
|
|
is greater than the constant <constant>GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS</constant>
|
|
|
|
|
and the buffer mode is <constant>GL_INTERLEAVED_ATTRIBS</constant>.</para>
|
|
|
|
|
</listitem>
|
2010-11-21 14:34:29 +00:00
|
|
|
|
</itemizedlist>
|
2009-03-08 00:46:58 +00:00
|
|
|
|
|
2010-11-21 14:34:29 +00:00
|
|
|
|
<para>When a program object has been successfully linked, the
|
|
|
|
|
program object can be made part of current state by calling
|
|
|
|
|
<citerefentry><refentrytitle>glUseProgram</refentrytitle></citerefentry>.
|
|
|
|
|
Whether or not the link operation was successful, the program
|
|
|
|
|
object's information log will be overwritten. The information
|
|
|
|
|
log can be retrieved by calling
|
|
|
|
|
<citerefentry><refentrytitle>glGetProgramInfoLog</refentrytitle></citerefentry>.</para>
|
2009-03-08 00:46:58 +00:00
|
|
|
|
|
2010-11-21 14:34:29 +00:00
|
|
|
|
<para><function>glLinkProgram</function> will also install the
|
|
|
|
|
generated executables as part of the current rendering state if
|
|
|
|
|
the link operation was successful and the specified program
|
|
|
|
|
object is already currently in use as a result of a previous
|
|
|
|
|
call to
|
|
|
|
|
<citerefentry><refentrytitle>glUseProgram</refentrytitle></citerefentry>.
|
|
|
|
|
If the program object currently in use is relinked
|
|
|
|
|
unsuccessfully, its link status will be set to
|
|
|
|
|
<constant>GL_FALSE</constant> , but the executables and
|
|
|
|
|
associated state will remain part of the current state until a
|
|
|
|
|
subsequent call to <function>glUseProgram</function> removes it
|
|
|
|
|
from use. After it is removed from use, it cannot be made part
|
|
|
|
|
of current state until it has been successfully relinked.</para>
|
2009-03-08 00:46:58 +00:00
|
|
|
|
|
2010-11-21 14:34:29 +00:00
|
|
|
|
<para>The program object's information log is updated and the
|
|
|
|
|
program is generated at the time of the link operation. After
|
|
|
|
|
the link operation, applications are free to modify attached
|
|
|
|
|
shader objects, compile attached shader objects, detach shader
|
|
|
|
|
objects, delete shader objects, and attach additional shader
|
|
|
|
|
objects. None of these operations affects the information log or
|
|
|
|
|
the program that is part of the program object.</para>
|
2009-03-08 00:46:58 +00:00
|
|
|
|
</refsect1>
|
2014-03-28 19:06:55 +00:00
|
|
|
|
<refsect1 xml:id="notes"><title>Notes</title>
|
2010-11-21 14:34:29 +00:00
|
|
|
|
<para>If the link operation is unsuccessful, any information about a previous link operation on <parameter>program</parameter>
|
|
|
|
|
is lost (i.e., a failed link does not restore the old state of <parameter>program</parameter>
|
|
|
|
|
). Certain information can still be retrieved from <parameter>program</parameter>
|
|
|
|
|
even after an unsuccessful link operation. See for instance <citerefentry><refentrytitle>glGetActiveAttrib</refentrytitle></citerefentry>
|
|
|
|
|
and <citerefentry><refentrytitle>glGetActiveUniform</refentrytitle></citerefentry>.</para>
|
2009-03-08 00:46:58 +00:00
|
|
|
|
</refsect1>
|
2014-03-28 19:06:55 +00:00
|
|
|
|
<refsect1 xml:id="errors"><title>Errors</title>
|
2010-11-21 14:34:29 +00:00
|
|
|
|
<para><constant>GL_INVALID_VALUE</constant>
|
|
|
|
|
is generated if <parameter>program</parameter>
|
|
|
|
|
is not a value generated by OpenGL.</para>
|
|
|
|
|
<para><constant>GL_INVALID_OPERATION</constant>
|
|
|
|
|
is generated if <parameter>program</parameter>
|
|
|
|
|
is not a program object.</para>
|
|
|
|
|
<para><constant>GL_INVALID_OPERATION</constant>
|
|
|
|
|
is generated if <parameter>program</parameter> is the currently active program
|
|
|
|
|
object and transform feedback mode is active.</para>
|
2009-03-08 00:46:58 +00:00
|
|
|
|
</refsect1>
|
2014-03-28 19:06:55 +00:00
|
|
|
|
<refsect1 xml:id="associatedgets"><title>Associated Gets</title>
|
2010-11-21 14:34:29 +00:00
|
|
|
|
<para><citerefentry><refentrytitle>glGet</refentrytitle></citerefentry>
|
|
|
|
|
with the argument <constant>GL_CURRENT_PROGRAM</constant></para>
|
|
|
|
|
<para><citerefentry><refentrytitle>glGetActiveAttrib</refentrytitle></citerefentry>
|
|
|
|
|
with argument <parameter>program</parameter>
|
|
|
|
|
and the index of an active attribute variable</para>
|
|
|
|
|
<para><citerefentry><refentrytitle>glGetActiveUniform</refentrytitle></citerefentry>
|
|
|
|
|
with argument <parameter>program</parameter>
|
2014-03-28 19:06:55 +00:00
|
|
|
|
and the index of an active uniform variable<parameter/></para>
|
|
|
|
|
<para><citerefentry><refentrytitle>glGetActiveUniformBlockiv</refentrytitle></citerefentry>
|
|
|
|
|
with argument <parameter>program</parameter>
|
|
|
|
|
and the index of an active uniform block<parameter/></para>
|
2010-11-21 14:34:29 +00:00
|
|
|
|
<para><citerefentry><refentrytitle>glGetAttachedShaders</refentrytitle></citerefentry>
|
|
|
|
|
with argument <parameter>program</parameter></para>
|
|
|
|
|
<para><citerefentry><refentrytitle>glGetAttribLocation</refentrytitle></citerefentry>
|
|
|
|
|
with argument <parameter>program</parameter>
|
|
|
|
|
and an attribute variable name</para>
|
2014-03-28 19:06:55 +00:00
|
|
|
|
<para><citerefentry><refentrytitle>glGetProgramiv</refentrytitle></citerefentry>
|
2010-11-21 14:34:29 +00:00
|
|
|
|
with arguments <parameter>program</parameter>
|
|
|
|
|
and <constant>GL_LINK_STATUS</constant></para>
|
|
|
|
|
<para><citerefentry><refentrytitle>glGetProgramInfoLog</refentrytitle></citerefentry>
|
|
|
|
|
with argument <parameter>program</parameter></para>
|
|
|
|
|
<para><citerefentry><refentrytitle>glGetUniform</refentrytitle></citerefentry>
|
|
|
|
|
with argument <parameter>program</parameter>
|
|
|
|
|
and a uniform variable location</para>
|
|
|
|
|
<para><citerefentry><refentrytitle>glGetUniformLocation</refentrytitle></citerefentry>
|
|
|
|
|
with argument <parameter>program</parameter>
|
|
|
|
|
and a uniform variable name</para>
|
|
|
|
|
<para><citerefentry><refentrytitle>glIsProgram</refentrytitle></citerefentry></para>
|
2009-03-08 00:46:58 +00:00
|
|
|
|
</refsect1>
|
2014-03-28 19:06:55 +00:00
|
|
|
|
<refsect1 xml:id="versions">
|
|
|
|
|
<title>API Version Support</title>
|
|
|
|
|
<informaltable>
|
|
|
|
|
<tgroup cols="4" align="left">
|
|
|
|
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apifunchead.xml" xpointer="xpointer(/*/*)"/>
|
|
|
|
|
<tbody>
|
|
|
|
|
<row>
|
|
|
|
|
<entry>glLinkProgram</entry>
|
|
|
|
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apiversion.xml" xpointer="xpointer(/*/*[@role='es20']/*)"/>
|
|
|
|
|
</row>
|
|
|
|
|
</tbody>
|
|
|
|
|
</tgroup>
|
|
|
|
|
</informaltable>
|
|
|
|
|
</refsect1>
|
|
|
|
|
<refsect1 xml:id="seealso"><title>See Also</title>
|
2010-11-21 14:34:29 +00:00
|
|
|
|
<para><citerefentry><refentrytitle>glAttachShader</refentrytitle></citerefentry>,
|
|
|
|
|
<citerefentry><refentrytitle>glBindAttribLocation</refentrytitle></citerefentry>,
|
|
|
|
|
<citerefentry><refentrytitle>glCompileShader</refentrytitle></citerefentry>,
|
|
|
|
|
<citerefentry><refentrytitle>glCreateProgram</refentrytitle></citerefentry>,
|
|
|
|
|
<citerefentry><refentrytitle>glDeleteProgram</refentrytitle></citerefentry>,
|
|
|
|
|
<citerefentry><refentrytitle>glDetachShader</refentrytitle></citerefentry>,
|
|
|
|
|
<citerefentry><refentrytitle>glUniform</refentrytitle></citerefentry>,
|
|
|
|
|
<citerefentry><refentrytitle>glUseProgram</refentrytitle></citerefentry>,
|
|
|
|
|
<citerefentry><refentrytitle>glValidateProgram</refentrytitle></citerefentry></para>
|
2009-03-08 00:46:58 +00:00
|
|
|
|
</refsect1>
|
2014-03-28 19:06:55 +00:00
|
|
|
|
<refsect1 xml:id="Copyright"><title>Copyright</title>
|
2009-03-08 00:46:58 +00:00
|
|
|
|
<para>
|
2014-03-28 19:06:55 +00:00
|
|
|
|
Copyright <trademark class="copyright"/> 2003-2005 3Dlabs Inc. Ltd.
|
|
|
|
|
Copyright <trademark class="copyright"/> 2010-2014 Khronos Group.
|
|
|
|
|
This material may be distributed subject to the terms and conditions set forth in
|
2009-03-08 00:46:58 +00:00
|
|
|
|
the Open Publication License, v 1.0, 8 June 1999.
|
2014-03-28 19:06:55 +00:00
|
|
|
|
<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://opencontent.org/openpub/">http://opencontent.org/openpub/</link>.
|
2009-03-08 00:46:58 +00:00
|
|
|
|
</para>
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|