Commit | Line | Data |
---|---|---|
7faf1d71 AW |
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_Layer">\r | |
5 | <refmeta>\r | |
6 | <refmetainfo>\r | |
7 | <copyright>\r | |
8 | <year>2012</year>\r | |
9 | <holder>Khronos Group</holder>\r | |
10 | </copyright>\r | |
11 | </refmetainfo>\r | |
12 | <refentrytitle>gl_Layer</refentrytitle>\r | |
13 | <manvolnum>3G</manvolnum>\r | |
14 | </refmeta>\r | |
15 | <refnamediv>\r | |
16 | <refname>gl_Layer</refname>\r | |
17 | <refpurpose>contains the selected layer of a multi-layer framebuffer attachment</refpurpose>\r | |
18 | </refnamediv>\r | |
19 | <refsynopsisdiv><title>Declaration</title>\r | |
20 | <funcsynopsis>\r | |
21 | <function>out int gl_Layer; // Geometry stage</function>\r | |
22 | </funcsynopsis>\r | |
23 | <funcsynopsis>\r | |
24 | <function>in int gl_Layer; // 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_Layer</function> is used to select a specific\r | |
30 | layer (or face and layer of cube map) in a multi-layer framebuffer attachment. The actual\r | |
31 | layer used will come from one of the vertices in the primitive being shaded. Which vertex\r | |
32 | the layer comes from is undefined and as such it is recommended to write the same value\r | |
33 | to <function>gl_Layer</function> for all vertices in the primitive. If a shader statically\r | |
34 | assigns a value to <function>gl_Layer</function>, layered rendering mode is enabled.\r | |
35 | If a shader statically assigns a value to <function>gl_Layer</function>, and there is an execution path through\r | |
36 | the shader that does not set <function>gl_Layer</function>, then the value of <function>gl_Layer</function>\r | |
37 | is undefined for invocations of the shader that take that path.\r | |
38 | </para>\r | |
39 | <para>\r | |
40 | When used with an array of cube map textures, the <function>gl_Layer</function> output variable\r | |
41 | takes on a special value. Instead of referring to only the layer, it is used to select a cube map\r | |
42 | face and a layer. Setting <function>gl_Layer</function> to the value\r | |
43 | <inlineequation><mml:math><mml:mi>layer</mml:mi><mml:mo>*</mml:mo><mml:mn>6</mml:mn><mml:mo>+</mml:mo><mml:mi>face</mml:mi></mml:math></inlineequation>\r | |
44 | will render to <inlineequation><mml:math><mml:mi>face</mml:mi></mml:math></inlineequation>\r | |
45 | of the cube defined in <inlineequation><mml:math><mml:mi>layer</mml:mi></mml:math></inlineequation>.\r | |
46 | The face values are as follows:\r | |
47 | <informaltable frame="topbot">\r | |
48 | <tgroup cols="2" align="left">\r | |
49 | <colspec colwidth="1.1*" />\r | |
50 | <colspec colwidth="1*" align="center" />\r | |
51 | <thead>\r | |
52 | <row>\r | |
53 | <entry rowsep="1" align="left"><emphasis role="bold">\r | |
54 | Face Value\r | |
55 | </emphasis></entry>\r | |
56 | <entry rowsep="1" align="left"><emphasis role="bold">\r | |
57 | Resulting Target\r | |
58 | </emphasis></entry>\r | |
59 | </row>\r | |
60 | <row>\r | |
61 | <entry>\r | |
62 | 0\r | |
63 | </entry>\r | |
64 | <entry>\r | |
65 | <constant>GL_TEXTURE_CUBEMAP_POSITIVE_X</constant>\r | |
66 | </entry>\r | |
67 | </row>\r | |
68 | <row>\r | |
69 | <entry>\r | |
70 | 1\r | |
71 | </entry>\r | |
72 | <entry>\r | |
73 | <constant>GL_TEXTURE_CUBEMAP_NEGATIVE_X</constant>\r | |
74 | </entry>\r | |
75 | </row>\r | |
76 | <row>\r | |
77 | <entry>\r | |
78 | 2\r | |
79 | </entry>\r | |
80 | <entry>\r | |
81 | <constant>GL_TEXTURE_CUBEMAP_POSITIVE_Y</constant>\r | |
82 | </entry>\r | |
83 | </row>\r | |
84 | <row>\r | |
85 | <entry>\r | |
86 | 3\r | |
87 | </entry>\r | |
88 | <entry>\r | |
89 | <constant>GL_TEXTURE_CUBEMAP_NEGATIVE_Y</constant>\r | |
90 | </entry>\r | |
91 | </row>\r | |
92 | <row>\r | |
93 | <entry>\r | |
94 | 4\r | |
95 | </entry>\r | |
96 | <entry>\r | |
97 | <constant>GL_TEXTURE_CUBEMAP_POSITIVE_Z</constant>\r | |
98 | </entry>\r | |
99 | </row>\r | |
100 | <row>\r | |
101 | <entry>\r | |
102 | 5\r | |
103 | </entry>\r | |
104 | <entry>\r | |
105 | <constant>GL_TEXTURE_CUBEMAP_NEGATIVE_Z</constant>\r | |
106 | </entry>\r | |
107 | </row>\r | |
108 | </thead>\r | |
109 | </tgroup>\r | |
110 | </informaltable>\r | |
111 | </para>\r | |
112 | <para>\r | |
113 | For example, to render to the positive y cube map face located in the 5<superscript>th</superscript> layer of the\r | |
114 | cube map array, <function>gl_Layer</function> should be set to\r | |
115 | <inlineequation><mml:math><mml:mn>5</mml:mn><mml:mo>*</mml:mo><mml:mn>6</mml:mn><mml:mo>+</mml:mo><mml:mn>2</mml:mn></mml:math></inlineequation>.\r | |
116 | </para>\r | |
117 | <para>\r | |
118 | The input variable <function>gl_Layer</function> in the fragment language will have the same value that was written to the\r | |
119 | output variable <function>gl_Layer</function> in the geometry language. If the geometry stage does not dynamically assign a\r | |
120 | value to <function>gl_Layer</function>, the value of <function>gl_Layer</function> in the fragment stage will be undefined. If the geometry stage\r | |
121 | makes no static assignment to <function>gl_Layer</function>, the input <function>gl_Layer</function> in the fragment stage will be zero. Otherwise,\r | |
122 | the fragment stage will read the same value written by the geometry stage, even if that value is out of\r | |
123 | range. If a fragment shader contains a static access to <function>gl_Layer</function>, it will count against the implementation\r | |
124 | defined limit for the maximum number of inputs to the fragment stage.\r | |
125 | </para>\r | |
126 | </refsect1>\r | |
127 | <refsect1 id="versions"><title>Version Support</title>\r | |
128 | <informaltable frame="topbot">\r | |
129 | #VARTABLECOLS#\r | |
130 | <thead>\r | |
131 | #FUNCTABLEHEADER#\r | |
132 | <row>\r | |
133 | <entry>gl_Layer (geometry stage)</entry>#newin15#\r | |
134 | </row>\r | |
135 | <row>\r | |
136 | <entry>gl_Layer (fragment stage)</entry>#newin43#\r | |
137 | </row>\r | |
138 | </thead>\r | |
139 | </tgroup>\r | |
140 | </informaltable>\r | |
141 | </refsect1>\r | |
142 | <refsect1 id="seealso"><title>See Also</title>\r | |
143 | <para>\r | |
144 | <citerefentry><refentrytitle>gl_ViewportIndex</refentrytitle></citerefentry>\r | |
145 | </para>\r | |
146 | </refsect1>\r | |
147 | <refsect1 id="Copyright"><title>Copyright</title>\r | |
148 | <para>\r | |
149 | Copyright <trademark class="copyright"></trademark> 2011-2012 Khronos Group. \r | |
150 | This material may be distributed subject to the terms and conditions set forth in \r | |
151 | the Open Publication License, v 1.0, 8 June 1999.\r | |
152 | <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>.\r | |
153 | </para>\r | |
154 | </refsect1>\r | |
155 | </refentry>\r |