File: gl_Layer.xml

package info (click to toggle)
khronos-opengl-man4 1.0~svn33624-3
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 6,304 kB
  • sloc: xml: 93,066; makefile: 730; python: 627; javascript: 55; sh: 50; php: 4
file content (171 lines) | stat: -rw-r--r-- 8,571 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<!DOCTYPE refentry [ <!ENTITY % mathent SYSTEM "math.ent"> %mathent; ]>

<!-- Converted by db4-upgrade version 1.1 -->

<refentry xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="gl_Layer">
    <info>
        <copyright>
            <year>2012-2014</year>
            <holder>Khronos Group</holder>
        </copyright>
    </info>
    <refmeta>
        <refentrytitle>gl_Layer</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>gl_Layer</refname>
        <refpurpose>contains the selected layer of a multi-layer framebuffer attachment</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Declaration</title>
        <para>
            <programlisting>// Geometry stage</programlisting>
            <fieldsynopsis>
                <modifier>out</modifier>
                <type>int</type>
                <varname>gl_Layer</varname>
            </fieldsynopsis>
        </para>
        <para>
            <programlisting>// Fragment stage</programlisting>
            <fieldsynopsis>
                <modifier>in</modifier>
                <type>int</type>
                <varname>gl_Layer</varname>
            </fieldsynopsis>
        </para>
    </refsynopsisdiv>
    <refsect1 xml:id="description"><title>Description</title>
        <para>
            In the geometry language, <varname>gl_Layer</varname> is used to select a specific
            layer (or face and layer of cube map) in a multi-layer framebuffer attachment. The actual
            layer used will come from one of the vertices in the primitive being shaded. Which vertex
            the layer comes from is undefined and as such it is recommended to write the same value
            to <varname>gl_Layer</varname> for all vertices in the primitive. If a shader statically
            assigns a value to <varname>gl_Layer</varname>, layered rendering mode is enabled.
            If a shader statically assigns a value to <varname>gl_Layer</varname>, and there is an execution path through
            the shader that does not set <varname>gl_Layer</varname>, then the value of <varname>gl_Layer</varname>
            is undefined for invocations of the shader that take that path.
        </para>
        <para>
            When used with an array of cube map textures, the <varname>gl_Layer</varname> output variable
            takes on a special value. Instead of referring to only the layer, it is used to select a cube map
            face and a layer. Setting <varname>gl_Layer</varname> to the value
            <inlineequation><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></inlineequation>
            will render to <inlineequation><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi>face</mml:mi></mml:math></inlineequation>
            of the cube defined in <inlineequation><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi>layer</mml:mi></mml:math></inlineequation>.
            The face values are as follows:
        <informaltable>
            <tgroup cols="2" align="left">
                <colspec colwidth="1.1*"/>
                <colspec colwidth="1*" align="center"/>
                <thead>
                    <row>
                        <entry>
                            <emphasis role="bold"> Face Value </emphasis>
                        </entry> 
                        <entry>
                            <emphasis role="bold"> Resulting Target </emphasis>
                        </entry>
                    </row>
                </thead>
                <tbody>
                    <row>
                        <entry>
                            0
                        </entry>
                        <entry>
                            <constant>GL_TEXTURE_CUBEMAP_POSITIVE_X</constant>
                        </entry>
                    </row>
                    <row>
                        <entry>
                            1
                        </entry>
                        <entry>
                            <constant>GL_TEXTURE_CUBEMAP_NEGATIVE_X</constant>
                        </entry>
                    </row>
                    <row>
                        <entry>
                            2
                        </entry>
                        <entry>
                            <constant>GL_TEXTURE_CUBEMAP_POSITIVE_Y</constant>
                        </entry>
                    </row>
                    <row>
                        <entry>
                            3
                        </entry>
                        <entry>
                            <constant>GL_TEXTURE_CUBEMAP_NEGATIVE_Y</constant>
                        </entry>
                    </row>
                    <row>
                        <entry>
                            4
                        </entry>
                        <entry>
                            <constant>GL_TEXTURE_CUBEMAP_POSITIVE_Z</constant>
                        </entry>
                    </row>
                    <row>
                        <entry>
                            5
                        </entry>
                        <entry>
                            <constant>GL_TEXTURE_CUBEMAP_NEGATIVE_Z</constant>
                        </entry>
                    </row>
                </tbody>
            </tgroup>
        </informaltable>
        </para>
        <para>
            For example, to render to the positive y cube map face located in the 5<superscript>th</superscript> layer of the
            cube map array, <varname>gl_Layer</varname> should be set to
            <inlineequation><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></inlineequation>.
        </para>
        <para>
            The input variable <varname>gl_Layer</varname> in the fragment language will have the same value that was written to the
            output variable <varname>gl_Layer</varname> in the geometry language. If the geometry stage does not dynamically assign a
            value to <varname>gl_Layer</varname>, the value of <varname>gl_Layer</varname> in the fragment stage will be undefined.  If the geometry stage
            makes no static assignment to <varname>gl_Layer</varname>, the input <varname>gl_Layer</varname> in the fragment stage will be zero.  Otherwise,
            the fragment stage will read the same value written by the geometry stage, even if that value is out of
            range.  If a fragment shader contains a static access to <varname>gl_Layer</varname>, it will count against the implementation
            defined limit for the maximum number of inputs to the fragment stage.
        </para>
    </refsect1>
    <refsect1 xml:id="versions"><title>Version Support</title>
        <informaltable>
            <tgroup cols="13" align="left">
                <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="funchead.xml" xpointer="xpointer(/*/*)"/>
                <tbody>
                    <row>
                        <entry>gl_Layer (geometry stage)</entry>
                        <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="version.xml" xpointer="xpointer(/*/*[@role='15']/*)"/>
                    </row>
                    <row>
                        <entry>gl_Layer (fragment stage)</entry>
                        <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="version.xml" xpointer="xpointer(/*/*[@role='43']/*)"/>
                    </row>
                </tbody>
            </tgroup>
        </informaltable>
    </refsect1>
    <refsect1 xml:id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>gl_ViewportIndex</refentrytitle></citerefentry>
        </para>
    </refsect1>
    <refsect1 xml:id="Copyright"><title>Copyright</title>
        <para>
            Copyright <trademark class="copyright"/> 2011-2014 Khronos Group.
            This material may be distributed subject to the terms and conditions set forth in
            the Open Publication License, v 1.0, 8 June 1999.
            <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://opencontent.org/openpub/">http://opencontent.org/openpub/</link>.
        </para>
    </refsect1>
</refentry>