--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"\r
+ "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">\r
+<refentry id="gl_ViewportIndex">\r
+ <refmeta>\r
+ <refmetainfo>\r
+ <copyright>\r
+ <year>2011</year>\r
+ <holder>Khronos Group</holder>\r
+ </copyright>\r
+ </refmetainfo>\r
+ <refentrytitle>gl_ViewportIndex</refentrytitle>\r
+ <manvolnum>3G</manvolnum>\r
+ </refmeta>\r
+ <refnamediv>\r
+ <refname>gl_ViewportIndex</refname>\r
+ <refpurpose>contains the index of the viewport to be used in viewport transformation and scissoring</refpurpose>\r
+ </refnamediv>\r
+ <refsynopsisdiv><title>Declaration</title>\r
+ <funcsynopsis>\r
+ <function>out int gl_ViewportIndex; // Geometry stage</function>\r
+ </funcsynopsis>\r
+ <funcsynopsis>\r
+ <function>in int gl_ViewportIndex; // Fragment stage</function>\r
+ </funcsynopsis>\r
+ </refsynopsisdiv>\r
+ <refsect1 id="description"><title>Description</title>\r
+ <para>\r
+ In the geometry language, <function>gl_ViewportIndex</function> is used to specify the index\r
+ of the viewport to which the next primitive emitted from the shader should be drawn. Primitives generated\r
+ by the geometry shader will undergo viewport transformation and scissor testing using the viewport\r
+ transformation and scissor rectangle selected by the value of <function>gl_ViewportIndex</function>.\r
+ The viewport index used will come from one of the vertices in the primitive being shaded. However, which\r
+ vertex the viewport index comes from is implementation-defined, and so it is recommended to use the same\r
+ viewport index for all vertices of a primitive. If a geometry shader does not assign a value to\r
+ <function>gl_ViewportIndex</function>, viewport transform and scissor rectangle zero will be used.\r
+ If a geometry shader statically assigns a value to <function>gl_ViewportIndex</function> and there\r
+ is a path through the shader that does not assign a value to <function>gl_ViewportIndex</function>,\r
+ the value of <function>gl_ViewportIndex</function> is undefined for executions of the shader that take\r
+ that path.\r
+ </para>\r
+ <para>\r
+ In the fragment language, <function>gl_ViewportIndex</function> will have the same value that was written to the \r
+ output variable <function>gl_ViewportIndex</function> in the geometry stage. If the geometry stage does not dynamically\r
+ assign to <function>gl_ViewportIndex</function>, the value of <function>gl_ViewportIndex</function> in the fragment shader will be undefined. If\r
+ the geometry stage makes no static assignment to <function>gl_ViewportIndex</function>, the fragment stage will read zero.\r
+ Otherwise, the fragment stage will read the same value written by the geometry stage, even if that value is\r
+ out of range. If a fragment shader contains a static access to <function>gl_ViewportIndex</function>, it will count against the\r
+ implementation defined limit for the maximum number of inputs to the fragment stage.\r
+ </para>\r
+ </refsect1>\r
+ <refsect1 id="versions"><title>Version Support</title>\r
+ <informaltable frame="topbot">\r
+ #VARTABLECOLS#\r
+ <thead>\r
+ #FUNCTABLEHEADER#\r
+ <row>\r
+ <entry>gl_ViewportIndex (geometry stage)</entry>#newin15#\r
+ </row>\r
+ <row>\r
+ <entry>gl_ViewportIndex (fragment stage)</entry>#newin43#\r
+ </row>\r
+ </thead>\r
+ </tgroup>\r
+ </informaltable>\r
+ </refsect1>\r
+ <refsect1 id="seealso"><title>See Also</title>\r
+ <para>\r
+ <citerefentry><refentrytitle>gl_Layer</refentrytitle></citerefentry>\r
+ </para>\r
+ </refsect1>\r
+ <refsect1 id="Copyright"><title>Copyright</title>\r
+ <para>\r
+ Copyright <trademark class="copyright"></trademark> 2011 Khronos Group. \r
+ This material may be distributed subject to the terms and conditions set forth in \r
+ the Open Publication License, v 1.0, 8 June 1999.\r
+ <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>.\r
+ </para>\r
+ </refsect1>\r
+</refentry>\r