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