include more low-level bindings
[clinton/guile-figl.git] / upstream-man-pages / manglsl / gl_ViewportIndex.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_ViewportIndex">
5 <refmeta>
6 <refmetainfo>
7 <copyright>
8 <year>2011</year>
9 <holder>Khronos Group</holder>
10 </copyright>
11 </refmetainfo>
12 <refentrytitle>gl_ViewportIndex</refentrytitle>
13 <manvolnum>3G</manvolnum>
14 </refmeta>
15 <refnamediv>
16 <refname>gl_ViewportIndex</refname>
17 <refpurpose>contains the index of the viewport to be used in viewport transformation and scissoring</refpurpose>
18 </refnamediv>
19 <refsynopsisdiv><title>Declaration</title>
20 <funcsynopsis>
21 <function>out int gl_ViewportIndex; // Geometry stage</function>
22 </funcsynopsis>
23 <funcsynopsis>
24 <function>in int gl_ViewportIndex; // Fragment stage</function>
25 </funcsynopsis>
26 </refsynopsisdiv>
27 <refsect1 id="description"><title>Description</title>
28 <para>
29 In the geometry language, <function>gl_ViewportIndex</function> is used to specify the index
30 of the viewport to which the next primitive emitted from the shader should be drawn. Primitives generated
31 by the geometry shader will undergo viewport transformation and scissor testing using the viewport
32 transformation and scissor rectangle selected by the value of <function>gl_ViewportIndex</function>.
33 The viewport index used will come from one of the vertices in the primitive being shaded. However, which
34 vertex the viewport index comes from is implementation-defined, and so it is recommended to use the same
35 viewport index for all vertices of a primitive. If a geometry shader does not assign a value to
36 <function>gl_ViewportIndex</function>, viewport transform and scissor rectangle zero will be used.
37 If a geometry shader statically assigns a value to <function>gl_ViewportIndex</function> and there
38 is a path through the shader that does not assign a value to <function>gl_ViewportIndex</function>,
39 the value of <function>gl_ViewportIndex</function> is undefined for executions of the shader that take
40 that path.
41 </para>
42 <para>
43 In the fragment language, <function>gl_ViewportIndex</function> will have the same value that was written to the
44 output variable <function>gl_ViewportIndex</function> in the geometry stage. If the geometry stage does not dynamically
45 assign to <function>gl_ViewportIndex</function>, the value of <function>gl_ViewportIndex</function> in the fragment shader will be undefined. If
46 the geometry stage makes no static assignment to <function>gl_ViewportIndex</function>, the fragment stage will read zero.
47 Otherwise, the fragment stage will read the same value written by the geometry stage, even if that value is
48 out of range. If a fragment shader contains a static access to <function>gl_ViewportIndex</function>, it will count against the
49 implementation defined limit for the maximum number of inputs to the fragment stage.
50 </para>
51 </refsect1>
52 <refsect1 id="versions"><title>Version Support</title>
53 <informaltable frame="topbot">
54 #VARTABLECOLS#
55 <thead>
56 #FUNCTABLEHEADER#
57 <row>
58 <entry>gl_ViewportIndex (geometry stage)</entry>#newin15#
59 </row>
60 <row>
61 <entry>gl_ViewportIndex (fragment stage)</entry>#newin43#
62 </row>
63 </thead>
64 </tgroup>
65 </informaltable>
66 </refsect1>
67 <refsect1 id="seealso"><title>See Also</title>
68 <para>
69 <citerefentry><refentrytitle>gl_Layer</refentrytitle></citerefentry>
70 </para>
71 </refsect1>
72 <refsect1 id="Copyright"><title>Copyright</title>
73 <para>
74 Copyright <trademark class="copyright"></trademark> 2011 Khronos Group.
75 This material may be distributed subject to the terms and conditions set forth in
76 the Open Publication License, v 1.0, 8 June 1999.
77 <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>.
78 </para>
79 </refsect1>
80 </refentry>