mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-25 17:35:37 +00:00
269 lines
14 KiB
XML
269 lines
14 KiB
XML
<!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>
|
||
<copyright>
|
||
<year>2003-2005</year>
|
||
<holder>3Dlabs Inc. Ltd.</holder>
|
||
</copyright>
|
||
<copyright>
|
||
<year>2010-2014</year>
|
||
<holder>Khronos Group</holder>
|
||
</copyright>
|
||
</info>
|
||
<refmeta>
|
||
<refentrytitle>glLinkProgram</refentrytitle>
|
||
<manvolnum>3G</manvolnum>
|
||
</refmeta>
|
||
<refnamediv>
|
||
<refname>glLinkProgram</refname>
|
||
<refpurpose>Links a program object</refpurpose>
|
||
</refnamediv>
|
||
<refsynopsisdiv>
|
||
<title>C Specification</title>
|
||
<funcsynopsis>
|
||
<funcprototype>
|
||
<funcdef>void <function>glLinkProgram</function></funcdef>
|
||
<paramdef>GLuint <parameter>program</parameter></paramdef>
|
||
</funcprototype>
|
||
</funcsynopsis>
|
||
</refsynopsisdiv>
|
||
<refsect1 xml:id="parameters"><title>Parameters</title>
|
||
<variablelist>
|
||
<varlistentry>
|
||
<term><parameter>program</parameter></term>
|
||
<listitem>
|
||
<para>Specifies the handle of the program object to be linked.</para>
|
||
|
||
</listitem>
|
||
</varlistentry>
|
||
</variablelist>
|
||
</refsect1>
|
||
<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>
|
||
|
||
<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
|
||
<citerefentry><refentrytitle>glGetProgramiv</refentrytitle></citerefentry>
|
||
with arguments <parameter>program</parameter> and
|
||
<constant>GL_LINK_STATUS</constant>.</para>
|
||
|
||
<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>.
|
||
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
|
||
been bound to a generic vertex attribute index will be bound to
|
||
one at this time.</para>
|
||
|
||
<para>Linking of a program object can fail for a number of
|
||
reasons as specified in the <emphasis>OpenGL ES Shading Language
|
||
Specification</emphasis>. The following lists some of the
|
||
conditions that will cause a link error.</para>
|
||
|
||
<itemizedlist>
|
||
<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>
|
||
<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
|
||
for the vertex or fragment shader.</para>
|
||
</listitem>
|
||
<listitem>
|
||
<para>A varying variable actually used in the fragment
|
||
shader is not declared in the same way (or is not
|
||
declared at all) in the vertex shader.</para>
|
||
</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>
|
||
<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>
|
||
</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>
|
||
in the <parameter>varyings</parameter> array is not declared as an output in the vertex shader.</para>
|
||
</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>
|
||
and the buffer mode is <constant>GL_SEPARATE_ATTRIBS</constant>.</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_INTERLEAVED_COMPONENTS</constant>
|
||
and the buffer mode is <constant>GL_INTERLEAVED_ATTRIBS</constant>.</para>
|
||
</listitem>
|
||
</itemizedlist>
|
||
|
||
<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>
|
||
|
||
<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>
|
||
|
||
<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>
|
||
</refsect1>
|
||
<refsect1 xml:id="notes"><title>Notes</title>
|
||
<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>
|
||
</refsect1>
|
||
<refsect1 xml:id="errors"><title>Errors</title>
|
||
<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>
|
||
</refsect1>
|
||
<refsect1 xml:id="associatedgets"><title>Associated Gets</title>
|
||
<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>
|
||
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>
|
||
<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>
|
||
<para><citerefentry><refentrytitle>glGetProgramiv</refentrytitle></citerefentry>
|
||
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>
|
||
</refsect1>
|
||
<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>
|
||
<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>
|
||
</refsect1>
|
||
<refsect1 xml:id="Copyright"><title>Copyright</title>
|
||
<para>
|
||
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
|
||
the Open Publication License, v 1.0, 8 June 1999.
|
||
<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://opencontent.org/openpub/">http://opencontent.org/openpub/</link>.
|
||
</para>
|
||
</refsect1>
|
||
</refentry>
|