File: glLinkProgram.xml

package info (click to toggle)
khronos-opengl-man4 1.0~svn33624-3
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 6,304 kB
  • sloc: xml: 93,066; makefile: 730; python: 627; javascript: 55; sh: 50; php: 4
file content (300 lines) | stat: -rw-r--r-- 15,499 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
<!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>. If any
    shader objects of type <constant>GL_VERTEX_SHADER</constant> are
    attached to <parameter>program</parameter>, they will be used to
    create an executable that will run on the programmable vertex
    processor. If any shader objects of type <constant>GL_GEOMETRY_SHADER</constant>
    are attached to <parameter>program</parameter>, they will be used to create
    an executable that will run on the programmable geometry processor.
    If any shader objects of type
    <constant>GL_FRAGMENT_SHADER</constant> are attached to
    <parameter>program</parameter>, they will be 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>glGetProgram</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>.
    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 Shading Language
    Specification</emphasis>. The following lists some of the
    conditions that will cause a link error.</para>

    <itemizedlist>
        <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, geometry 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, or geometry shader shader if present.</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.</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>The program object contains objects to form a fragment shader but
        does not contain objects to form a vertex shader.</para>
        </listitem>
        <listitem>
        <para>The program object contains objects to form a geometry shader
        but does not contain objects to form a vertex shader.</para>
        </listitem>
        <listitem>
        <para>The program object contains objects to form a geometry shader
        and the input primitive type, output primitive type, or maximum output
        vertex count is not specified in any compiled geometry shader
        object.</para>
        </listitem>
        <listitem>
        <para>The program object contains objects to form a geometry shader
        and the input primitive type, output primitive type, or maximum output
        vertex count is specified differently in multiple geometry shader
        objects.</para>
        </listitem>
        <listitem>
        <para>The number of active outputs in the fragment shader is greater
        than the value of <constant>GL_MAX_DRAW_BUFFERS</constant>.</para>
        </listitem>
        <listitem>
        <para>The program has an active output assigned to a location greater
        than or equal to the value of <constant>GL_MAX_DUAL_SOURCE_DRAW_BUFFERS</constant>
        and has an active output assigned an index greater than or equal to one.</para>
        </listitem>
        <listitem>
        <para>More than one varying out variable is bound to the same number and index.</para>
        </listitem>
        <listitem>
        <para>The explicit binding assigments do not leave enough space for the linker
        to automatically assign a location for a varying out array, which requires
        multiple contiguous locations.</para>
        </listitem>
        <listitem>
        <para>The <parameter>count</parameter> specified by <citerefentry><refentrytitle>glTransformFeedbackVaryings</refentrytitle></citerefentry>
        is non-zero, but the program object has no vertex or geometry shader.</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 (or the geometry shader, if active).</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>
    </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>If <parameter>program</parameter> contains shader objects
    of type <constant>GL_VERTEX_SHADER</constant>, and optionally of type <constant>GL_GEOMETRY_SHADER</constant>,
    but does not contain shader objects of type
    <constant>GL_FRAGMENT_SHADER</constant>, the vertex shader executable will
    be installed on the programmable vertex processor, the geometry shader executable, if present,
    will be installed on the programmable geometry processor, but no executable will
    be installed on the fragment processor. The results of
    rasterizing primitives with such a program will be undefined.</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>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>glGetProgram</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>Version Support</title>
        <informaltable>
            <tgroup cols="13" align="left">
                <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apifunchead.xml" xpointer="xpointer(/*/*)"/>
                <tbody>
                    <row>
                        <entry><function>glLinkProgram</function></entry>
                        <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apiversion.xml" xpointer="xpointer(/*/*[@role='20']/*)"/>
                    </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>