f062d1d011b95af8675fdf25492c3a9085f60933
[clinton/guile-figl.git] / upstream-man-pages / manglsl / xhtml / gl_Layer.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd">
3 <!-- saved from url=(0013)about:internet -->
4 <?xml-stylesheet type="text/xsl" href="mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:pref="http://www.w3.org/2002/Math/preference" pref:renderer="mathplayer-dl"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><link rel="stylesheet" type="text/css" href="opengl-man.css" /><title>gl_Layer - OpenGL Shading Language (GLSL)</title><meta name="generator" content="DocBook XSL Stylesheets V1.69.1" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="gl_Layer"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>gl_Layer — contains the selected layer of a multi-layer framebuffer attachment</p></div><div class="refsynopsisdiv"><h2>Declaration</h2><div class="funcsynopsis"><code class="function">out int gl_Layer; // Geometry stage</code></div><div class="funcsynopsis"><code class="function">in int gl_Layer; // Fragment stage</code></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p>
5 In the geometry language, <code class="function">gl_Layer</code> is used to select a specific
6 layer (or face and layer of cube map) in a multi-layer framebuffer attachment. The actual
7 layer used will come from one of the vertices in the primitive being shaded. Which vertex
8 the layer comes from is undefined and as such it is recommended to write the same value
9 to <code class="function">gl_Layer</code> for all vertices in the primitive. If a shader statically
10 assigns a value to <code class="function">gl_Layer</code>, layered rendering mode is enabled.
11 If a shader statically assigns a value to <code class="function">gl_Layer</code>, and there is an execution path through
12 the shader that does not set <code class="function">gl_Layer</code>, then the value of <code class="function">gl_Layer</code>
13 is undefined for invocations of the shader that take that path.
14 </p><p>
15 When used with an array of cube map textures, the <code class="function">gl_Layer</code> output variable
16 takes on a special value. Instead of referring to only the layer, it is used to select a cube map
17 face and a layer. Setting <code class="function">gl_Layer</code> to the value
18 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><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>
19 will render to <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi>face</mml:mi></mml:math>
20 of the cube defined in <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi>layer</mml:mi></mml:math>.
21 The face values are as follows:
22 </p><div class="informaltable"><table border="1"><colgroup><col align="left" /><col align="center" /></colgroup><thead><tr><th align="left"><span class="bold"><strong>
23 Face Value
24 </strong></span></th><th align="left"><span class="bold"><strong>
25 Resulting Target
26 </strong></span></th></tr><tr><th align="left">
27 0
28 </th><th align="center">
29 <code class="constant">GL_TEXTURE_CUBEMAP_POSITIVE_X</code>
30 </th></tr><tr><th align="left">
31 1
32 </th><th align="center">
33 <code class="constant">GL_TEXTURE_CUBEMAP_NEGATIVE_X</code>
34 </th></tr><tr><th align="left">
35 2
36 </th><th align="center">
37 <code class="constant">GL_TEXTURE_CUBEMAP_POSITIVE_Y</code>
38 </th></tr><tr><th align="left">
39 3
40 </th><th align="center">
41 <code class="constant">GL_TEXTURE_CUBEMAP_NEGATIVE_Y</code>
42 </th></tr><tr><th align="left">
43 4
44 </th><th align="center">
45 <code class="constant">GL_TEXTURE_CUBEMAP_POSITIVE_Z</code>
46 </th></tr><tr><th align="left">
47 5
48 </th><th align="center">
49 <code class="constant">GL_TEXTURE_CUBEMAP_NEGATIVE_Z</code>
50 </th></tr></thead></table></div><p>
51 </p><p>
52 For example, to render to the positive y cube map face located in the 5<sup>th</sup> layer of the
53 cube map array, <code class="function">gl_Layer</code> should be set to
54 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><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>.
55 </p><p>
56 The input variable <code class="function">gl_Layer</code> in the fragment language will have the same value that was written to the
57 output variable <code class="function">gl_Layer</code> in the geometry language. If the geometry stage does not dynamically assign a
58 value to <code class="function">gl_Layer</code>, the value of <code class="function">gl_Layer</code> in the fragment stage will be undefined. If the geometry stage
59 makes no static assignment to <code class="function">gl_Layer</code>, the input <code class="function">gl_Layer</code> in the fragment stage will be zero. Otherwise,
60 the fragment stage will read the same value written by the geometry stage, even if that value is out of
61 range. If a fragment shader contains a static access to <code class="function">gl_Layer</code>, it will count against the implementation
62 defined limit for the maximum number of inputs to the fragment stage.
63 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="versions"></a><h2>Version Support</h2><div class="informaltable"><table border="1"><colgroup><col align="left" /><col align="center" /><col align="center" /><col align="center" /><col align="center" /><col align="center" /><col align="center" /><col align="center" /><col align="center" /><col align="center" /><col align="center" /></colgroup><thead><tr><th align="left"><span class="bold"><strong>Function</strong></span></th><th align="left"><span class="bold"><strong>Version 1.10</strong></span></th><th align="left"><span class="bold"><strong>Version 1.20</strong></span></th><th align="left"><span class="bold"><strong>Version 1.30</strong></span></th><th align="left"><span class="bold"><strong>Version 1.40</strong></span></th><th align="left"><span class="bold"><strong>Version 1.50</strong></span></th><th align="left"><span class="bold"><strong>Version 3.30</strong></span></th><th align="left"><span class="bold"><strong>Version 4.00</strong></span></th><th align="left"><span class="bold"><strong>Version 4.10</strong></span></th><th align="left"><span class="bold"><strong>Version 4.20</strong></span></th><th align="center"><span class="bold"><strong>Version 4.30</strong></span></th></tr><tr><th align="left">gl_Layer (geometry stage)</th><th align="center"><span class="emphasis"><em>-</em></span></th><th align="center"><span class="emphasis"><em>-</em></span></th><th align="center"><span class="emphasis"><em>-</em></span></th><th align="center"><span class="emphasis"><em>-</em></span></th><th align="center"><span class="emphasis"><em>Y</em></span></th><th align="center"><span class="emphasis"><em>Y</em></span></th><th align="center"><span class="emphasis"><em>Y</em></span></th><th align="center"><span class="emphasis"><em>Y</em></span></th><th align="center"><span class="emphasis"><em>Y</em></span></th><th align="center"><span class="emphasis"><em>Y</em></span></th></tr><tr><th align="left">gl_Layer (fragment stage)</th><th align="center"><span class="emphasis"><em>-</em></span></th><th align="center"><span class="emphasis"><em>-</em></span></th><th align="center"><span class="emphasis"><em>-</em></span></th><th align="center"><span class="emphasis"><em>-</em></span></th><th align="center"><span class="emphasis"><em>-</em></span></th><th align="center"><span class="emphasis"><em>-</em></span></th><th align="center"><span class="emphasis"><em>-</em></span></th><th align="center"><span class="emphasis"><em>-</em></span></th><th align="center"><span class="emphasis"><em>-</em></span></th><th align="center"><span class="emphasis"><em>Y</em></span></th></tr></thead></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p>
64 <a href="gl_ViewportIndex.xml"><span class="citerefentry"><span class="refentrytitle">gl_ViewportIndex</span></span></a>
65 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p>
66 Copyright <span class="trademark"></span>© 2011-2012 Khronos Group.
67 This material may be distributed subject to the terms and conditions set forth in
68 the Open Publication License, v 1.0, 8 June 1999.
69 <a href="http://opencontent.org/openpub/" target="_top">http://opencontent.org/openpub/</a>.
70 </p></div></div></body></html>