update upstream sources
[clinton/guile-figl.git] / upstream-doc / manglsl / gl_PrimitiveID.xml
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="gl_PrimitiveID">
5 <refmeta>
6 <refmetainfo>
7 <copyright>
8 <year>2011</year>
9 <holder>Khronos Group</holder>
10 </copyright>
11 </refmetainfo>
12 <refentrytitle>gl_PrimitiveID</refentrytitle>
13 <manvolnum>3G</manvolnum>
14 </refmeta>
15 <refnamediv>
16 <refname>gl_PrimitiveID</refname>
17 <refpurpose>contains the index of the current primitive</refpurpose>
18 </refnamediv>
19 <refsynopsisdiv><title>Declaration</title>
20 <funcsynopsis>
21 <function>in int gl_PrimitiveID;</function> (Tessellation control, tessellation evaluation and fragment languages)<sbr/>
22 <function>out int gl_PrimitiveID;</function> (Geometry language)
23 </funcsynopsis>
24 </refsynopsisdiv>
25 <refsect1 id="description"><title>Description</title>
26 <para>
27 <function>gl_PrimitiveID</function> is a tessellation control, tessellation evaluation
28 and fragment language input variable. For the tessellation control and tessellation
29 evaluation languages, it holds the number of primitives processed by
30 the shader since the current set of rendering primitives was started. The first
31 primitive processed by the drawing command is numbered zero and the primitive ID counter is incremented after every individual point, line
32 or triangle primitive is processed. For triangles drawn in point or line mode, the
33 primitive ID counter is incremented only once, even through multiple points or lines
34 may actually be drawn. Restarting a primitive topology using the primitive restart
35 index has no effect on the primitive ID counter.
36 </para>
37 <para>
38 In the geometry language, <function>gl_PrimitiveID</function> is an output
39 variable that is passed to the corresponding <function>gl_PrimitiveID</function> input
40 variable in the fragment shader. If no geomery shader is present then <function>gl_PrimitiveID</function>
41 in the fragment language behaves identically as it would in the tessellation control and evaluation
42 languages. If a geometry shader is present but does not write to <function>gl_PrimitiveID</function>,
43 the value of <function>gl_PrimitiveID</function> in the fragment shader is undefined.
44 </para>
45 </refsect1>
46 <refsect1 id="versions"><title>Version Support</title>
47 <informaltable frame="topbot">
48 #VARTABLECOLS#
49 <thead>
50 #FUNCTABLEHEADER#
51 <row>
52 <entry><function>gl_PrimitiveID</function> (Fragment and Geometry Languages)</entry>#newin15#
53 </row>
54 <row>
55 <entry><function>gl_PrimitiveID</function> (Tessellation Control and Evaluation Languages)</entry>#newin40#
56 </row>
57 </thead>
58 </tgroup>
59 </informaltable>
60 </refsect1>
61 <refsect1 id="seealso"><title>See Also</title>
62 <para>
63 <citerefentry><refentrytitle>gl_InstanceID</refentrytitle></citerefentry>,
64 <citerefentry><refentrytitle>gl_VertexID</refentrytitle></citerefentry>,
65 <citerefentry><refentrytitle>gl_PrimitiveIDIn</refentrytitle></citerefentry>
66 </para>
67 </refsect1>
68 <refsect1 id="Copyright"><title>Copyright</title>
69 <para>
70 Copyright <trademark class="copyright"></trademark> 2011 Khronos Group.
71 This material may be distributed subject to the terms and conditions set forth in
72 the Open Publication License, v 1.0, 8 June 1999.
73 <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>.
74 </para>
75 </refsect1>
76 </refentry>