15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    ARB_geometry_shader4
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName String
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_ARB_geometry_shader4
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Pat Brown, NVIDIA (pbrown 'at' nvidia.com)
125bd8deadSopenharmony_ci    Barthold Lichtenbelt, NVIDIA (blichtenbelt 'at' nvidia.com)
135bd8deadSopenharmony_ci
145bd8deadSopenharmony_ciNotice
155bd8deadSopenharmony_ci
165bd8deadSopenharmony_ci    Copyright (c) 2008-2013 The Khronos Group Inc. Copyright terms at
175bd8deadSopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
185bd8deadSopenharmony_ci
195bd8deadSopenharmony_ciSpecification Update Policy
205bd8deadSopenharmony_ci
215bd8deadSopenharmony_ci    Khronos-approved extension specifications are updated in response to
225bd8deadSopenharmony_ci    issues and bugs prioritized by the Khronos OpenGL Working Group. For
235bd8deadSopenharmony_ci    extensions which have been promoted to a core Specification, fixes will
245bd8deadSopenharmony_ci    first appear in the latest version of that core Specification, and will
255bd8deadSopenharmony_ci    eventually be backported to the extension document. This policy is
265bd8deadSopenharmony_ci    described in more detail at
275bd8deadSopenharmony_ci        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
285bd8deadSopenharmony_ci
295bd8deadSopenharmony_ciStatus
305bd8deadSopenharmony_ci
315bd8deadSopenharmony_ci    Approved by the ARB on July 11, 2008
325bd8deadSopenharmony_ci
335bd8deadSopenharmony_ciVersion
345bd8deadSopenharmony_ci
355bd8deadSopenharmony_ci    Last Modified Date:         01/21/2011
365bd8deadSopenharmony_ci    NVIDIA Revision:            26
375bd8deadSopenharmony_ci
385bd8deadSopenharmony_ciNumber
395bd8deadSopenharmony_ci
405bd8deadSopenharmony_ci    ARB Extension #47
415bd8deadSopenharmony_ci
425bd8deadSopenharmony_ciDependencies
435bd8deadSopenharmony_ci
445bd8deadSopenharmony_ci    OpenGL 1.1 is required.
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ci    This extension is written against the OpenGL 2.0 specification.
475bd8deadSopenharmony_ci
485bd8deadSopenharmony_ci    EXT_framebuffer_object interacts with this extension.
495bd8deadSopenharmony_ci
505bd8deadSopenharmony_ci    EXT_framebuffer_blit interacts with this extension.
515bd8deadSopenharmony_ci
525bd8deadSopenharmony_ci    EXT_texture_array interacts with this extension.
535bd8deadSopenharmony_ci
545bd8deadSopenharmony_ci    ARB_texture_rectangle trivially affects the definition of this
555bd8deadSopenharmony_ci    extension.
565bd8deadSopenharmony_ci
575bd8deadSopenharmony_ci    ARB_texture_buffer_object trivially affects the definition of this
585bd8deadSopenharmony_ci    extension.
595bd8deadSopenharmony_ci
605bd8deadSopenharmony_ci    NV_primitive_restart trivially affects the definition of this
615bd8deadSopenharmony_ci    extension.
625bd8deadSopenharmony_ci
635bd8deadSopenharmony_ci    This extension interacts with ARB_tranform_feedback.
645bd8deadSopenharmony_ci
655bd8deadSopenharmony_ci    This extension interacts with geometry shader support in OpenGL 3.2.
665bd8deadSopenharmony_ci
675bd8deadSopenharmony_ci    This extension interacts with ARB_uniform_buffer_object.
685bd8deadSopenharmony_ci
695bd8deadSopenharmony_ciOverview
705bd8deadSopenharmony_ci
715bd8deadSopenharmony_ci    ARB_geometry_shader4 defines a new shader type available to be run on the
725bd8deadSopenharmony_ci    GPU, called a geometry shader. Geometry shaders are run after vertices are
735bd8deadSopenharmony_ci    transformed, but prior to color clamping, flat shading and clipping.
745bd8deadSopenharmony_ci
755bd8deadSopenharmony_ci    A geometry shader begins with a single primitive (point, line,
765bd8deadSopenharmony_ci    triangle). It can read the attributes of any of the vertices in the
775bd8deadSopenharmony_ci    primitive and use them to generate new primitives. A geometry shader has a
785bd8deadSopenharmony_ci    fixed output primitive type (point, line strip, or triangle strip) and
795bd8deadSopenharmony_ci    emits vertices to define a new primitive. A geometry shader can emit
805bd8deadSopenharmony_ci    multiple disconnected primitives. The primitives emitted by the geometry
815bd8deadSopenharmony_ci    shader are clipped and then processed like an equivalent OpenGL primitive
825bd8deadSopenharmony_ci    specified by the application.
835bd8deadSopenharmony_ci
845bd8deadSopenharmony_ci    Furthermore, ARB_geometry_shader4 provides four additional primitive
855bd8deadSopenharmony_ci    types: lines with adjacency, line strips with adjacency, separate
865bd8deadSopenharmony_ci    triangles with adjacency, and triangle strips with adjacency.  Some of the
875bd8deadSopenharmony_ci    vertices specified in these new primitive types are not part of the
885bd8deadSopenharmony_ci    ordinary primitives, instead they represent neighboring vertices that are
895bd8deadSopenharmony_ci    adjacent to the two line segment end points (lines/strips) or the three
905bd8deadSopenharmony_ci    triangle edges (triangles/tstrips). These vertices can be accessed by
915bd8deadSopenharmony_ci    geometry shaders and used to match up the vertices emitted by the geometry
925bd8deadSopenharmony_ci    shader with those of neighboring primitives.
935bd8deadSopenharmony_ci
945bd8deadSopenharmony_ci    Since geometry shaders expect a specific input primitive type, an error
955bd8deadSopenharmony_ci    will occur if the application presents primitives of a different type.
965bd8deadSopenharmony_ci    For example, if a geometry shader expects points, an error will occur at
975bd8deadSopenharmony_ci    Begin() time, if a primitive mode of TRIANGLES is specified.
985bd8deadSopenharmony_ci
995bd8deadSopenharmony_ciNew Procedures and Functions
1005bd8deadSopenharmony_ci
1015bd8deadSopenharmony_ci    void ProgramParameteriARB(uint program, enum pname, int value);
1025bd8deadSopenharmony_ci    void FramebufferTextureARB(enum target, enum attachment, 
1035bd8deadSopenharmony_ci                               uint texture, int level);
1045bd8deadSopenharmony_ci    void FramebufferTextureLayerARB(enum target, enum attachment, 
1055bd8deadSopenharmony_ci                                    uint texture, int level, int layer);
1065bd8deadSopenharmony_ci    void FramebufferTextureFaceARB(enum target, enum attachment,
1075bd8deadSopenharmony_ci                                   uint texture, int level, enum face);
1085bd8deadSopenharmony_ci
1095bd8deadSopenharmony_ciNew Tokens
1105bd8deadSopenharmony_ci
1115bd8deadSopenharmony_ci    Accepted by the <type> parameter of CreateShader and returned by the
1125bd8deadSopenharmony_ci    <params> parameter of GetShaderiv:
1135bd8deadSopenharmony_ci
1145bd8deadSopenharmony_ci        GEOMETRY_SHADER_ARB                             0x8DD9
1155bd8deadSopenharmony_ci
1165bd8deadSopenharmony_ci    Accepted by the <pname> parameter of ProgramParameteriARB and
1175bd8deadSopenharmony_ci    GetProgramiv:
1185bd8deadSopenharmony_ci
1195bd8deadSopenharmony_ci        GEOMETRY_VERTICES_OUT_ARB                       0x8DDA
1205bd8deadSopenharmony_ci        GEOMETRY_INPUT_TYPE_ARB                         0x8DDB
1215bd8deadSopenharmony_ci        GEOMETRY_OUTPUT_TYPE_ARB                        0x8DDC
1225bd8deadSopenharmony_ci
1235bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
1245bd8deadSopenharmony_ci    GetFloatv, and GetDoublev:
1255bd8deadSopenharmony_ci
1265bd8deadSopenharmony_ci        MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB             0x8C29
1275bd8deadSopenharmony_ci        MAX_GEOMETRY_VARYING_COMPONENTS_ARB              0x8DDD
1285bd8deadSopenharmony_ci        MAX_VERTEX_VARYING_COMPONENTS_ARB                0x8DDE
1295bd8deadSopenharmony_ci        MAX_VARYING_COMPONENTS
1305bd8deadSopenharmony_ci        MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB              0x8DDF
1315bd8deadSopenharmony_ci        MAX_GEOMETRY_OUTPUT_VERTICES_ARB                 0x8DE0
1325bd8deadSopenharmony_ci        MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB         0x8DE1
1335bd8deadSopenharmony_ci
1345bd8deadSopenharmony_ci    Accepted by the <mode> parameter of Begin, DrawArrays,
1355bd8deadSopenharmony_ci    MultiDrawArrays, DrawElements, MultiDrawElements, and
1365bd8deadSopenharmony_ci    DrawRangeElements:
1375bd8deadSopenharmony_ci
1385bd8deadSopenharmony_ci        LINES_ADJACENCY_ARB                              0xA
1395bd8deadSopenharmony_ci        LINE_STRIP_ADJACENCY_ARB                         0xB
1405bd8deadSopenharmony_ci        TRIANGLES_ADJACENCY_ARB                          0xC
1415bd8deadSopenharmony_ci        TRIANGLE_STRIP_ADJACENCY_ARB                     0xD
1425bd8deadSopenharmony_ci
1435bd8deadSopenharmony_ci    Returned by CheckFramebufferStatusARB:
1445bd8deadSopenharmony_ci
1455bd8deadSopenharmony_ci        FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB         0x8DA8
1465bd8deadSopenharmony_ci        FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB           0x8DA9
1475bd8deadSopenharmony_ci
1485bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetFramebufferAttachment-
1495bd8deadSopenharmony_ci    ParameterivARB:
1505bd8deadSopenharmony_ci
1515bd8deadSopenharmony_ci        FRAMEBUFFER_ATTACHMENT_LAYERED_ARB               0x8DA7
1525bd8deadSopenharmony_ci        FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER             0x8CD4
1535bd8deadSopenharmony_ci
1545bd8deadSopenharmony_ci    Accepted by the <cap> parameter of Enable, Disable, and IsEnabled,
1555bd8deadSopenharmony_ci    and by the <pname> parameter of GetIntegerv, GetFloatv, GetDoublev,
1565bd8deadSopenharmony_ci    and GetBooleanv:
1575bd8deadSopenharmony_ci
1585bd8deadSopenharmony_ci        PROGRAM_POINT_SIZE_ARB                           0x8642
1595bd8deadSopenharmony_ci
1605bd8deadSopenharmony_ci    (Note: FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER is simply an alias for the
1615bd8deadSopenharmony_ci    FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_ARB token provided in
1625bd8deadSopenharmony_ci    EXT_framebuffer_object.  This extension generalizes the notion of
1635bd8deadSopenharmony_ci    "<zoffset>" to include layers of an array texture.)
1645bd8deadSopenharmony_ci
1655bd8deadSopenharmony_ci    (Note:  PROGRAM_POINT_SIZE_ARB is simply an alias for the
1665bd8deadSopenharmony_ci    VERTEX_PROGRAM_POINT_SIZE token provided in OpenGL 2.0, which is itself an
1675bd8deadSopenharmony_ci    alias for VERTEX_PROGRAM_POINT_SIZE_ARB provided by
1685bd8deadSopenharmony_ci    ARB_vertex_program. Program-computed point sizes can be enabled if
1695bd8deadSopenharmony_ci    geometry shaders are enabled.)
1705bd8deadSopenharmony_ci
1715bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 2.0 Specification (OpenGL
1725bd8deadSopenharmony_ciOperation)
1735bd8deadSopenharmony_ci
1745bd8deadSopenharmony_ci    Modify Section 2.6.1 (Begin and End Objects), p. 13
1755bd8deadSopenharmony_ci
1765bd8deadSopenharmony_ci    (Add to end of section, p. 18)
1775bd8deadSopenharmony_ci
1785bd8deadSopenharmony_ci    (add figure on discussions of lines and line strips with adjacency)
1795bd8deadSopenharmony_ci
1805bd8deadSopenharmony_ci        1 - - - 2----->3 - - - 4     1 - - - 2--->3--->4--->5 - - - 6
1815bd8deadSopenharmony_ci
1825bd8deadSopenharmony_ci        5 - - - 6----->7 - - - 8
1835bd8deadSopenharmony_ci
1845bd8deadSopenharmony_ci               (a)                             (b)
1855bd8deadSopenharmony_ci
1865bd8deadSopenharmony_ci      Figure 2.X1 (a) Lines with adjacency, (b) Line strip with adjacency.
1875bd8deadSopenharmony_ci      The vertices connected with solid lines belong to the main primitives;
1885bd8deadSopenharmony_ci      the vertices connected by dashed lines are the adjacent vertices that
1895bd8deadSopenharmony_ci      may be used in a geometry shader.
1905bd8deadSopenharmony_ci
1915bd8deadSopenharmony_ci    Lines with Adjacency
1925bd8deadSopenharmony_ci
1935bd8deadSopenharmony_ci    Lines with adjacency are independent line segments where each endpoint has
1945bd8deadSopenharmony_ci    a corresponding "adjacent" vertex that can be accessed by a geometry
1955bd8deadSopenharmony_ci    shader (Section 2.16).  If a geometry shader is not active, the "adjacent"
1965bd8deadSopenharmony_ci    vertices are ignored.
1975bd8deadSopenharmony_ci
1985bd8deadSopenharmony_ci    A line segment is drawn from the 4i + 2nd vertex to the 4i + 3rd vertex
1995bd8deadSopenharmony_ci    for each i = 0, 1, ... , n-1, where there are 4n+k vertices between the
2005bd8deadSopenharmony_ci    Begin and End.  k is either 0, 1, 2, or 3; if k is not zero, the final k
2015bd8deadSopenharmony_ci    vertices are ignored.  For line segment i, the 4i + 1st and 4i + 4th
2025bd8deadSopenharmony_ci    vertices are considered adjacent to the 4i + 2nd and 4i + 3rd vertices,
2035bd8deadSopenharmony_ci    respectively.  See Figure 2.X1.
2045bd8deadSopenharmony_ci
2055bd8deadSopenharmony_ci    Lines with adjacency are generated by calling Begin with the argument
2065bd8deadSopenharmony_ci    value LINES_ADJACENCY_ARB.
2075bd8deadSopenharmony_ci
2085bd8deadSopenharmony_ci    Line Strips with Adjacency
2095bd8deadSopenharmony_ci
2105bd8deadSopenharmony_ci    Line strips with adjacency are similar to line strips, except that each
2115bd8deadSopenharmony_ci    line segment has a pair of adjacent vertices that can be accessed by a
2125bd8deadSopenharmony_ci    geometry shader (Section 2.15).  If a geometry shader is not active, the
2135bd8deadSopenharmony_ci    "adjacent" vertices are ignored.
2145bd8deadSopenharmony_ci
2155bd8deadSopenharmony_ci    A line segment is drawn from the i + 2nd vertex to the i + 3rd vertex for
2165bd8deadSopenharmony_ci    each i = 0, 1, ..., n-1, where there are n+3 vertices between the Begin
2175bd8deadSopenharmony_ci    and End.  If there are fewer than four vertices between a Begin and End,
2185bd8deadSopenharmony_ci    all vertices are ignored.  For line segment i, the i + 1st and i + 4th
2195bd8deadSopenharmony_ci    vertex are considered adjacent to the i + 2nd and i + 3rd vertices,
2205bd8deadSopenharmony_ci    respectively.  See Figure 2.X1.
2215bd8deadSopenharmony_ci
2225bd8deadSopenharmony_ci    Line strips with adjacency are generated by calling Begin with the
2235bd8deadSopenharmony_ci    argument value LINE_STRIP_ADJACENCY_ARB.
2245bd8deadSopenharmony_ci
2255bd8deadSopenharmony_ci    --------------------------------------------------------------------
2265bd8deadSopenharmony_ci
2275bd8deadSopenharmony_ci    (add figure and discussion of triangles with adjacency)
2285bd8deadSopenharmony_ci
2295bd8deadSopenharmony_ci                   2 - - - 3 - - - 4     8 - - - 9 - - - 10
2305bd8deadSopenharmony_ci                           ^\                    ^\
2315bd8deadSopenharmony_ci                     \     | \     |       \     | \     |
2325bd8deadSopenharmony_ci                           |  \                  |  \
2335bd8deadSopenharmony_ci                       \   |   \   |         \   |   \   |
2345bd8deadSopenharmony_ci                           |    \                |    \
2355bd8deadSopenharmony_ci                         \ |     \ |           \ |     \ |
2365bd8deadSopenharmony_ci                           |      v              |      v
2375bd8deadSopenharmony_ci                           1<------5             7<------11
2385bd8deadSopenharmony_ci
2395bd8deadSopenharmony_ci                             \     |               \     |
2405bd8deadSopenharmony_ci
2415bd8deadSopenharmony_ci                               \   |                 \   |
2425bd8deadSopenharmony_ci
2435bd8deadSopenharmony_ci                                 \ |                   \ |
2445bd8deadSopenharmony_ci
2455bd8deadSopenharmony_ci                                   6                     12
2465bd8deadSopenharmony_ci
2475bd8deadSopenharmony_ci      Figure 2.X2 Triangles with adjacency.  The vertices connected with solid
2485bd8deadSopenharmony_ci      lines belong to the main primitive; the vertices connected by dashed
2495bd8deadSopenharmony_ci      lines are the adjacent vertices that may be used in a geometry shader.
2505bd8deadSopenharmony_ci
2515bd8deadSopenharmony_ci    Triangles with Adjacency
2525bd8deadSopenharmony_ci
2535bd8deadSopenharmony_ci    Triangles with adjacency are similar to separate triangles, except that
2545bd8deadSopenharmony_ci    each triangle edge has an adjacent vertex that can be accessed by a
2555bd8deadSopenharmony_ci    geometry shader (Section 2.15).  If a geometry shader is not active, the
2565bd8deadSopenharmony_ci    "adjacent" vertices are ignored.
2575bd8deadSopenharmony_ci
2585bd8deadSopenharmony_ci    The 6i + 1st, 6i + 3rd, and 6i + 5th vertices (in that order) determine a
2595bd8deadSopenharmony_ci    triangle for each i = 0, 1, ..., n-1, where there are 6n+k vertices
2605bd8deadSopenharmony_ci    between the Begin and End.  k is either 0, 1, 2, 3, 4, or 5; if k is
2615bd8deadSopenharmony_ci    non-zero, the final k vertices are ignored.  For triangle i, the i + 2nd,
2625bd8deadSopenharmony_ci    i + 4th, and i + 6th vertices are considered adjacent to edges from the i
2635bd8deadSopenharmony_ci    + 1st to the i + 3rd, from the i + 3rd to the i + 5th, and from the i +
2645bd8deadSopenharmony_ci    5th to the i + 1st vertices, respectively.  See Figure 2.X2.
2655bd8deadSopenharmony_ci
2665bd8deadSopenharmony_ci    Triangles with adjacency are generated by calling Begin with the argument
2675bd8deadSopenharmony_ci    value TRIANGLES_ADJACENCY_ARB.
2685bd8deadSopenharmony_ci
2695bd8deadSopenharmony_ci    --------------------------------------------------------------------
2705bd8deadSopenharmony_ci
2715bd8deadSopenharmony_ci    (add figure and discussion of triangle strips with adjacency)
2725bd8deadSopenharmony_ci
2735bd8deadSopenharmony_ci                                  6                     6
2745bd8deadSopenharmony_ci
2755bd8deadSopenharmony_ci                                  | \                   | \
2765bd8deadSopenharmony_ci
2775bd8deadSopenharmony_ci                                  |   \                 |   \
2785bd8deadSopenharmony_ci
2795bd8deadSopenharmony_ci                                  |     \               |     \
2805bd8deadSopenharmony_ci
2815bd8deadSopenharmony_ci      2 - - - 3- - - >6   2 - - - 3------>7     2 - - - 3------>7- - - 10
2825bd8deadSopenharmony_ci              ^\                  ^^      |             ^^      ^^      |
2835bd8deadSopenharmony_ci        \     | \     |     \     | \     | \     \     | \     | \
2845bd8deadSopenharmony_ci              |  \                |  \    |             |  \    |  \    |
2855bd8deadSopenharmony_ci          \   |   \   |       \   |   \   |   \     \   |   \   |   \
2865bd8deadSopenharmony_ci              |    \              |    \  |             |    \  |    \  |
2875bd8deadSopenharmony_ci            \ |     \ |         \ |     \ |     \     \ |     \ |     \
2885bd8deadSopenharmony_ci              |      v            |      vv             |      vv      v|
2895bd8deadSopenharmony_ci              1<------5           1<------5 - - - 8     1<------5<------9
2905bd8deadSopenharmony_ci
2915bd8deadSopenharmony_ci                \     |             \     |               \     | \     |
2925bd8deadSopenharmony_ci
2935bd8deadSopenharmony_ci                  \   |               \   |                 \   |   \   |
2945bd8deadSopenharmony_ci
2955bd8deadSopenharmony_ci                    \ |                 \ |                   \ |     \ |
2965bd8deadSopenharmony_ci
2975bd8deadSopenharmony_ci                      4                   4                     4       8
2985bd8deadSopenharmony_ci
2995bd8deadSopenharmony_ci
3005bd8deadSopenharmony_ci                                   6       10
3015bd8deadSopenharmony_ci
3025bd8deadSopenharmony_ci                                   | \     | \
3035bd8deadSopenharmony_ci
3045bd8deadSopenharmony_ci                                   |   \   |   \
3055bd8deadSopenharmony_ci
3065bd8deadSopenharmony_ci                                   |     \ |     \
3075bd8deadSopenharmony_ci                           2 - - - 3------>7------>11
3085bd8deadSopenharmony_ci                                   ^^      ^^      |
3095bd8deadSopenharmony_ci                             \     | \     | \     | \
3105bd8deadSopenharmony_ci                                   |  \    |  \    |
3115bd8deadSopenharmony_ci                               \   |   \   |   \   |   \
3125bd8deadSopenharmony_ci                                   |    \  |    \  |
3135bd8deadSopenharmony_ci                                 \ |     \ |     \ |     \
3145bd8deadSopenharmony_ci                                   |      vv      vv
3155bd8deadSopenharmony_ci                                   1<------5<------9 - - - 12
3165bd8deadSopenharmony_ci
3175bd8deadSopenharmony_ci                                     \     | \     |
3185bd8deadSopenharmony_ci
3195bd8deadSopenharmony_ci                                       \   |   \   |
3205bd8deadSopenharmony_ci
3215bd8deadSopenharmony_ci                                         \ |     \ |
3225bd8deadSopenharmony_ci
3235bd8deadSopenharmony_ci                                           4       8
3245bd8deadSopenharmony_ci
3255bd8deadSopenharmony_ci      Figure 2.X3 Triangle strips with adjacency.  The vertices connected with
3265bd8deadSopenharmony_ci      solid lines belong to the main primitives; the vertices connected by
3275bd8deadSopenharmony_ci      dashed lines are the adjacent vertices that may be used in a geometry
3285bd8deadSopenharmony_ci      shader.
3295bd8deadSopenharmony_ci
3305bd8deadSopenharmony_ci    Triangle Strips with Adjacency
3315bd8deadSopenharmony_ci
3325bd8deadSopenharmony_ci    Triangle strips with adjacency are similar to triangle strips, except that
3335bd8deadSopenharmony_ci    each triangle edge has an adjacent vertex that can be accessed by a
3345bd8deadSopenharmony_ci    geometry shader (Section 2.15).  If a geometry shader is not active, the
3355bd8deadSopenharmony_ci    "adjacent" vertices are ignored.
3365bd8deadSopenharmony_ci
3375bd8deadSopenharmony_ci    In triangle strips with adjacency, n triangles are drawn using 2 * (n+2) +
3385bd8deadSopenharmony_ci    k vertices between the Begin and End.  k is either 0 or 1; if k is 1, the
3395bd8deadSopenharmony_ci    final vertex is ignored.  If fewer than 6 vertices are specified between
3405bd8deadSopenharmony_ci    the Begin and End, the entire primitive is ignored.  Table 2.X1 describes
3415bd8deadSopenharmony_ci    the vertices and order used to draw each triangle, and which vertices are
3425bd8deadSopenharmony_ci    considered adjacent to each edge of the triangle.  See Figure 2.X3.
3435bd8deadSopenharmony_ci
3445bd8deadSopenharmony_ci    (add table)
3455bd8deadSopenharmony_ci                                 primitive          adjacent
3465bd8deadSopenharmony_ci                                 vertices           vertices
3475bd8deadSopenharmony_ci      primitive               1st   2nd   3rd     1/2  2/3  3/1
3485bd8deadSopenharmony_ci      ---------------        ----  ----  ----    ---- ---- ----
3495bd8deadSopenharmony_ci      only (i==0, n==1)        1     3     5       2    6    4
3505bd8deadSopenharmony_ci      first (i==0)             1     3     5       2    7    4
3515bd8deadSopenharmony_ci      middle (i odd)         2i+3  2i+1  2i+5    2i-1 2i+4 2i+7
3525bd8deadSopenharmony_ci      middle (i even)        2i+1  2i+3  2i+5    2i-1 2i+7 2i+4
3535bd8deadSopenharmony_ci      last (i==n-1, i odd)   2i+3  2i+1  2i+5    2i-1 2i+4 2i+6
3545bd8deadSopenharmony_ci      last (i==n-1, i even)  2i+1  2i+3  2i+5    2i-1 2i+6 2i+4
3555bd8deadSopenharmony_ci
3565bd8deadSopenharmony_ci      Table 2.X1:  Triangles generated by triangle strips with adjacency.
3575bd8deadSopenharmony_ci      Each triangle is drawn using the vertices in the "1st", "2nd", and "3rd"
3585bd8deadSopenharmony_ci      columns under "primitive vertices", in that order.  The vertices in the
3595bd8deadSopenharmony_ci      "1/2", "2/3", and "3/1" columns under "adjacent vertices" are considered
3605bd8deadSopenharmony_ci      adjacent to the edges from the first to the second, from the second to
3615bd8deadSopenharmony_ci      the third, and from the third to the first vertex of the triangle,
3625bd8deadSopenharmony_ci      respectively.  The six rows correspond to the six cases:  the first and
3635bd8deadSopenharmony_ci      only triangle (i=0, n=1), the first triangle of several (i=0, n>0),
3645bd8deadSopenharmony_ci      "odd" middle triangles (i=1,3,5...), "even" middle triangles
3655bd8deadSopenharmony_ci      (i=2,4,6,...), and special cases for the last triangle inside the
3665bd8deadSopenharmony_ci      Begin/End, when i is either even or odd.  For the purposes of this
3675bd8deadSopenharmony_ci      table, the first vertex specified after Begin is numbered "1" and the
3685bd8deadSopenharmony_ci      first triangle is numbered "0".
3695bd8deadSopenharmony_ci
3705bd8deadSopenharmony_ci    Triangle strips with adjacency are generated by calling Begin with the
3715bd8deadSopenharmony_ci    argument value TRIANGLE_STRIP_ADJACENCY_ARB.
3725bd8deadSopenharmony_ci
3735bd8deadSopenharmony_ci    Modify Section 2.14.1, Lighting (p. 59)
3745bd8deadSopenharmony_ci
3755bd8deadSopenharmony_ci    (modify fourth paragraph, p. 63) Additionally, vertex and geometry shaders
3765bd8deadSopenharmony_ci    can operate in two-sided color mode, which is enabled and disabled by
3775bd8deadSopenharmony_ci    calling Enable or Disable with the symbolic value VERTEX_PROGRAM_TWO_SIDE.
3785bd8deadSopenharmony_ci    When a vertex or geometry shader is active, the shaders can write front
3795bd8deadSopenharmony_ci    and back color values to the gl_FrontColor, gl_BackColor,
3805bd8deadSopenharmony_ci    gl_FrontSecondaryColor and gl_BackSecondaryColor outputs. When a vertex or
3815bd8deadSopenharmony_ci    geometry shader is active and two-sided color mode is enabled, the GL
3825bd8deadSopenharmony_ci    chooses between front and back colors, as described below.  If two-sided
3835bd8deadSopenharmony_ci    color mode is disabled, the front color output is always selected.
3845bd8deadSopenharmony_ci
3855bd8deadSopenharmony_ci    Modify Section 2.15.2 Program Objects, p. 73
3865bd8deadSopenharmony_ci
3875bd8deadSopenharmony_ci    Change the first paragraph on p. 74 as follows:
3885bd8deadSopenharmony_ci
3895bd8deadSopenharmony_ci    Program objects are empty when they are created.  Default values for
3905bd8deadSopenharmony_ci    program object parameters are discussed in section 2.15.5, Required
3915bd8deadSopenharmony_ci    State. A non-zero name that can be used to reference the program object is
3925bd8deadSopenharmony_ci    returned.
3935bd8deadSopenharmony_ci
3945bd8deadSopenharmony_ci    Change the language below the LinkProgram command on p. 74 as follows:
3955bd8deadSopenharmony_ci
3965bd8deadSopenharmony_ci    ... Linking can fail for a variety of reasons as specified in the OpenGL
3975bd8deadSopenharmony_ci    Shading Language Specification. Linking will also fail if one or more of
3985bd8deadSopenharmony_ci    the shader objects, attached to <program> are not compiled successfully,
3995bd8deadSopenharmony_ci    or if more active uniform or active sampler variables are used in
4005bd8deadSopenharmony_ci    <program> than allowed (see sections 2.15.3 and 2.16.3). Linking will also
4015bd8deadSopenharmony_ci    fail if the program object contains objects to form a geometry shader (see
4025bd8deadSopenharmony_ci    section 2.16), but no objects to form a vertex shader or if the program
4035bd8deadSopenharmony_ci    object contains objects to form a geometry shader, and the value of
4045bd8deadSopenharmony_ci    GEOMETRY_VERTICES_OUT_ARB is zero. If LinkProgram failed, ..
4055bd8deadSopenharmony_ci
4065bd8deadSopenharmony_ci    Add the following paragraphs above the description of
4075bd8deadSopenharmony_ci    DeleteProgram, p. 75:
4085bd8deadSopenharmony_ci
4095bd8deadSopenharmony_ci    To set a program object parameter, call
4105bd8deadSopenharmony_ci
4115bd8deadSopenharmony_ci        void ProgramParameteriARB(uint program, enum pname, int value)
4125bd8deadSopenharmony_ci
4135bd8deadSopenharmony_ci    <param> identifies which parameter to set for <program>. <value> holds the
4145bd8deadSopenharmony_ci    value being set.  Legal values for <param> and <value> are discussed in
4155bd8deadSopenharmony_ci    section 2.16.
4165bd8deadSopenharmony_ci
4175bd8deadSopenharmony_ci    Modify Section 2.15.3, Shader Variables, p. 75
4185bd8deadSopenharmony_ci
4195bd8deadSopenharmony_ci    Modify the first paragraph of section 'Varying Variables' p. 83 as
4205bd8deadSopenharmony_ci    follows:
4215bd8deadSopenharmony_ci
4225bd8deadSopenharmony_ci    A vertex shader may define one or more varying variables (see the OpenGL
4235bd8deadSopenharmony_ci    Shading Language specification). Varying variables are outputs of a vertex
4245bd8deadSopenharmony_ci    shader. They are either used as the mechanism to communicate values to a
4255bd8deadSopenharmony_ci    geometry shader, if one is active, or to communicate values to the
4265bd8deadSopenharmony_ci    fragment shader.  The OpenGL Shading Language specification also defines a
4275bd8deadSopenharmony_ci    set of built-in varying variables that vertex shaders can write to (see
4285bd8deadSopenharmony_ci    section 7.6 of the OpenGL Shading Language Specification). These variables
4295bd8deadSopenharmony_ci    can also be used to communicate values to a geometry shader, if one is
4305bd8deadSopenharmony_ci    active, or to communicate values to the fragment shader and to the fixed-
4315bd8deadSopenharmony_ci    function processing that occurs after vertex shading.
4325bd8deadSopenharmony_ci
4335bd8deadSopenharmony_ci    If a geometry shader is not active, the values of all varying variables,
4345bd8deadSopenharmony_ci    including built-in variables, are expected to be interpolated across the
4355bd8deadSopenharmony_ci    primitive being rendered, unless flat shaded. The number of interpolators
4365bd8deadSopenharmony_ci    available for processing varying variables is given by the
4375bd8deadSopenharmony_ci    implementation-dependent constant MAX_VARYING_COMPONENTS. This value
4385bd8deadSopenharmony_ci    represents the number of individual components that can be interpolated;
4395bd8deadSopenharmony_ci    varying variables declared as vectors, matrices, and arrays will all
4405bd8deadSopenharmony_ci    consume multiple interpolators. When a program is linked, all components
4415bd8deadSopenharmony_ci    of any varying variable written by a vertex shader, or read by a fragment
4425bd8deadSopenharmony_ci    shader, will count against this limit. The transformed vertex position
4435bd8deadSopenharmony_ci    (gl_Position) does not count against this limit. A program whose vertex
4445bd8deadSopenharmony_ci    and/or fragment shaders access more than MAX_VARYING_COMPONENTS
4455bd8deadSopenharmony_ci    components worth of varying variables may fail to link, unless
4465bd8deadSopenharmony_ci    device-dependent optimizations are able to make the program fit within
4475bd8deadSopenharmony_ci    available hardware resources.
4485bd8deadSopenharmony_ci
4495bd8deadSopenharmony_ci    Note that the two values MAX_VARYING_FLOATS and MAX_VARYING_COMPONENTS
4505bd8deadSopenharmony_ci    are aliases of each other. The use of MAX_VARYING_FLOATS however is
4515bd8deadSopenharmony_ci    discouraged; varying variables can be declared as integers as well.
4525bd8deadSopenharmony_ci
4535bd8deadSopenharmony_ci    If a geometry shader is active, the values of varying variables are
4545bd8deadSopenharmony_ci    collected by the primitive assembly stage and passed on to the geometry
4555bd8deadSopenharmony_ci    shader once enough data for one primitive has been collected (see also
4565bd8deadSopenharmony_ci    section 2.16). The OpenGL Shading Language specification also defines a
4575bd8deadSopenharmony_ci    set of built-in varying and built-in special variables that vertex shaders
4585bd8deadSopenharmony_ci    can write to (see sections 7.1 and 7.6 of the OpenGL Shading Language
4595bd8deadSopenharmony_ci    Specification). These variables are also collected and passed on to the
4605bd8deadSopenharmony_ci    geometry shader once enough data has been collected. The number of
4615bd8deadSopenharmony_ci    components of varying and special variables that can be collected per
4625bd8deadSopenharmony_ci    vertex by the primitive assembly stage is given by the implementation
4635bd8deadSopenharmony_ci    dependent constant MAX_VERTEX_VARYING_COMPONENTS_ARB. This value
4645bd8deadSopenharmony_ci    represents the number of individual components that can be collected;
4655bd8deadSopenharmony_ci    varying variables declared as vectors, matrices, and arrays will all
4665bd8deadSopenharmony_ci    consume multiple components. When a program is linked, all components of
4675bd8deadSopenharmony_ci    any varying variable written by a vertex shader, or read by a geometry
4685bd8deadSopenharmony_ci    shader, will count against this limit. A program whose vertex and/or
4695bd8deadSopenharmony_ci    geometry shaders access more than MAX_VERTEX_VARYING_COMPONENTS_ARB
4705bd8deadSopenharmony_ci    components worth of varying variables may fail to link, unless
4715bd8deadSopenharmony_ci    device-dependent optimizations are able to make the program fit within
4725bd8deadSopenharmony_ci    available hardware resources.
4735bd8deadSopenharmony_ci
4745bd8deadSopenharmony_ci    Modify Section 2.15.4 Shader Execution, p. 84
4755bd8deadSopenharmony_ci
4765bd8deadSopenharmony_ci    Change the following sentence:
4775bd8deadSopenharmony_ci
4785bd8deadSopenharmony_ci    "The following operations are applied to vertex values that are the result
4795bd8deadSopenharmony_ci    of executing the vertex shader:"
4805bd8deadSopenharmony_ci
4815bd8deadSopenharmony_ci    As follows:
4825bd8deadSopenharmony_ci
4835bd8deadSopenharmony_ci    If no geometry shader (see section 2.16) is present in the program object,
4845bd8deadSopenharmony_ci    the following operations are applied to vertex values that are the result
4855bd8deadSopenharmony_ci    of executing the vertex shader:
4865bd8deadSopenharmony_ci
4875bd8deadSopenharmony_ci    [bulleted list of operations]
4885bd8deadSopenharmony_ci
4895bd8deadSopenharmony_ci    On page 85, below the list of bullets, add the following:
4905bd8deadSopenharmony_ci
4915bd8deadSopenharmony_ci    If a geometry shader is present in the program object, geometry shading
4925bd8deadSopenharmony_ci    (section 2.16) is applied to vertex values that are the result of
4935bd8deadSopenharmony_ci    executing the vertex shader.
4945bd8deadSopenharmony_ci
4955bd8deadSopenharmony_ci    Modify the first paragraph of the section 'Texture Access', p. 85,
4965bd8deadSopenharmony_ci    as follows:
4975bd8deadSopenharmony_ci
4985bd8deadSopenharmony_ci    Vertex shaders have the ability to do a lookup into a texture map, if
4995bd8deadSopenharmony_ci    supported by the GL implementation. The maximum number of texture image
5005bd8deadSopenharmony_ci    units available to a vertex shader is MAX_VERTEX_TEXTURE_IMAGE_UNITS; a
5015bd8deadSopenharmony_ci    maximum number of zero indicates that the GL implementation does not
5025bd8deadSopenharmony_ci    support texture accesses in vertex shaders.  The vertex shader, geometry
5035bd8deadSopenharmony_ci    shader, if exists, and fragment processing combined cannot use more than
5045bd8deadSopenharmony_ci    MAX_COMBINED_TEXTURE_IMAGE_UNITS texture image units. If the vertex
5055bd8deadSopenharmony_ci    shader, geometry shader and the fragment processing stage access the same
5065bd8deadSopenharmony_ci    texture image unit, then that counts as using three texture image units
5075bd8deadSopenharmony_ci    against the MAX_COMBINED_TEXTURE_IMAGE_UNITS limit.
5085bd8deadSopenharmony_ci
5095bd8deadSopenharmony_ci    Modify Section 2.15.5, Required State, p. 88
5105bd8deadSopenharmony_ci
5115bd8deadSopenharmony_ci    Add the following bullets to the state required per program object:
5125bd8deadSopenharmony_ci
5135bd8deadSopenharmony_ci      * One integer to store the value of GEOMETRY_VERTICES_OUT_ARB, initially
5145bd8deadSopenharmony_ci        zero.
5155bd8deadSopenharmony_ci
5165bd8deadSopenharmony_ci      * One integer to store the value of GEOMETRY_INPUT_TYPE_ARB, initially
5175bd8deadSopenharmony_ci        set to TRIANGLES.
5185bd8deadSopenharmony_ci
5195bd8deadSopenharmony_ci      * One integer to store the value of GEOMETRY_OUTPUT_TYPE_ARB, initially
5205bd8deadSopenharmony_ci        set to TRIANGLE_STRIP.
5215bd8deadSopenharmony_ci
5225bd8deadSopenharmony_ci    Insert New Section 2.16, Geometry Shaders after p. 89
5235bd8deadSopenharmony_ci
5245bd8deadSopenharmony_ci    After vertices are processed, they are arranged into primitives, as
5255bd8deadSopenharmony_ci    described in section 2.6.1 (Begin/End Objects). This section described a
5265bd8deadSopenharmony_ci    new pipeline stage that processes those primitives. A geometry shader
5275bd8deadSopenharmony_ci    defines the operations that are performed in this new pipeline stage. A
5285bd8deadSopenharmony_ci    geometry shader is an array of strings containing source code. The source
5295bd8deadSopenharmony_ci    code language used is described in the OpenGL Shading Language
5305bd8deadSopenharmony_ci    specification. A geometry shader operates on a single primitive at a time
5315bd8deadSopenharmony_ci    and emits one or more output primitives, all of the same type, which are
5325bd8deadSopenharmony_ci    then processed like an equivalent OpenGL primitive specified by the
5335bd8deadSopenharmony_ci    application.  The original primitive is discarded after the geometry
5345bd8deadSopenharmony_ci    shader completes. The inputs available to a geometry shader are the
5355bd8deadSopenharmony_ci    transformed attributes of all the vertices that belong to the primitive.
5365bd8deadSopenharmony_ci    Additional "adjacency" primitives are available which also make the
5375bd8deadSopenharmony_ci    transformed attributes of neighboring vertices available to the shader.
5385bd8deadSopenharmony_ci    The results of the shader are a new set of transformed vertices, arranged
5395bd8deadSopenharmony_ci    into primitives by the shader.
5405bd8deadSopenharmony_ci
5415bd8deadSopenharmony_ci    This new geometry shader pipeline stage is inserted after primitive
5425bd8deadSopenharmony_ci    assembly, right before color clamping (section 2.14.6), flat shading
5435bd8deadSopenharmony_ci    (section 2.14.7) and clipping (sections 2.12 and 2.14.8).
5445bd8deadSopenharmony_ci
5455bd8deadSopenharmony_ci    A geometry shader only applies when the GL is in RGB mode. Its operation
5465bd8deadSopenharmony_ci    in color index mode is undefined.
5475bd8deadSopenharmony_ci
5485bd8deadSopenharmony_ci    Geometry shaders are created as described in section 2.15.1 using a type
5495bd8deadSopenharmony_ci    parameter of GEOMETRY_SHADER_ARB. They are attached to and used in program
5505bd8deadSopenharmony_ci    objects as described in section 2.15.2. When the program object currently
5515bd8deadSopenharmony_ci    in use includes a geometry shader, its geometry shader is considered
5525bd8deadSopenharmony_ci    active, and is used to process primitives. If the program object has no
5535bd8deadSopenharmony_ci    geometry shader, or no program object is in use, this new primitive
5545bd8deadSopenharmony_ci    processing pipeline stage is bypassed.
5555bd8deadSopenharmony_ci
5565bd8deadSopenharmony_ci    A program object that includes a geometry shader must also include a
5575bd8deadSopenharmony_ci    vertex shader; otherwise a link error will occur.
5585bd8deadSopenharmony_ci
5595bd8deadSopenharmony_ci    Section 2.16.1, Geometry shader Input Primitives
5605bd8deadSopenharmony_ci
5615bd8deadSopenharmony_ci    A geometry shader can operate on one of five input primitive types.
5625bd8deadSopenharmony_ci    Depending on the input primitive type, one to six input vertices are
5635bd8deadSopenharmony_ci    available when the shader is executed.  Each input primitive type supports
5645bd8deadSopenharmony_ci    a subset of the primitives provided by the GL. If a geometry shader is
5655bd8deadSopenharmony_ci    active, Begin, or any function that implicitly calls Begin, will produce
5665bd8deadSopenharmony_ci    an INVALID_OPERATION error if the <mode> parameter is incompatible with
5675bd8deadSopenharmony_ci    the input primitive type of the currently active program object, as
5685bd8deadSopenharmony_ci    discussed below.
5695bd8deadSopenharmony_ci
5705bd8deadSopenharmony_ci    The input primitive type is a parameter of the program object, and must be
5715bd8deadSopenharmony_ci    set before linking by calling ProgramParameteriARB with <pname> set to
5725bd8deadSopenharmony_ci    GEOMETRY_INPUT_TYPE_ARB and <value> set to one of POINTS, LINES,
5735bd8deadSopenharmony_ci    LINES_ADJACENCY_ARB, TRIANGLES or TRIANGLES_ADJACENCY_ARB. This setting
5745bd8deadSopenharmony_ci    will not be in effect until the next time LinkProgram has been called
5755bd8deadSopenharmony_ci    successfully. Note that queries of GEOMETRY_INPUT_TYPE_ARB will return the
5765bd8deadSopenharmony_ci    last value set.  This is not necessarily the value used to generate the
5775bd8deadSopenharmony_ci    executable code in the program object. After a program object has been
5785bd8deadSopenharmony_ci    created it will have a default value for GEOMETRY_INPUT_TYPE_ARB, as
5795bd8deadSopenharmony_ci    discussed in section 2.15.5, Required State.
5805bd8deadSopenharmony_ci
5815bd8deadSopenharmony_ci    Note that a geometry shader that accesses more input vertices than are
5825bd8deadSopenharmony_ci    available for a given input primitive type can be successfully compiled,
5835bd8deadSopenharmony_ci    because the input primitive type is not part of the shader
5845bd8deadSopenharmony_ci    object. However, a program object, containing a shader object that access
5855bd8deadSopenharmony_ci    more input vertices than are available for the input primitive type of the
5865bd8deadSopenharmony_ci    program object, will not link.
5875bd8deadSopenharmony_ci
5885bd8deadSopenharmony_ci    The supported input primitive types are:
5895bd8deadSopenharmony_ci
5905bd8deadSopenharmony_ci    Points (POINTS)
5915bd8deadSopenharmony_ci
5925bd8deadSopenharmony_ci    Geometry shaders that operate on points are valid only for the POINTS
5935bd8deadSopenharmony_ci    primitive type.  There is only a single vertex available for each geometry
5945bd8deadSopenharmony_ci    shader invocation.
5955bd8deadSopenharmony_ci
5965bd8deadSopenharmony_ci    Lines (LINES)
5975bd8deadSopenharmony_ci
5985bd8deadSopenharmony_ci    Geometry shaders that operate on line segments are valid only for the
5995bd8deadSopenharmony_ci    LINES, LINE_STRIP, and LINE_LOOP primitive types.  There are two vertices
6005bd8deadSopenharmony_ci    available for each geometry shader invocation. The first vertex refers to
6015bd8deadSopenharmony_ci    the vertex at the beginning of the line segment and the second vertex
6025bd8deadSopenharmony_ci    refers to the vertex at the end of the line segment. See also section
6035bd8deadSopenharmony_ci    2.16.4.
6045bd8deadSopenharmony_ci
6055bd8deadSopenharmony_ci    Lines with Adjacency (LINES_ADJACENCY_ARB)
6065bd8deadSopenharmony_ci
6075bd8deadSopenharmony_ci    Geometry shaders that operate on line segments with adjacent vertices are
6085bd8deadSopenharmony_ci    valid only for the LINES_ADJACENCY_ARB and LINE_STRIP_ADJACENCY_ARB
6095bd8deadSopenharmony_ci    primitive types.  There are four vertices available for each program
6105bd8deadSopenharmony_ci    invocation. The second vertex refers to attributes of the vertex at the
6115bd8deadSopenharmony_ci    beginning of the line segment and the third vertex refers to the vertex at
6125bd8deadSopenharmony_ci    the end of the line segment. The first and fourth vertices refer to the
6135bd8deadSopenharmony_ci    vertices adjacent to the beginning and end of the line segment,
6145bd8deadSopenharmony_ci    respectively.
6155bd8deadSopenharmony_ci
6165bd8deadSopenharmony_ci    Triangles (TRIANGLES)
6175bd8deadSopenharmony_ci
6185bd8deadSopenharmony_ci    Geometry shaders that operate on triangles are valid for the TRIANGLES,
6195bd8deadSopenharmony_ci    TRIANGLE_STRIP and TRIANGLE_FAN primitive types.
6205bd8deadSopenharmony_ci
6215bd8deadSopenharmony_ci    There are three vertices available for each program invocation. The first,
6225bd8deadSopenharmony_ci    second and third vertices refer to attributes of the first, second and
6235bd8deadSopenharmony_ci    third vertex of the triangle, respectively.
6245bd8deadSopenharmony_ci
6255bd8deadSopenharmony_ci    Triangles with Adjacency (TRIANGLES_ADJACENCY_ARB)
6265bd8deadSopenharmony_ci
6275bd8deadSopenharmony_ci    Geometry shaders that operate on triangles with adjacent vertices are
6285bd8deadSopenharmony_ci    valid for the TRIANGLES_ADJACENCY_ARB and TRIANGLE_STRIP_ADJACENCY_ARB
6295bd8deadSopenharmony_ci    primitive types.  There are six vertices available for each program
6305bd8deadSopenharmony_ci    invocation. The first, third and fifth vertices refer to attributes of the
6315bd8deadSopenharmony_ci    first, second and third vertex of the triangle, respectively. The second,
6325bd8deadSopenharmony_ci    fourth and sixth vertices refer to attributes of the vertices adjacent to
6335bd8deadSopenharmony_ci    the edges from the first to the second vertex, from the second to the
6345bd8deadSopenharmony_ci    third vertex, and from the third to the first vertex, respectively.
6355bd8deadSopenharmony_ci
6365bd8deadSopenharmony_ci    Section 2.16.2, Geometry Shader Output Primitives
6375bd8deadSopenharmony_ci
6385bd8deadSopenharmony_ci    A geometry shader can generate primitives of one of three types.  The
6395bd8deadSopenharmony_ci    supported output primitive types are points (POINTS), line strips
6405bd8deadSopenharmony_ci    (LINE_STRIP), and triangle strips (TRIANGLE_STRIP).  The vertices output
6415bd8deadSopenharmony_ci    by the geometry shader are decomposed into points, lines, or triangles
6425bd8deadSopenharmony_ci    based on the output primitive type in the manner described in section
6435bd8deadSopenharmony_ci    2.6.1. The resulting primitives are then further processed as shown in
6445bd8deadSopenharmony_ci    figure 2.16.xxx. If the number of vertices emitted by the geometry shader
6455bd8deadSopenharmony_ci    is not sufficient to produce a single primitive, nothing is drawn.
6465bd8deadSopenharmony_ci
6475bd8deadSopenharmony_ci    The output primitive type is a parameter of the program object, and can be
6485bd8deadSopenharmony_ci    set by calling ProgramParameteriARB with <pname> set to
6495bd8deadSopenharmony_ci    GEOMETRY_OUTPUT_TYPE_ARB and <value> set to one of POINTS, LINE_STRIP or
6505bd8deadSopenharmony_ci    TRIANGLE_STRIP. This setting will not be in effect until the next time
6515bd8deadSopenharmony_ci    LinkProgram has been called successfully. Note that queries of
6525bd8deadSopenharmony_ci    GEOMETRY_OUTPUT_TYPE_ARB will return the last value set; which is not
6535bd8deadSopenharmony_ci    necessarily the value used to generate the executable code in the program
6545bd8deadSopenharmony_ci    object. After a program object has been created it will have a default
6555bd8deadSopenharmony_ci    value for GEOMETRY_OUTPUT_TYPE_ARB, as discussed in section 2.15.5,
6565bd8deadSopenharmony_ci    Required State. .
6575bd8deadSopenharmony_ci
6585bd8deadSopenharmony_ci    Section 2.16.3 Geometry Shader Variables
6595bd8deadSopenharmony_ci
6605bd8deadSopenharmony_ci    Geometry shaders can access uniforms belonging to the current program
6615bd8deadSopenharmony_ci    object.  The amount of storage available for uniform variables in the
6625bd8deadSopenharmony_ci    default uniform block accessed by a geometry shader is specified by the
6635bd8deadSopenharmony_ci    value of the implementation-dependent constant
6645bd8deadSopenharmony_ci    MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB. The total amount of combined storage
6655bd8deadSopenharmony_ci    available for uniform variables in all uniform blocks accessed by a
6665bd8deadSopenharmony_ci    geometry shader (including the default uniform block) is specified by the
6675bd8deadSopenharmony_ci    value of the implementation-dependent constant
6685bd8deadSopenharmony_ci    MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS.  These values represent the
6695bd8deadSopenharmony_ci    numbers of individual floating-point, integer, or boolean values that can
6705bd8deadSopenharmony_ci    be held in uniform variable storage for a geometry shader. A link error is
6715bd8deadSopenharmony_ci    generated if an attempt is made to utilize more than the space available
6725bd8deadSopenharmony_ci    for geometry shader uniform variables.  Uniforms are manipulated as
6735bd8deadSopenharmony_ci    described in section 2.15.3.  Geometry shaders also have access to
6745bd8deadSopenharmony_ci    samplers, to perform texturing operations, as described in sections 2.15.3
6755bd8deadSopenharmony_ci    and 3.8.
6765bd8deadSopenharmony_ci
6775bd8deadSopenharmony_ci    Geometry shaders can access the transformed attributes of all vertices for
6785bd8deadSopenharmony_ci    its input primitive type through input varying variables. A vertex shader,
6795bd8deadSopenharmony_ci    writing to output varying variables, generates the values of these input
6805bd8deadSopenharmony_ci    varying variables. This includes values for built-in as well as
6815bd8deadSopenharmony_ci    user-defined varying variables. Values for any varying variables that are
6825bd8deadSopenharmony_ci    not written by a vertex shader are undefined. Additionally, a geometry
6835bd8deadSopenharmony_ci    shader has access to a built-in variable that holds the ID of the current
6845bd8deadSopenharmony_ci    primitive. This ID is generated by the primitive assembly stage that sits
6855bd8deadSopenharmony_ci    in between the vertex and geometry shader.
6865bd8deadSopenharmony_ci
6875bd8deadSopenharmony_ci    Additionally, geometry shaders can write to one, or more, varying
6885bd8deadSopenharmony_ci    variables for each primitive it outputs. These values are optionally flat
6895bd8deadSopenharmony_ci    shaded (using the OpenGL Shading Language varying qualifier "flat") and
6905bd8deadSopenharmony_ci    clipped, then the clipped values interpolated across the primitive (if not
6915bd8deadSopenharmony_ci    flat shaded). The results of these interpolations are available to a
6925bd8deadSopenharmony_ci    fragment shader, if one is active. Furthermore, geometry shaders can write
6935bd8deadSopenharmony_ci    to a set of built- in varying variables, defined in the OpenGL Shading
6945bd8deadSopenharmony_ci    Language, that correspond to the values required for the fixed-function
6955bd8deadSopenharmony_ci    processing that occurs after geometry processing.
6965bd8deadSopenharmony_ci
6975bd8deadSopenharmony_ci    Section 2.16.4, Geometry Shader Execution Environment
6985bd8deadSopenharmony_ci
6995bd8deadSopenharmony_ci    If a successfully linked program object that contains a geometry shader is
7005bd8deadSopenharmony_ci    made current by calling UseProgram, the executable version of the geometry
7015bd8deadSopenharmony_ci    shader is used to process primitives resulting from the primitive assembly
7025bd8deadSopenharmony_ci    stage.
7035bd8deadSopenharmony_ci
7045bd8deadSopenharmony_ci    The following operations are applied to the primitives that are the result
7055bd8deadSopenharmony_ci    of executing a geometry shader:
7065bd8deadSopenharmony_ci
7075bd8deadSopenharmony_ci      * color clamping or masking (section 2.14.6),
7085bd8deadSopenharmony_ci
7095bd8deadSopenharmony_ci      * flat shading (section 2.14.7),
7105bd8deadSopenharmony_ci
7115bd8deadSopenharmony_ci      * clipping, including client-defined clip planes (section 2.12),
7125bd8deadSopenharmony_ci
7135bd8deadSopenharmony_ci      * front face determination (section 2.14.1),
7145bd8deadSopenharmony_ci
7155bd8deadSopenharmony_ci      * color and associated data clipping (section 2.14.8),
7165bd8deadSopenharmony_ci
7175bd8deadSopenharmony_ci      * perspective division on clip coordinates (section 2.11),
7185bd8deadSopenharmony_ci
7195bd8deadSopenharmony_ci      * final color processing (section 2.14.9), and
7205bd8deadSopenharmony_ci
7215bd8deadSopenharmony_ci      * viewport transformation, including depth-range scaling (section
7225bd8deadSopenharmony_ci        2.11.1).
7235bd8deadSopenharmony_ci
7245bd8deadSopenharmony_ci    There are several special considerations for geometry shader execution
7255bd8deadSopenharmony_ci    described in the following sections.
7265bd8deadSopenharmony_ci
7275bd8deadSopenharmony_ci    Texture Access
7285bd8deadSopenharmony_ci
7295bd8deadSopenharmony_ci    Geometry shaders have the ability to do a lookup into a texture map, if
7305bd8deadSopenharmony_ci    supported by the GL implementation. The maximum number of texture image
7315bd8deadSopenharmony_ci    units available to a geometry shader is
7325bd8deadSopenharmony_ci    MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB; a maximum number of zero indicates
7335bd8deadSopenharmony_ci    that the GL implementation does not support texture accesses in geometry
7345bd8deadSopenharmony_ci    shaders.
7355bd8deadSopenharmony_ci
7365bd8deadSopenharmony_ci    The vertex shader, geometry shader and fragment processing combined cannot
7375bd8deadSopenharmony_ci    use more than MAX_COMBINED_TEXTURE_IMAGE_UNITS texture image units. If the
7385bd8deadSopenharmony_ci    vertex shader, geometry shader and the fragment processing stage access
7395bd8deadSopenharmony_ci    the same texture image unit, then that counts as using three texture image
7405bd8deadSopenharmony_ci    units against the MAX_COMBINED_TEXTURE_IMAGE_UNITS limit.
7415bd8deadSopenharmony_ci
7425bd8deadSopenharmony_ci    When a texture lookup is performed in a geometry shader, the filtered
7435bd8deadSopenharmony_ci    texture value tau is computed in the manner described in sections 3.8.8
7445bd8deadSopenharmony_ci    and 3.8.9, and converted to a texture source color Cs according to table
7455bd8deadSopenharmony_ci    3.21 (section 3.8.13). A four component vector (Rs,Gs,Bs,As) is returned
7465bd8deadSopenharmony_ci    to the geometry shader. In a geometry shader it is not possible to perform
7475bd8deadSopenharmony_ci    automatic level-of- detail calculations using partial derivatives of the
7485bd8deadSopenharmony_ci    texture coordinates with respect to window coordinates as described in
7495bd8deadSopenharmony_ci    section 3.8.8. Hence, there is no automatic selection of an image array
7505bd8deadSopenharmony_ci    level. Minification or magnification of a texture map is controlled by a
7515bd8deadSopenharmony_ci    level-of-detail value optionally passed as an argument in the texture
7525bd8deadSopenharmony_ci    lookup functions. If the texture lookup function supplies an explicit
7535bd8deadSopenharmony_ci    level-of-detail value lambda, then the pre-bias level-of-detail value
7545bd8deadSopenharmony_ci    LAMBDAbase(x, y) = lambda (replacing equation 3.18). If the texture lookup
7555bd8deadSopenharmony_ci    function does not supply an explicit level-of-detail value, then
7565bd8deadSopenharmony_ci    LAMBDAbase(x, y) = 0. The scale factor Rho(x, y) and its approximation
7575bd8deadSopenharmony_ci    function f(x, y) (see equation 3.21) are ignored.
7585bd8deadSopenharmony_ci
7595bd8deadSopenharmony_ci    Texture lookups involving textures with depth component data can either
7605bd8deadSopenharmony_ci    return the depth data directly or return the results of a comparison with
7615bd8deadSopenharmony_ci    the R value (see section 3.8.14) used to perform the lookup. The
7625bd8deadSopenharmony_ci    comparison operation is requested in the shader by using any of the shadow
7635bd8deadSopenharmony_ci    sampler and in the texture using the TEXTURE COMPARE MODE parameter. These
7645bd8deadSopenharmony_ci    requests must be consistent; the results of a texture lookup are undefined
7655bd8deadSopenharmony_ci    if:
7665bd8deadSopenharmony_ci
7675bd8deadSopenharmony_ci      * the sampler used in a texture lookup function is not one of the shadow
7685bd8deadSopenharmony_ci        sampler types, and the texture object's internal format is DEPTH
7695bd8deadSopenharmony_ci        COMPONENT, and the TEXTURE COMPARE MODE is not NONE;
7705bd8deadSopenharmony_ci
7715bd8deadSopenharmony_ci      * the sampler used in a texture lookup function is one of the shadow
7725bd8deadSopenharmony_ci        sampler types, and the texture object's internal format is DEPTH
7735bd8deadSopenharmony_ci        COMPONENT, and the TEXTURE COMPARE MODE is NONE; or
7745bd8deadSopenharmony_ci
7755bd8deadSopenharmony_ci      * the sampler used in a texture lookup function is one of the shadow
7765bd8deadSopenharmony_ci        sampler types, and the texture object's internal format is not DEPTH
7775bd8deadSopenharmony_ci        COMPONENT.
7785bd8deadSopenharmony_ci
7795bd8deadSopenharmony_ci    If a geometry shader uses a sampler where the associated texture object is
7805bd8deadSopenharmony_ci    not complete as defined in section 3.8.10, the texture image unit will
7815bd8deadSopenharmony_ci    return (R,G,B,A) = (0, 0, 0, 1).
7825bd8deadSopenharmony_ci
7835bd8deadSopenharmony_ci    Geometry Shader Inputs
7845bd8deadSopenharmony_ci
7855bd8deadSopenharmony_ci    The OpenGL Shading Language specification describes the set of built-in
7865bd8deadSopenharmony_ci    variables that are available as inputs to the geometry shader. This set
7875bd8deadSopenharmony_ci    receives the values from the equivalent built-in output variables written
7885bd8deadSopenharmony_ci    by the vertex shader. These built-in variables are arrays; each element in
7895bd8deadSopenharmony_ci    the array holds the value for a specific vertex of the input
7905bd8deadSopenharmony_ci    primitive. The length of each array depends on the value of the input
7915bd8deadSopenharmony_ci    primitive type, as determined by the program object value
7925bd8deadSopenharmony_ci    GEOMETRY_INPUT_TYPE_ARB, and is set by the GL during link. Each built-in
7935bd8deadSopenharmony_ci    variable is a one-dimensional array, except for the built-in texture
7945bd8deadSopenharmony_ci    coordinate variable, which is a two- dimensional array. The vertex shader
7955bd8deadSopenharmony_ci    built-in output gl_TexCoord[] is a one-dimensional array. Therefore, the
7965bd8deadSopenharmony_ci    geometry shader equivalent input variable gl_TexCoordIn[][] becomes a two-
7975bd8deadSopenharmony_ci    dimensional array. See the OpenGL Shading Language Specification, sections
7985bd8deadSopenharmony_ci    4.3.6 and 7.6 for more information.
7995bd8deadSopenharmony_ci
8005bd8deadSopenharmony_ci    The built-in varying variables gl_FrontColorIn[], gl_BackColorIn[],
8015bd8deadSopenharmony_ci    gl_FrontSecondaryColorIn[] and gl_BackSecondaryColorIn[] hold the
8025bd8deadSopenharmony_ci    per-vertex front and back colors of the primary and secondary colors, as
8035bd8deadSopenharmony_ci    written by the vertex shader to its equivalent built-in output variables.
8045bd8deadSopenharmony_ci
8055bd8deadSopenharmony_ci    The built-in varying variable gl_TexCoordIn[][] holds the per- vertex
8065bd8deadSopenharmony_ci    values of the array of texture coordinates, as written by the vertex
8075bd8deadSopenharmony_ci    shader to its built-in output array gl_TexCoord[].
8085bd8deadSopenharmony_ci
8095bd8deadSopenharmony_ci    The built-in varying variable gl_FogFragCoordIn[] holds the per- vertex
8105bd8deadSopenharmony_ci    fog coordinate, as written by the vertex shader to its built- in output
8115bd8deadSopenharmony_ci    variable gl_FogFragCoord.
8125bd8deadSopenharmony_ci
8135bd8deadSopenharmony_ci    The built-in varying variable gl_PositionIn[] holds the per-vertex
8145bd8deadSopenharmony_ci    position, as written by the vertex shader to its output variable
8155bd8deadSopenharmony_ci    gl_Position. Note that writing to gl_Position from either the vertex or
8165bd8deadSopenharmony_ci    fragment shader is optional. See also section 7.1 "Vertex and Geometry
8175bd8deadSopenharmony_ci    Shader Special Variables" of the OpenGL Shading Language specification.
8185bd8deadSopenharmony_ci
8195bd8deadSopenharmony_ci    The built-in varying variable gl_ClipVertexIn[] holds the per-vertex
8205bd8deadSopenharmony_ci    position in clip coordinates, as written by the vertex shader to its
8215bd8deadSopenharmony_ci    output variable gl_ClipVertex.
8225bd8deadSopenharmony_ci
8235bd8deadSopenharmony_ci    The built-in varying variable gl_PointSizeIn[] holds the per-vertex point
8245bd8deadSopenharmony_ci    size written by the vertex shader to its built-in output varying variable
8255bd8deadSopenharmony_ci    gl_PointSize. If the vertex shader does not write gl_PointSize, the value
8265bd8deadSopenharmony_ci    of gl_PointSizeIn[] is undefined, regardless of the value of the enable
8275bd8deadSopenharmony_ci    VERTEX_PROGRAM_POINT_SIZE.
8285bd8deadSopenharmony_ci
8295bd8deadSopenharmony_ci    The built-in special variable gl_PrimitiveIDIn is not an array and has no
8305bd8deadSopenharmony_ci    vertex shader equivalent. It is filled with the number of primitives
8315bd8deadSopenharmony_ci    processed since the last time Begin was called (directly or indirectly via
8325bd8deadSopenharmony_ci    vertex array functions).  The first primitive generated after a Begin is
8335bd8deadSopenharmony_ci    numbered zero, and the primitive ID counter is incremented after every
8345bd8deadSopenharmony_ci    individual point, line, or triangle primitive is processed.  For triangles
8355bd8deadSopenharmony_ci    drawn in point or line mode, the primitive ID counter is incremented only
8365bd8deadSopenharmony_ci    once, even though multiple points or lines may be drawn. Restarting a
8375bd8deadSopenharmony_ci    primitive topology using the primitive restart index has no effect on the
8385bd8deadSopenharmony_ci    primitive ID counter.
8395bd8deadSopenharmony_ci
8405bd8deadSopenharmony_ci    Similarly to the built-in varying variables, user-defined input varying
8415bd8deadSopenharmony_ci    variables need to be declared as arrays. Declaring a size is optional. If
8425bd8deadSopenharmony_ci    no size is specified, it will be inferred by the linker from the input
8435bd8deadSopenharmony_ci    primitive type. If a size is specified, it has to be of the size matching
8445bd8deadSopenharmony_ci    the number of vertices of the input primitive type, otherwise a link error
8455bd8deadSopenharmony_ci    will occur. The built-in variable gl_VerticesIn, if so desired, can be
8465bd8deadSopenharmony_ci    used to size the array correctly for each input primitive
8475bd8deadSopenharmony_ci    type. User-defined varying variables can be declared as arrays in the
8485bd8deadSopenharmony_ci    vertex shader. This means that those, on input to the geometry shader,
8495bd8deadSopenharmony_ci    must be declared as two-dimensional arrays. See sections 4.3.6 and 7.6 of
8505bd8deadSopenharmony_ci    the OpenGL Shading Language Specification for more information.
8515bd8deadSopenharmony_ci
8525bd8deadSopenharmony_ci    Using any of the built-in or user-defined input varying variables can
8535bd8deadSopenharmony_ci    count against the limit MAX_VERTEX_VARYING_COMPONENTS_ARB as discussed in
8545bd8deadSopenharmony_ci    section 2.15.3.
8555bd8deadSopenharmony_ci
8565bd8deadSopenharmony_ci    Geometry Shader outputs
8575bd8deadSopenharmony_ci
8585bd8deadSopenharmony_ci    A geometry shader is limited in the number of vertices it may emit per
8595bd8deadSopenharmony_ci    invocation. The maximum number of vertices a geometry shader can possibly
8605bd8deadSopenharmony_ci    emit needs to be set as a parameter of the program object that contains
8615bd8deadSopenharmony_ci    the geometry shader. To do so, call ProgramParameteriARB with <pname> set
8625bd8deadSopenharmony_ci    to GEOMETRY_VERTICES_OUT_ARB and <value> set to the maximum number of
8635bd8deadSopenharmony_ci    vertices the geometry shader will emit in one invocation. This setting
8645bd8deadSopenharmony_ci    will not be guaranteed to be in effect until the next time LinkProgram has
8655bd8deadSopenharmony_ci    been called successfully. If a geometry shader, in one invocation, emits
8665bd8deadSopenharmony_ci    more vertices than the value GEOMETRY_VERTICES_OUT_ARB, these emits may
8675bd8deadSopenharmony_ci    have no effect.
8685bd8deadSopenharmony_ci
8695bd8deadSopenharmony_ci    There are two implementation-dependent limits on the value of
8705bd8deadSopenharmony_ci    GEOMETRY_VERTICES_OUT_ARB.  First, the error INVALID_VALUE will be
8715bd8deadSopenharmony_ci    generated by ProgramParameteriARB if the number of vertices specified
8725bd8deadSopenharmony_ci    exceeds the value of MAX_GEOMETRY_OUTPUT_VERTICES_ARB.  Second, the
8735bd8deadSopenharmony_ci    product of the total number of vertices and the sum of all components of
8745bd8deadSopenharmony_ci    all active varying variables may not exceed the value of
8755bd8deadSopenharmony_ci    MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB.  LinkProgram will fail if it
8765bd8deadSopenharmony_ci    determines that the total component limit would be violated.
8775bd8deadSopenharmony_ci
8785bd8deadSopenharmony_ci    A geometry shader can write to built-in as well as user-defined varying
8795bd8deadSopenharmony_ci    variables. These values are expected to be interpolated across the
8805bd8deadSopenharmony_ci    primitive it outputs, unless they are specified to be flat shaded.  In
8815bd8deadSopenharmony_ci    order to seamlessly be able to insert or remove a geometry shader from a
8825bd8deadSopenharmony_ci    program object, the rules, names and types of the output built-in varying
8835bd8deadSopenharmony_ci    variables and user-defined varying variables are the same as for the
8845bd8deadSopenharmony_ci    vertex shader. Refer to section 2.15.3 and the OpenGL Shading Language
8855bd8deadSopenharmony_ci    specification sections 4.3.6, 7.1 and 7.6 for more detail.
8865bd8deadSopenharmony_ci
8875bd8deadSopenharmony_ci    The built-in output variables gl_FrontColor, gl_BackColor,
8885bd8deadSopenharmony_ci    gl_FrontSecondaryColor, and gl_BackSecondaryColor hold the front and back
8895bd8deadSopenharmony_ci    colors for the primary and secondary colors for the current vertex.
8905bd8deadSopenharmony_ci
8915bd8deadSopenharmony_ci    The built-in output variable gl_TexCoord[] is an array and holds the set
8925bd8deadSopenharmony_ci    of texture coordinates for the current vertex.
8935bd8deadSopenharmony_ci
8945bd8deadSopenharmony_ci    The built-in output variable gl_FogFragCoord is used as the "c" value, as
8955bd8deadSopenharmony_ci    described in section 3.10 "Fog" of the OpenGL 2.0 specification.
8965bd8deadSopenharmony_ci
8975bd8deadSopenharmony_ci    The built-in special variable gl_Position is intended to hold the
8985bd8deadSopenharmony_ci    homogeneous vertex position. Writing gl_Position is optional.
8995bd8deadSopenharmony_ci
9005bd8deadSopenharmony_ci    The built-in special variable gl_ClipVertex holds the vertex coordinate
9015bd8deadSopenharmony_ci    used in the clipping stage, as described in section 2.12 "Clipping" of the
9025bd8deadSopenharmony_ci    OpenGL 2.0 specification.
9035bd8deadSopenharmony_ci
9045bd8deadSopenharmony_ci    The built-in special variable gl_PointSize, if written, holds the size of
9055bd8deadSopenharmony_ci    the point to be rasterized, measured in pixels.
9065bd8deadSopenharmony_ci
9075bd8deadSopenharmony_ci    Additionally, a geometry shader can write to the built-in special
9085bd8deadSopenharmony_ci    variables gl_PrimitiveID and gl_Layer, whereas a vertex shader cannot. The
9095bd8deadSopenharmony_ci    built-in gl_PrimitiveID provides a single integer that serves as a
9105bd8deadSopenharmony_ci    primitive identifier.  This written primitive ID is available to fragment
9115bd8deadSopenharmony_ci    shaders.  If a fragment shader using primitive IDs is active and a
9125bd8deadSopenharmony_ci    geometry shader is also active, the geometry shader must write to
9135bd8deadSopenharmony_ci    gl_PrimitiveID or the primitive ID number is undefined. The built-in
9145bd8deadSopenharmony_ci    variable gl_Layer is used in layered rendering, and discussed in the next
9155bd8deadSopenharmony_ci    section.
9165bd8deadSopenharmony_ci
9175bd8deadSopenharmony_ci    The number of components available for varying variables is given by the
9185bd8deadSopenharmony_ci    implementation-dependent constant
9195bd8deadSopenharmony_ci    MAX_GEOMETRY_VARYING_COMPONENTS_ARB. This value represents the number of
9205bd8deadSopenharmony_ci    individual components of a varying variable; varying variables declared as
9215bd8deadSopenharmony_ci    vectors, matrices, and arrays will all consume multiple components. When a
9225bd8deadSopenharmony_ci    program is linked, all components of any varying variable written by a
9235bd8deadSopenharmony_ci    geometry shader, or read by a fragment shader, will count against this
9245bd8deadSopenharmony_ci    limit. The transformed vertex position (gl_Position) does not count
9255bd8deadSopenharmony_ci    against this limit. A program whose geometry and/or fragment shaders
9265bd8deadSopenharmony_ci    access more than MAX_GEOMETRY_VARYING_COMPONENTS_ARB worth of varying
9275bd8deadSopenharmony_ci    variable components may fail to link, unless device-dependent
9285bd8deadSopenharmony_ci    optimizations are able to make the program fit within available hardware
9295bd8deadSopenharmony_ci    resources.
9305bd8deadSopenharmony_ci
9315bd8deadSopenharmony_ci    Layered rendering
9325bd8deadSopenharmony_ci
9335bd8deadSopenharmony_ci    Geometry shaders can be used to render to one of several different layers
9345bd8deadSopenharmony_ci    of cube map textures, three-dimensional textures, plus one- dimensional
9355bd8deadSopenharmony_ci    and two-dimensional texture arrays. This functionality allows an
9365bd8deadSopenharmony_ci    application to bind an entire "complex" texture to a framebuffer object,
9375bd8deadSopenharmony_ci    and render primitives to arbitrary layers computed at run time. For
9385bd8deadSopenharmony_ci    example, this mechanism can be used to project and render a scene onto all
9395bd8deadSopenharmony_ci    six faces of a cubemap texture in one pass. The layer to render to is
9405bd8deadSopenharmony_ci    specified by writing to the built-in output variable gl_layer. Layered
9415bd8deadSopenharmony_ci    rendering requires the use of framebuffer objects. Refer to the section
9425bd8deadSopenharmony_ci    'Dependencies on EXT_framebuffer_object' for details.
9435bd8deadSopenharmony_ci
9445bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization)
9455bd8deadSopenharmony_ci
9465bd8deadSopenharmony_ci    Modify Section 3.3, Points (p. 95)
9475bd8deadSopenharmony_ci
9485bd8deadSopenharmony_ci    (replace all Section 3.3 text on p. 95)
9495bd8deadSopenharmony_ci
9505bd8deadSopenharmony_ci    A point is drawn by generating a set of fragments in the shape of a square
9515bd8deadSopenharmony_ci    or circle centered around the vertex of the point. Each vertex has an
9525bd8deadSopenharmony_ci    associated point size that controls the size of that square or circle.
9535bd8deadSopenharmony_ci
9545bd8deadSopenharmony_ci    If no vertex or geometry shader is active, the size of the point is
9555bd8deadSopenharmony_ci    controlled by
9565bd8deadSopenharmony_ci
9575bd8deadSopenharmony_ci          void PointSize(float size);
9585bd8deadSopenharmony_ci
9595bd8deadSopenharmony_ci    <size> specifies the requested size of a point. The default value is
9605bd8deadSopenharmony_ci    1.0. A value less than or equal to zero results in the error
9615bd8deadSopenharmony_ci    INVALID_VALUE.
9625bd8deadSopenharmony_ci
9635bd8deadSopenharmony_ci    The requested point size is multiplied with a distance attenuation factor,
9645bd8deadSopenharmony_ci    clamped to a specified point size range, and further clamped to the
9655bd8deadSopenharmony_ci    implementation-dependent point size range to produce the derived point
9665bd8deadSopenharmony_ci    size:
9675bd8deadSopenharmony_ci
9685bd8deadSopenharmony_ci           derived size = clamp(size * sqrt(1/(a+b*d+c*d^2)))
9695bd8deadSopenharmony_ci
9705bd8deadSopenharmony_ci    where d is the eye-coordinate distance from the eye, (0,0,0,1) in eye
9715bd8deadSopenharmony_ci    coordinates, to the vertex, and a, b, and c are distance attenuation
9725bd8deadSopenharmony_ci    function coefficients.
9735bd8deadSopenharmony_ci
9745bd8deadSopenharmony_ci    If a vertex or geometry shader is active, the derived size depends on the
9755bd8deadSopenharmony_ci    per-vertex point size mode enable.  Per-vertex point size mode is enabled
9765bd8deadSopenharmony_ci    or disabled by calling Enable or Disable with the symbolic value
9775bd8deadSopenharmony_ci    PROGRAM_POINT_SIZE_ARB.  If per-vertex point size is enabled and a
9785bd8deadSopenharmony_ci    geometry shader is active, the derived point size is taken from the
9795bd8deadSopenharmony_ci    (potentially clipped) point size variable gl_PointSize written by the
9805bd8deadSopenharmony_ci    geometry shader. If per-vertex point size is enabled and no geometry
9815bd8deadSopenharmony_ci    shader is active, the derived point size is taken from the (potentially
9825bd8deadSopenharmony_ci    clipped) point size variable gl_PointSize written by the vertex shader. If
9835bd8deadSopenharmony_ci    per-vertex point size is disabled and a geometry and/or vertex shader is
9845bd8deadSopenharmony_ci    active, the derived point size is taken from the <size> value provided to
9855bd8deadSopenharmony_ci    PointSize, with no distance attenuation applied.  In all cases, the
9865bd8deadSopenharmony_ci    derived point size is clamped to the implementation-dependent point size
9875bd8deadSopenharmony_ci    range.
9885bd8deadSopenharmony_ci
9895bd8deadSopenharmony_ci    If multisampling is not enabled, the derived size is passed on to
9905bd8deadSopenharmony_ci    rasterization as the point width. ...
9915bd8deadSopenharmony_ci
9925bd8deadSopenharmony_ci    Modify section 3.10 "Fog", p. 191
9935bd8deadSopenharmony_ci
9945bd8deadSopenharmony_ci    Modify the third paragraph of this section as follows.
9955bd8deadSopenharmony_ci
9965bd8deadSopenharmony_ci    If a vertex or geometry shader is active, or if the fog source, as defined
9975bd8deadSopenharmony_ci    below, is FOG_COORD, then c is the interpolated value of the fog
9985bd8deadSopenharmony_ci    coordinate for this fragment.  Otherwise, ...
9995bd8deadSopenharmony_ci
10005bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 2.0 Specification (Per-Fragment
10015bd8deadSopenharmony_ciOperations and the Frame Buffer)
10025bd8deadSopenharmony_ci
10035bd8deadSopenharmony_ci    None.
10045bd8deadSopenharmony_ci
10055bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 2.0 Specification (Special
10065bd8deadSopenharmony_ciFunctions)
10075bd8deadSopenharmony_ci
10085bd8deadSopenharmony_ci    Change section 5.4 Display Lists, p. 237
10095bd8deadSopenharmony_ci
10105bd8deadSopenharmony_ci    Add the command ProgramParameteriARB to the list of commands that are not
10115bd8deadSopenharmony_ci    compiled into a display list, but executed immediately, under "Program and
10125bd8deadSopenharmony_ci    Shader Objects", p. 241
10135bd8deadSopenharmony_ci
10145bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 2.0 Specification (State and State
10155bd8deadSopenharmony_ciRequests)
10165bd8deadSopenharmony_ci
10175bd8deadSopenharmony_ci    Modify section 6.1.14, Shader and Program Objects, p. 256
10185bd8deadSopenharmony_ci
10195bd8deadSopenharmony_ci    Add to the second paragraph on p. 257:
10205bd8deadSopenharmony_ci
10215bd8deadSopenharmony_ci    ... if <shader> is a fragment shader object, and GEOMETRY_SHADER_ARB is
10225bd8deadSopenharmony_ci    returned if <shader> is a geometry shader object.
10235bd8deadSopenharmony_ci
10245bd8deadSopenharmony_ci    Add to the end of the description of GetProgramiv, p. 257:
10255bd8deadSopenharmony_ci
10265bd8deadSopenharmony_ci    If <pname> is GEOMETRY_VERTICES_OUT_ARB, the current value of the maximum
10275bd8deadSopenharmony_ci    number of vertices the geometry shader will output is returned. If <pname>
10285bd8deadSopenharmony_ci    is GEOMETRY_INPUT_TYPE_ARB, the current geometry shader input type is
10295bd8deadSopenharmony_ci    returned and can be one of POINTS, LINES, LINES_ADJACENCY_ARB, TRIANGLES
10305bd8deadSopenharmony_ci    or TRIANGLES_ADJACENCY_ARB.  If <pname> is GEOMETRY_OUTPUT_TYPE_ARB, the
10315bd8deadSopenharmony_ci    current geometry shader output type is returned and can be one of POINTS,
10325bd8deadSopenharmony_ci    LINE_STRIP or TRIANGLE_STRIP.
10335bd8deadSopenharmony_ci
10345bd8deadSopenharmony_ciAdditions to Appendix A of the OpenGL 2.0 Specification (Invariance)
10355bd8deadSopenharmony_ci
10365bd8deadSopenharmony_ci    None.
10375bd8deadSopenharmony_ci
10385bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications
10395bd8deadSopenharmony_ci
10405bd8deadSopenharmony_ci    None.
10415bd8deadSopenharmony_ci
10425bd8deadSopenharmony_ciDependencies on NV_primitive_restart
10435bd8deadSopenharmony_ci
10445bd8deadSopenharmony_ci    The spec describes the behavior that primitive restart does not affect the
10455bd8deadSopenharmony_ci    primitive ID counter gl_PrimitiveIDIn. If NV_primitive_restart is not
10465bd8deadSopenharmony_ci    supported, references to that extension in the discussion of the primitive
10475bd8deadSopenharmony_ci    ID should be removed.
10485bd8deadSopenharmony_ci
10495bd8deadSopenharmony_ciDependencies on EXT_framebuffer_object
10505bd8deadSopenharmony_ci
10515bd8deadSopenharmony_ci    If EXT_framebuffer_object (or similar functionality) is not supported, the
10525bd8deadSopenharmony_ci    gl_Layer output has no effect.  "FramebufferTextureARB" and
10535bd8deadSopenharmony_ci    "FramebufferTextureLayerARB" should be removed from "New Procedures and
10545bd8deadSopenharmony_ci    Functions", and FRAMEBUFFER_ATTACHMENT_LAYERED_ARB,
10555bd8deadSopenharmony_ci    FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB, and
10565bd8deadSopenharmony_ci    FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB should be removed from "New
10575bd8deadSopenharmony_ci    Tokens".
10585bd8deadSopenharmony_ci
10595bd8deadSopenharmony_ci    Otherwise, this extension modifies EXT_framebuffer_object to add the
10605bd8deadSopenharmony_ci    notion of layered framebuffer attachments and framebuffers that can be
10615bd8deadSopenharmony_ci    used in conjunction with geometry shaders to allow programs to direct
10625bd8deadSopenharmony_ci    primitives to a face of a cube map or layer of a three-dimensional texture
10635bd8deadSopenharmony_ci    or one- or two-dimensional array texture.  The layer used for rendering
10645bd8deadSopenharmony_ci    can be selected by the geometry shader at run time.
10655bd8deadSopenharmony_ci
10665bd8deadSopenharmony_ci    (insert before the end of Section 4.4.2, Attaching Images to Framebuffer
10675bd8deadSopenharmony_ci    Objects)
10685bd8deadSopenharmony_ci
10695bd8deadSopenharmony_ci    There are several types of framebuffer-attachable images:
10705bd8deadSopenharmony_ci
10715bd8deadSopenharmony_ci      * the image of a renderbuffer object, which is always two-dimensional,
10725bd8deadSopenharmony_ci
10735bd8deadSopenharmony_ci      * a single level of a one-dimensional texture, which is treated as a
10745bd8deadSopenharmony_ci        two-dimensional image with a height of one,
10755bd8deadSopenharmony_ci
10765bd8deadSopenharmony_ci      * a single level of a two-dimensional or rectangle texture,
10775bd8deadSopenharmony_ci
10785bd8deadSopenharmony_ci      * a single face of a cube map texture level, which is treated as a
10795bd8deadSopenharmony_ci        two-dimensional image, or
10805bd8deadSopenharmony_ci
10815bd8deadSopenharmony_ci      * a single layer of a one- or two-dimensional array texture or
10825bd8deadSopenharmony_ci        three-dimensional texture, which is treated as a two-dimensional
10835bd8deadSopenharmony_ci        image.
10845bd8deadSopenharmony_ci
10855bd8deadSopenharmony_ci    Additionally, an entire level of a three-dimensional texture, cube map
10865bd8deadSopenharmony_ci    texture, or one- or two-dimensional array texture can be attached to an
10875bd8deadSopenharmony_ci    attachment point.  Such attachments are treated as an array of
10885bd8deadSopenharmony_ci    two-dimensional images, arranged in layers, and the corresponding
10895bd8deadSopenharmony_ci    attachment point is considered to be layered.
10905bd8deadSopenharmony_ci
10915bd8deadSopenharmony_ci    (replace section 4.4.2.3, "Attaching Texture Images to a Framebuffer")
10925bd8deadSopenharmony_ci
10935bd8deadSopenharmony_ci    GL supports copying the rendered contents of the framebuffer into the
10945bd8deadSopenharmony_ci    images of a texture object through the use of the routines
10955bd8deadSopenharmony_ci    CopyTexImage{1D|2D}, and CopyTexSubImage{1D|2D|3D}.  Additionally, GL
10965bd8deadSopenharmony_ci    supports rendering directly into the images of a texture object.
10975bd8deadSopenharmony_ci
10985bd8deadSopenharmony_ci    To render directly into a texture image, a specified level of a texture
10995bd8deadSopenharmony_ci    object can be attached as one of the logical buffers of the currently
11005bd8deadSopenharmony_ci    bound framebuffer object by calling:
11015bd8deadSopenharmony_ci
11025bd8deadSopenharmony_ci      void FramebufferTextureARB(enum target, enum attachment,
11035bd8deadSopenharmony_ci                                 uint texture, int level);
11045bd8deadSopenharmony_ci
11055bd8deadSopenharmony_ci    <target> must be FRAMEBUFFER_EXT.  <attachment> must be one of the
11065bd8deadSopenharmony_ci    attachment points of the framebuffer listed in table 1.nnn.
11075bd8deadSopenharmony_ci
11085bd8deadSopenharmony_ci    If <texture> is zero, any image or array of images attached to the
11095bd8deadSopenharmony_ci    attachment point named by <attachment> is detached, and the state of the
11105bd8deadSopenharmony_ci    attachment point is reset to its initial values.  <level> is ignored if
11115bd8deadSopenharmony_ci    <texture> is zero.
11125bd8deadSopenharmony_ci
11135bd8deadSopenharmony_ci    If <texture> is non-zero, FramebufferTextureARB attaches level <level> of
11145bd8deadSopenharmony_ci    the texture object named <texture> to the framebuffer attachment point
11155bd8deadSopenharmony_ci    named by <attachment>.  The error INVALID_VALUE is generated if <texture>
11165bd8deadSopenharmony_ci    is not the name of a texture object, or if <level> is not a supported
11175bd8deadSopenharmony_ci    texture level number for textures of the type corresponding to <target>.
11185bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if <texture> is the name of a
11195bd8deadSopenharmony_ci    buffer texture.
11205bd8deadSopenharmony_ci
11215bd8deadSopenharmony_ci    If <texture> is the name of a three-dimensional texture, cube map texture,
11225bd8deadSopenharmony_ci    or one- or two-dimensional array texture, the texture level attached to
11235bd8deadSopenharmony_ci    the framebuffer attachment point is an array of images, and the
11245bd8deadSopenharmony_ci    framebuffer attachment is considered layered.
11255bd8deadSopenharmony_ci
11265bd8deadSopenharmony_ci    The command
11275bd8deadSopenharmony_ci
11285bd8deadSopenharmony_ci      void FramebufferTextureLayerARB(enum target, enum attachment,
11295bd8deadSopenharmony_ci                                      uint texture, int level, int layer);
11305bd8deadSopenharmony_ci
11315bd8deadSopenharmony_ci    operates like FramebufferTextureARB, except that only a single layer of
11325bd8deadSopenharmony_ci    the texture level, numbered <layer>, is attached to the attachment point.
11335bd8deadSopenharmony_ci    If <texture> is non-zero, the error INVALID_VALUE is generated if <layer>
11345bd8deadSopenharmony_ci    is negative, or if <texture> is not the name of a texture object.  The
11355bd8deadSopenharmony_ci    error INVALID_OPERATION is generated unless <texture> is zero or the name
11365bd8deadSopenharmony_ci    of a three-dimensional or one- or two-dimensional array texture.
11375bd8deadSopenharmony_ci
11385bd8deadSopenharmony_ci    The command
11395bd8deadSopenharmony_ci
11405bd8deadSopenharmony_ci      void FramebufferTextureFaceARB(enum target, enum attachment,
11415bd8deadSopenharmony_ci                                     uint texture, int level, enum face);
11425bd8deadSopenharmony_ci
11435bd8deadSopenharmony_ci    operates like FramebufferTextureARB, except that only a single face of a
11445bd8deadSopenharmony_ci    cube map texture, given by <face>, is attached to the attachment point.
11455bd8deadSopenharmony_ci    <face> is one of TEXTURE_CUBE_MAP_POSITIVE_X, TEXTURE_CUBE_MAP_NEGATIVE_X,
11465bd8deadSopenharmony_ci    TEXTURE_CUBE_MAP_POSITIVE_Y, TEXTURE_CUBE_MAP_NEGATIVE_Y,
11475bd8deadSopenharmony_ci    TEXTURE_CUBE_MAP_POSITIVE_Z, TEXTURE_CUBE_MAP_NEGATIVE_Z. If <texture> is
11485bd8deadSopenharmony_ci    non-zero, the error INVALID_VALUE is generated if <texture> is not the
11495bd8deadSopenharmony_ci    name of a texture object.  The error INVALID_OPERATION is generated unless
11505bd8deadSopenharmony_ci    <texture> is zero or the name of a cube map texture.
11515bd8deadSopenharmony_ci
11525bd8deadSopenharmony_ci    The command
11535bd8deadSopenharmony_ci
11545bd8deadSopenharmony_ci      void FramebufferTexture1DARB(enum target, enum attachment,
11555bd8deadSopenharmony_ci                                   enum textarget, uint texture, int level);
11565bd8deadSopenharmony_ci
11575bd8deadSopenharmony_ci    operates identically to FramebufferTextureARB, except for two additional
11585bd8deadSopenharmony_ci    restrictions.  If <texture> is non-zero, the error INVALID_ENUM is
11595bd8deadSopenharmony_ci    generated if <textarget> is not TEXTURE_1D and the error INVALID_OPERATION
11605bd8deadSopenharmony_ci    is generated unless <texture> is the name of a one-dimensional texture.
11615bd8deadSopenharmony_ci
11625bd8deadSopenharmony_ci    The command
11635bd8deadSopenharmony_ci
11645bd8deadSopenharmony_ci      void FramebufferTexture2DARB(enum target, enum attachment,
11655bd8deadSopenharmony_ci                                   enum textarget, uint texture, int level);
11665bd8deadSopenharmony_ci
11675bd8deadSopenharmony_ci    operates similarly to FramebufferTextureARB.  If <textarget> is TEXTURE_2D
11685bd8deadSopenharmony_ci    or TEXTURE_RECTANGLE_ARB, <texture> must be zero or the name of a
11695bd8deadSopenharmony_ci    two-dimensional or rectangle texture.  If <textarget> is
11705bd8deadSopenharmony_ci    TEXTURE_CUBE_MAP_POSITIVE_X, TEXTURE_CUBE_MAP_NEGATIVE_X,
11715bd8deadSopenharmony_ci    TEXTURE_CUBE_MAP_POSITIVE_Y, TEXTURE_CUBE_MAP_NEGATIVE_Y,
11725bd8deadSopenharmony_ci    TEXTURE_CUBE_MAP_POSITIVE_Z, or TEXTURE_CUBE_MAP_NEGATIVE_Z, <texture>
11735bd8deadSopenharmony_ci    must be zero or the name of a cube map texture.  For cube map textures,
11745bd8deadSopenharmony_ci    only the single face of the cube map texture level given by <textarget> is
11755bd8deadSopenharmony_ci    attached.  The error INVALID_ENUM is generated if <texture> is not zero
11765bd8deadSopenharmony_ci    and <textarget> is not one of the values enumerated above.  The error
11775bd8deadSopenharmony_ci    INVALID_OPERATION is generated if <texture> is the name of a texture whose
11785bd8deadSopenharmony_ci    type does not match the texture type required by <textarget>.
11795bd8deadSopenharmony_ci
11805bd8deadSopenharmony_ci    The command
11815bd8deadSopenharmony_ci
11825bd8deadSopenharmony_ci      void FramebufferTexture3DEXT(enum target, enum attachment,
11835bd8deadSopenharmony_ci                                   enum textarget, uint texture,
11845bd8deadSopenharmony_ci                                   int level, int zoffset);
11855bd8deadSopenharmony_ci
11865bd8deadSopenharmony_ci    behaves identically to FramebufferTextureLayerARB, with the <layer>
11875bd8deadSopenharmony_ci    parameter set to the value of <zoffset>.  The error INVALID_ENUM is
11885bd8deadSopenharmony_ci    generated if <textarget> is not TEXTURE_3D.  The error INVALID_OPERATION
11895bd8deadSopenharmony_ci    is generated unless <texture> is zero or the name of a three-dimensional
11905bd8deadSopenharmony_ci    texture.
11915bd8deadSopenharmony_ci
11925bd8deadSopenharmony_ci    For all FramebufferTexture commands, if <texture> is non-zero and the
11935bd8deadSopenharmony_ci    command does not result in an error, the framebuffer attachment state
11945bd8deadSopenharmony_ci    corresponding to <attachment> is updated based on the new attachment.
11955bd8deadSopenharmony_ci    FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT is set to TEXTURE,
11965bd8deadSopenharmony_ci    FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT is set to <texture>, and
11975bd8deadSopenharmony_ci    FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL is set to <level>.
11985bd8deadSopenharmony_ci    FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_FACE is set to <textarget> if
11995bd8deadSopenharmony_ci    FramebufferTexture2DEXT is called and <texture> is the name of a cubemap
12005bd8deadSopenharmony_ci    texture; otherwise, it is set to TEXTURE_CUBE_MAP_POSITIVE_X.
12015bd8deadSopenharmony_ci    FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER is set to <layer> or <zoffset> if
12025bd8deadSopenharmony_ci    FramebufferTextureLayerEXT or FramebufferTexture3DEXT is called;
12035bd8deadSopenharmony_ci    otherwise, it is set to zero.  FRAMEBUFFER_ATTACHMENT_LAYERED_ARB is set
12045bd8deadSopenharmony_ci    to TRUE if FramebufferTextureARB is called and <texture> is the name of a
12055bd8deadSopenharmony_ci    three-dimensional texture, cube map texture, or one- or two-dimensional
12065bd8deadSopenharmony_ci    array texture; otherwise it is set to FALSE.
12075bd8deadSopenharmony_ci
12085bd8deadSopenharmony_ci    (modify Section 4.4.4.1, Framebuffer Attachment Completeness -- add to the
12095bd8deadSopenharmony_ci    conditions necessary for attachment completeness)
12105bd8deadSopenharmony_ci
12115bd8deadSopenharmony_ci    The framebuffer attachment point <attachment> is said to be "framebuffer
12125bd8deadSopenharmony_ci    attachment complete" if ...:
12135bd8deadSopenharmony_ci
12145bd8deadSopenharmony_ci      * If FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT is TEXTURE and
12155bd8deadSopenharmony_ci        FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT names a three-dimensional
12165bd8deadSopenharmony_ci        texture, FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER must be smaller than
12175bd8deadSopenharmony_ci        the depth of the texture.
12185bd8deadSopenharmony_ci
12195bd8deadSopenharmony_ci      * If FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT is TEXTURE and
12205bd8deadSopenharmony_ci        FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT names a one- or two-dimensional
12215bd8deadSopenharmony_ci        array texture, FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER must be
12225bd8deadSopenharmony_ci        smaller than the number of layers in the texture.
12235bd8deadSopenharmony_ci
12245bd8deadSopenharmony_ci    (modify section 4.4.4.2, Framebuffer Completeness -- add to the list of
12255bd8deadSopenharmony_ci    conditions necessary for completeness)
12265bd8deadSopenharmony_ci
12275bd8deadSopenharmony_ci      * If any framebuffer attachment is layered, all populated attachments
12285bd8deadSopenharmony_ci        must be layered.  Additionally, all populated color attachments must
12295bd8deadSopenharmony_ci        be from textures of the same target (i.e., three-dimensional, cube
12305bd8deadSopenharmony_ci        map, or one- or two-dimensional array textures).
12315bd8deadSopenharmony_ci        { FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB }
12325bd8deadSopenharmony_ci
12335bd8deadSopenharmony_ci      * If any framebuffer attachment is layered, all attachments must have
12345bd8deadSopenharmony_ci        the same layer count.  For three-dimensional textures, the layer count
12355bd8deadSopenharmony_ci        is the depth of the attached volume.  For cube map textures, the layer
12365bd8deadSopenharmony_ci        count is always six.  For one- and two-dimensional array textures, the
12375bd8deadSopenharmony_ci        layer count is simply the number of layers in the array texture.
12385bd8deadSopenharmony_ci        { FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB }
12395bd8deadSopenharmony_ci
12405bd8deadSopenharmony_ci    The enum in { brackets } after each clause of the framebuffer completeness
12415bd8deadSopenharmony_ci    rules specifies the return value of CheckFramebufferStatusARB (see below)
12425bd8deadSopenharmony_ci    that is generated when that clause is violated. ...
12435bd8deadSopenharmony_ci
12445bd8deadSopenharmony_ci    (add section 4.4.7, Layered Framebuffers)
12455bd8deadSopenharmony_ci
12465bd8deadSopenharmony_ci    A framebuffer is considered to be layered if it is complete and all of its
12475bd8deadSopenharmony_ci    populated attachments are layered.  When rendering to a layered
12485bd8deadSopenharmony_ci    framebuffer, each fragment generated by the GL is assigned a layer number.
12495bd8deadSopenharmony_ci    The layer number for a fragment is zero if
12505bd8deadSopenharmony_ci
12515bd8deadSopenharmony_ci      * the fragment is generated by DrawPixels, CopyPixels, or Bitmap,
12525bd8deadSopenharmony_ci
12535bd8deadSopenharmony_ci      * geometry shaders are disabled, or
12545bd8deadSopenharmony_ci
12555bd8deadSopenharmony_ci      * the current geometry shader does not contain an instruction that
12565bd8deadSopenharmony_ci        statically assigns a value to the built-in output variable gl_Layer.
12575bd8deadSopenharmony_ci
12585bd8deadSopenharmony_ci    Otherwise, the layer for each point, line, or triangle emitted by the
12595bd8deadSopenharmony_ci    geometry shader is taken from the layer output of one of the vertices of
12605bd8deadSopenharmony_ci    the primitive.  The vertex used is implementation-dependent.  To get
12615bd8deadSopenharmony_ci    defined results, all vertices of each primitive emitted should set the
12625bd8deadSopenharmony_ci    same value for gl_Layer.  Since the EndPrimitive() built-in function
12635bd8deadSopenharmony_ci    starts a new output primitive, defined results can be achieved if
12645bd8deadSopenharmony_ci    EndPrimitive() is called between two vertices emitted with different layer
12655bd8deadSopenharmony_ci    numbers.  A layer number written by a geometry shader has no effect if the
12665bd8deadSopenharmony_ci    framebuffer is not layered.
12675bd8deadSopenharmony_ci
12685bd8deadSopenharmony_ci    When fragments are written to a layered framebuffer, the fragment's layer
12695bd8deadSopenharmony_ci    number selects a single image from the array of images at each attachment
12705bd8deadSopenharmony_ci    point to use for the stencil test (section 4.1.5), depth buffer test
12715bd8deadSopenharmony_ci    (section 4.1.6), and for blending and color buffer writes (section 4.1.8).
12725bd8deadSopenharmony_ci    If the fragment's layer number is negative or greater than the number of
12735bd8deadSopenharmony_ci    layers attached, the effects of the fragment on the framebuffer contents
12745bd8deadSopenharmony_ci    are undefined.
12755bd8deadSopenharmony_ci
12765bd8deadSopenharmony_ci    When the Clear command is used to clear a layered framebuffer attachment,
12775bd8deadSopenharmony_ci    all layers of the attachment are cleared.
12785bd8deadSopenharmony_ci
12795bd8deadSopenharmony_ci    When commands such as ReadPixels or CopyPixels read from a layered
12805bd8deadSopenharmony_ci    framebuffer, the image at layer zero of the selected attachment is always
12815bd8deadSopenharmony_ci    used to obtain pixel values.
12825bd8deadSopenharmony_ci
12835bd8deadSopenharmony_ci    When cube map texture levels are attached to a layered framebuffer, there
12845bd8deadSopenharmony_ci    are six layers attached, numbered zero through five.  Each layer number is
12855bd8deadSopenharmony_ci    mapped to a cube map face, as indicated in Table X.4.
12865bd8deadSopenharmony_ci
12875bd8deadSopenharmony_ci      layer number   cube map face
12885bd8deadSopenharmony_ci      ------------   ---------------------------
12895bd8deadSopenharmony_ci           0         TEXTURE_CUBE_MAP_POSITIVE_X
12905bd8deadSopenharmony_ci           1         TEXTURE_CUBE_MAP_NEGATIVE_X
12915bd8deadSopenharmony_ci           2         TEXTURE_CUBE_MAP_POSITIVE_Y
12925bd8deadSopenharmony_ci           3         TEXTURE_CUBE_MAP_NEGATIVE_Y
12935bd8deadSopenharmony_ci           4         TEXTURE_CUBE_MAP_POSITIVE_Z
12945bd8deadSopenharmony_ci           5         TEXTURE_CUBE_MAP_NEGATIVE_Z
12955bd8deadSopenharmony_ci
12965bd8deadSopenharmony_ci      Table X.4, Layer numbers for cube map texture faces.  The layers are
12975bd8deadSopenharmony_ci      numbered in the same sequence as the cube map face token values.
12985bd8deadSopenharmony_ci
12995bd8deadSopenharmony_ci    (modify Section 6.1.3, Enumerated Queries -- Modify/add to list of <pname>
13005bd8deadSopenharmony_ci    values for GetFramebufferAttachmentParameterivARB if
13015bd8deadSopenharmony_ci    FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT is TEXTURE)
13025bd8deadSopenharmony_ci
13035bd8deadSopenharmony_ci      If <pname> is FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER and the attached
13045bd8deadSopenharmony_ci      image is a layer of a three-dimensional texture or one- or
13055bd8deadSopenharmony_ci      two-dimensional array texture, then <params> will contain the specified
13065bd8deadSopenharmony_ci      layer number.  Otherwise, <params> will contain the value zero.
13075bd8deadSopenharmony_ci
13085bd8deadSopenharmony_ci      If <pname> is FRAMEBUFFER_ATTACHMENT_LAYERED_ARB, then <params> will
13095bd8deadSopenharmony_ci      contain TRUE if an entire level of a three-dimesional texture, cube map
13105bd8deadSopenharmony_ci      texture, or one- or two-dimensional array texture is attached to the
13115bd8deadSopenharmony_ci      <attachment>.  Otherwise, <params> will contain FALSE.
13125bd8deadSopenharmony_ci
13135bd8deadSopenharmony_ci    (Modify the Additions to Chapter 5, section 5.4)
13145bd8deadSopenharmony_ci
13155bd8deadSopenharmony_ci    Add the commands FramebufferTextureARB, FramebufferTextureLayerARB, and
13165bd8deadSopenharmony_ci    FramebufferTextureFaceARB to the list of commands that are not compiled
13175bd8deadSopenharmony_ci    into a display list, but executed immediately.
13185bd8deadSopenharmony_ci
13195bd8deadSopenharmony_ciDependencies on EXT_framebuffer_blit
13205bd8deadSopenharmony_ci
13215bd8deadSopenharmony_ci    If EXT_framebuffer_blit is supported, the EXT_framebuffer_object language
13225bd8deadSopenharmony_ci    should be further amended so that <target> values passed to
13235bd8deadSopenharmony_ci    FramebufferTextureARB and FramebufferTextureLayerARB can be
13245bd8deadSopenharmony_ci    DRAW_FRAMEBUFFER_EXT or READ_FRAMEBUFFER_EXT, and that those functions
13255bd8deadSopenharmony_ci    set/query state for the draw framebuffer if <target> is FRAMEBUFFER_EXT.
13265bd8deadSopenharmony_ci
13275bd8deadSopenharmony_ci    If BlitFramebufferEXT() is called with a layered read framebuffer, pixel
13285bd8deadSopenharmony_ci    values are obtained from layer zero from the read framebuffer.  If the
13295bd8deadSopenharmony_ci    draw framebuffer is layered, pixel values are written to layer zero of the
13305bd8deadSopenharmony_ci    draw framebuffer.  If both framebuffers are layered, the two-dimensional
13315bd8deadSopenharmony_ci    blit operation is still performed only on layer zero.
13325bd8deadSopenharmony_ci
13335bd8deadSopenharmony_ciDependencies on EXT_texture_array
13345bd8deadSopenharmony_ci
13355bd8deadSopenharmony_ci    If EXT_texture_array is not supported, the discussion array textures the
13365bd8deadSopenharmony_ci    layered rendering edits to EXT_framebuffer_object should be
13375bd8deadSopenharmony_ci    removed. Layered rendering to cube map and 3D textures would still be
13385bd8deadSopenharmony_ci    supported.
13395bd8deadSopenharmony_ci
13405bd8deadSopenharmony_ci    If EXT_texture_array is supported, the edits to EXT_framebuffer_object
13415bd8deadSopenharmony_ci    supersede those made in EXT_texture_array, except for language pertaining
13425bd8deadSopenharmony_ci    to mipmap generation of array textures.
13435bd8deadSopenharmony_ci
13445bd8deadSopenharmony_ci    There are no functional incompatibilities between the FBO support in these
13455bd8deadSopenharmony_ci    two specifications.  The only differences are that this extension supports
13465bd8deadSopenharmony_ci    layered rendering and also rewrites certain sections of the core FBO
13475bd8deadSopenharmony_ci    specification more aggressively.
13485bd8deadSopenharmony_ci
13495bd8deadSopenharmony_ciDependencies on ARB_texture_rectangle
13505bd8deadSopenharmony_ci
13515bd8deadSopenharmony_ci    If ARB_texture_rectangle is not supported, all references to rectangle
13525bd8deadSopenharmony_ci    textures in the EXT_framebuffer_object spec language should be removed.
13535bd8deadSopenharmony_ci
13545bd8deadSopenharmony_ciDependencies on ARB_texture_buffer_object
13555bd8deadSopenharmony_ci
13565bd8deadSopenharmony_ci    If ARB_buffer_object is not supported, the reference to an
13575bd8deadSopenharmony_ci    INVALID_OPERATION error if a buffer texture is passed to
13585bd8deadSopenharmony_ci    FramebufferTextureARB should be removed.
13595bd8deadSopenharmony_ci
13605bd8deadSopenharmony_ciDependencies on OpenGL 3.2
13615bd8deadSopenharmony_ci
13625bd8deadSopenharmony_ci    If this extension and OpenGL 3.2 (and GLSL 1.50) are supported, two
13635bd8deadSopenharmony_ci    slightly different versions of geometry shader support are available.
13645bd8deadSopenharmony_ci
13655bd8deadSopenharmony_ci    In this extension, the input and output primitive types and maximum output
13665bd8deadSopenharmony_ci    vertex count are specified prior to linking, using the
13675bd8deadSopenharmony_ci    ProgramParameteriARB command.  However, OpenGL 3.2 requires that these
13685bd8deadSopenharmony_ci    properties be specified using the "layout" modifier in geometry shader
13695bd8deadSopenharmony_ci    source and provides no program paramter state.  For implementations
13705bd8deadSopenharmony_ci    supporting both features, there are potentially two different ways to set
13715bd8deadSopenharmony_ci    these properties prior to linking a program.  If no geometry shader
13725bd8deadSopenharmony_ci    enables this extension via "#extension", all three properties must be
13735bd8deadSopenharmony_ci    specified in shader source as required by OpenGL 3.2.  Otherwise, these
13745bd8deadSopenharmony_ci    properties need not be specified in source code, but still may be if
13755bd8deadSopenharmony_ci    #version 150 or better is enabled.  If a given property is specified in
13765bd8deadSopenharmony_ci    geometry shader source, the value from the source code is used; otherwise,
13775bd8deadSopenharmony_ci    the value of the program parameter state is used.
13785bd8deadSopenharmony_ci
13795bd8deadSopenharmony_ci    Additionally, OpenGL 3.2 and ARB_geometry_shader have similarly-named
13805bd8deadSopenharmony_ci    queries for the input and output primitive type and maximum vertex count.
13815bd8deadSopenharmony_ci    In particular, the commands
13825bd8deadSopenharmony_ci
13835bd8deadSopenharmony_ci      glGetProgramiv(program, GL_GEOMETRY_VERTICES_OUT_ARB, &verticesOut);
13845bd8deadSopenharmony_ci      glGetProgramiv(program, GL_GEOMETRY_INPUT_TYPE_ARB,   &inputType);
13855bd8deadSopenharmony_ci      glGetProgramiv(program, GL_GEOMETRY_OUTPUT_TYPE_ARB,  &outputType);
13865bd8deadSopenharmony_ci
13875bd8deadSopenharmony_ci    query the program parameter state provided by this extension.  If the
13885bd8deadSopenharmony_ci    program parameter state is changed without relinking, the new values will
13895bd8deadSopenharmony_ci    be returned, even though old values will be in effect when the program is
13905bd8deadSopenharmony_ci    used.  These queries are not supported by unextended OpenGL 3.2.  Instead,
13915bd8deadSopenharmony_ci    OpenGL 3.2 supports the following queries:
13925bd8deadSopenharmony_ci
13935bd8deadSopenharmony_ci      glGetProgramiv(program, GL_GEOMETRY_VERTICES_OUT, &verticesOut);
13945bd8deadSopenharmony_ci      glGetProgramiv(program, GL_GEOMETRY_INPUT_TYPE,   &inputType);
13955bd8deadSopenharmony_ci      glGetProgramiv(program, GL_GEOMETRY_OUTPUT_TYPE,  &outputType);
13965bd8deadSopenharmony_ci
13975bd8deadSopenharmony_ci    The OpenGL 3.2 queries return the properties established when the program
13985bd8deadSopenharmony_ci    is linked, and ignore the program parameter state.  Despite the very
13995bd8deadSopenharmony_ci    similar names, there is no conflict -- neither the enumerant names nor the
14005bd8deadSopenharmony_ci    values are exactly the same.
14015bd8deadSopenharmony_ci
14025bd8deadSopenharmony_ci    If OpenGL 3.2 is supported and layered framebuffer attachments are used,
14035bd8deadSopenharmony_ci    the requirement that all layer counts match is removed and the
14045bd8deadSopenharmony_ci    FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB error condition will never be
14055bd8deadSopenharmony_ci    generated.  Instead, rendering will use the minimum layer count for all
14065bd8deadSopenharmony_ci    attachments as specified by OpenGL 3.2.  This change was made for
14075bd8deadSopenharmony_ci    consistency with OpenGL 3.0's framebuffer object support, which similarly
14085bd8deadSopenharmony_ci    lifted the requirement that framebuffer attachments have matching widths
14095bd8deadSopenharmony_ci    and heights.
14105bd8deadSopenharmony_ci
14115bd8deadSopenharmony_ciDependencies on ARB_uniform_buffer_object
14125bd8deadSopenharmony_ci
14135bd8deadSopenharmony_ci    If ARB_uniform_buffer_object (or OpenGL 3.1) is not supported, language
14145bd8deadSopenharmony_ci    referring to MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS (defined in the
14155bd8deadSopenharmony_ci    ARB_uniform_buffer_object spec) and the "default uniform block" should be
14165bd8deadSopenharmony_ci    removed.
14175bd8deadSopenharmony_ci
14185bd8deadSopenharmony_ci
14195bd8deadSopenharmony_ciGLX Protocol
14205bd8deadSopenharmony_ci
14215bd8deadSopenharmony_ci    The following rendering command is sent to the server as part of a
14225bd8deadSopenharmony_ci    glXRender request:
14235bd8deadSopenharmony_ci
14245bd8deadSopenharmony_ci    ProgramParameteriARB
14255bd8deadSopenharmony_ci        2           16               rendering command length
14265bd8deadSopenharmony_ci        2           266              rendering command opcode
14275bd8deadSopenharmony_ci        4           CARD32           program
14285bd8deadSopenharmony_ci        4           ENUM             pname
14295bd8deadSopenharmony_ci        4           INT32            value
14305bd8deadSopenharmony_ci
14315bd8deadSopenharmony_ci    FramebufferTextureARB
14325bd8deadSopenharmony_ci
14335bd8deadSopenharmony_ci        2           20               rendering command length
14345bd8deadSopenharmony_ci        2           267              rendering command opcode
14355bd8deadSopenharmony_ci        4           ENUM             target
14365bd8deadSopenharmony_ci        4           ENUM             attachment
14375bd8deadSopenharmony_ci        4           CARD32           texture
14385bd8deadSopenharmony_ci        4           INT32            level
14395bd8deadSopenharmony_ci
14405bd8deadSopenharmony_ci    FramebufferTextureLayerARB
14415bd8deadSopenharmony_ci
14425bd8deadSopenharmony_ci        2           24               rendering command length
14435bd8deadSopenharmony_ci        2           237              rendering command opcode
14445bd8deadSopenharmony_ci        4           ENUM             target
14455bd8deadSopenharmony_ci        4           ENUM             attachment
14465bd8deadSopenharmony_ci        4           CARD32           texture
14475bd8deadSopenharmony_ci        4           INT32            level
14485bd8deadSopenharmony_ci        4           INT32            layer
14495bd8deadSopenharmony_ci
14505bd8deadSopenharmony_ci    FramebufferTextureFaceARB
14515bd8deadSopenharmony_ci
14525bd8deadSopenharmony_ci        2           24               rendering command length
14535bd8deadSopenharmony_ci        2           268              rendering command opcode
14545bd8deadSopenharmony_ci        4           ENUM             target
14555bd8deadSopenharmony_ci        4           ENUM             attachment
14565bd8deadSopenharmony_ci        4           CARD32           texture
14575bd8deadSopenharmony_ci        4           INT32            level
14585bd8deadSopenharmony_ci        4           ENUM             face
14595bd8deadSopenharmony_ci
14605bd8deadSopenharmony_ciErrors
14615bd8deadSopenharmony_ci
14625bd8deadSopenharmony_ci    The error INVALID_VALUE is generated by ProgramParameteriARB if <pname> is
14635bd8deadSopenharmony_ci    GEOMETRY_INPUT_TYPE_ARB and <value> is not one of POINTS, LINES,
14645bd8deadSopenharmony_ci    LINES_ADJACENCY_ARB, TRIANGLES or TRIANGLES_ADJACENCY_ARB.
14655bd8deadSopenharmony_ci
14665bd8deadSopenharmony_ci    The error INVALID_VALUE is generated by ProgramParameteriARB if <pname> is
14675bd8deadSopenharmony_ci    GEOMETRY_OUTPUT_TYPE_ARB and <value> is not one of POINTS, LINE_STRIP or
14685bd8deadSopenharmony_ci    TRIANGLE_STRIP.
14695bd8deadSopenharmony_ci
14705bd8deadSopenharmony_ci    The error INVALID_VALUE is generated by ProgramParameteriARB if <pname> is
14715bd8deadSopenharmony_ci    GEOMETRY_VERTICES_OUT_ARB and <value> is negative.
14725bd8deadSopenharmony_ci
14735bd8deadSopenharmony_ci    The error INVALID_VALUE is generated by ProgramParameteriARB if <pname> is
14745bd8deadSopenharmony_ci    GEOMETRY_VERTICES_OUT_ARB and <value> exceeds
14755bd8deadSopenharmony_ci    MAX_GEOMETRY_OUTPUT_VERTICES_ARB.
14765bd8deadSopenharmony_ci
14775bd8deadSopenharmony_ci    The error INVALID_VALUE is generated by ProgramParameteriARB if <pname> is
14785bd8deadSopenharmony_ci    set to GEOMETRY_VERTICES_OUT_ARB and the product of <value> and the sum of
14795bd8deadSopenharmony_ci    all components of all active varying variables exceeds
14805bd8deadSopenharmony_ci    MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB.
14815bd8deadSopenharmony_ci
14825bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if Begin, or any command that
14835bd8deadSopenharmony_ci    implicitly calls Begin, is called when a geometry shader is active and:
14845bd8deadSopenharmony_ci
14855bd8deadSopenharmony_ci      * the input primitive type of the current geometry shader is
14865bd8deadSopenharmony_ci        POINTS and <mode> is not POINTS,
14875bd8deadSopenharmony_ci
14885bd8deadSopenharmony_ci      * the input primitive type of the current geometry shader is
14895bd8deadSopenharmony_ci        LINES and <mode> is not LINES, LINE_STRIP, or LINE_LOOP,
14905bd8deadSopenharmony_ci
14915bd8deadSopenharmony_ci      * the input primitive type of the current geometry shader is
14925bd8deadSopenharmony_ci        TRIANGLES and <mode> is not TRIANGLES, TRIANGLE_STRIP or
14935bd8deadSopenharmony_ci        TRIANGLE_FAN,
14945bd8deadSopenharmony_ci
14955bd8deadSopenharmony_ci      * the input primitive type of the current geometry shader is
14965bd8deadSopenharmony_ci        LINES_ADJACENCY_ARB and <mode> is not LINES_ADJACENCY_ARB or
14975bd8deadSopenharmony_ci        LINE_STRIP_ADJACENCY_ARB, or
14985bd8deadSopenharmony_ci
14995bd8deadSopenharmony_ci      * the input primitive type of the current geometry shader is
15005bd8deadSopenharmony_ci        TRIANGLES_ADJACENCY_ARB and <mode> is not
15015bd8deadSopenharmony_ci        TRIANGLES_ADJACENCY_ARB or TRIANGLE_STRIP_ADJACENCY_ARB.
15025bd8deadSopenharmony_ci
15035bd8deadSopenharmony_ciNew State
15045bd8deadSopenharmony_ci
15055bd8deadSopenharmony_ci                                                       Initial
15065bd8deadSopenharmony_ci    Get Value                  Type    Get Command      Value  Description            Sec.    Attribute
15075bd8deadSopenharmony_ci    -------------------------  ----    -----------     ------- ---------------------- ------  ----------
15085bd8deadSopenharmony_ci    FRAMEBUFFER_ATTACHMENT_    nxB     GetFramebuffer-  FALSE  Framebuffer attachment 4.4.2.3     -
15095bd8deadSopenharmony_ci      LAYERED_ARB                      Attachment-             is layered
15105bd8deadSopenharmony_ci                                       ParameterivARB
15115bd8deadSopenharmony_ci
15125bd8deadSopenharmony_ci    Modify the following state value in Table 6.28, Shader Object State,
15135bd8deadSopenharmony_ci    p. 289.
15145bd8deadSopenharmony_ci
15155bd8deadSopenharmony_ci    Get Value           Type    Get Command      Value  Description                   Sec.    Attribute
15165bd8deadSopenharmony_ci    ------------------  ----    -----------     ------- ----------------------        ------  ---------
15175bd8deadSopenharmony_ci    SHADER_TYPE          Z2      GetShaderiv       -    Type of shader (vertex,       2.15.1      -
15185bd8deadSopenharmony_ci                                                        Fragment, geometry)
15195bd8deadSopenharmony_ci
15205bd8deadSopenharmony_ci    Add the following state to Table 6.29, Program Object State, p. 290
15215bd8deadSopenharmony_ci
15225bd8deadSopenharmony_ci                                                    Initial
15235bd8deadSopenharmony_ci    Get Value                 Type   Get Command     Value     Description               Sec.  Attribute
15245bd8deadSopenharmony_ci    ------------------------- ----  ------------    -------    -----------------        ------  -------
15255bd8deadSopenharmony_ci    GEOMETRY_VERTICES_OUT_ARB  Z+    GetProgramiv      0       max # of output vertices 2.16.4    -
15265bd8deadSopenharmony_ci    GEOMETRY_INPUT_TYPE_ARB    Z5    GetProgramiv   TRIANGLES  Primitive input type     2.16.1    -
15275bd8deadSopenharmony_ci    GEOMETRY_OUTPUT_TYPE_ARB   Z3    GetProgramiv   TRIANGLE_  Primitive output type    2.16.2    -
15285bd8deadSopenharmony_ci                                                      STRIP
15295bd8deadSopenharmony_ci
15305bd8deadSopenharmony_ciNew Implementation Dependent State
15315bd8deadSopenharmony_ci
15325bd8deadSopenharmony_ci                                               Min.
15335bd8deadSopenharmony_ci    Get Value               Type  Get Command  Value  Description            Sec.     Attrib
15345bd8deadSopenharmony_ci    ----------------------  ----  -----------  -----  --------------------   --------  ------
15355bd8deadSopenharmony_ci    MAX_GEOMETRY_TEXTURE_     Z+  GetIntegerv  0      maximum number of       2.16.4     -
15365bd8deadSopenharmony_ci      IMAGE_UNITS_ARB                                 texture image units
15375bd8deadSopenharmony_ci                                                      accessible in a
15385bd8deadSopenharmony_ci                                                      geometry shader
15395bd8deadSopenharmony_ci    MAX_GEOMETRY_OUTPUT_      Z+  GetIntegerv  256    maximum number of       2.16.4     -
15405bd8deadSopenharmony_ci      VERTICES_ARB                                    vertices that any
15415bd8deadSopenharmony_ci                                                      geometry shader can
15425bd8deadSopenharmony_ci                                                      can emit
15435bd8deadSopenharmony_ci    MAX_GEOMETRY_TOTAL_       Z+  GetIntegerv  1024   maximum number of       2.16.4     -
15445bd8deadSopenharmony_ci      OUTPUT_COMPONENTS_ARB                           total components (all 
15455bd8deadSopenharmony_ci                                                      vertices) of active
15465bd8deadSopenharmony_ci                                                      varyings that a
15475bd8deadSopenharmony_ci                                                      geometry shader can
15485bd8deadSopenharmony_ci                                                      emit
15495bd8deadSopenharmony_ci    MAX_GEOMETRY_UNIFORM_     Z+  GetIntegerv  512    Number of words for     2.16.3     -
15505bd8deadSopenharmony_ci      COMPONENTS_ARB                                  geometry shader 
15515bd8deadSopenharmony_ci                                                      uniform variables
15525bd8deadSopenharmony_ci    MAX_GEOMETRY_VARYING_     Z+  GetIntegerv  32     Number of components    2.16.4     -
15535bd8deadSopenharmony_ci      COMPONENTS_ARB                                  for varying variables
15545bd8deadSopenharmony_ci                                                      between geometry and
15555bd8deadSopenharmony_ci                                                      fragment shaders
15565bd8deadSopenharmony_ci    MAX_VERTEX_VARYING_       Z+  GetIntegerv  32     Number of components    2.15.3     -
15575bd8deadSopenharmony_ci      COMPONENTS_ARB                                  for varying variables
15585bd8deadSopenharmony_ci                                                      between Vertex and
15595bd8deadSopenharmony_ci                                                      geometry shaders
15605bd8deadSopenharmony_ci    MAX_VARYING_              Z+  GetIntegerv  32     Alias for               2.15.3     -
15615bd8deadSopenharmony_ci      COMPONENTS_ARB                                  MAX_VARYING_FLOATS
15625bd8deadSopenharmony_ci
15635bd8deadSopenharmony_ciModifications to the OpenGL Shading Language Specification version
15645bd8deadSopenharmony_ci1.10.59
15655bd8deadSopenharmony_ci
15665bd8deadSopenharmony_ci    Including the following line in a shader can be used to control the
15675bd8deadSopenharmony_ci    language features described in this extension:
15685bd8deadSopenharmony_ci
15695bd8deadSopenharmony_ci      #extension GL_ARB_geometry_shader4 : <behavior>
15705bd8deadSopenharmony_ci
15715bd8deadSopenharmony_ci    where <behavior> is as specified in section 3.3.
15725bd8deadSopenharmony_ci
15735bd8deadSopenharmony_ci    A new preprocessor #define is added to the OpenGL Shading Language:
15745bd8deadSopenharmony_ci
15755bd8deadSopenharmony_ci      #define GL_ARB_geometry_shader4 1
15765bd8deadSopenharmony_ci
15775bd8deadSopenharmony_ci    Change the introduction to Chapter 2 "Overview of OpenGL Shading" as
15785bd8deadSopenharmony_ci    follows:
15795bd8deadSopenharmony_ci
15805bd8deadSopenharmony_ci    The OpenGL Shading Language is actually three closely related
15815bd8deadSopenharmony_ci    languages. These languages are used to create shaders for the programmable
15825bd8deadSopenharmony_ci    processors contained in the OpenGL processing pipeline. The precise
15835bd8deadSopenharmony_ci    definition of these programmable units is left to separate
15845bd8deadSopenharmony_ci    specifications. In this document, we define them only well enough to
15855bd8deadSopenharmony_ci    provide a context for defining these languages.  Unless otherwise noted in
15865bd8deadSopenharmony_ci    this paper, a language feature applies to all languages, and common usage
15875bd8deadSopenharmony_ci    will refer to these languages as a single language. The specific languages
15885bd8deadSopenharmony_ci    will be referred to by the name of the processor they target: vertex,
15895bd8deadSopenharmony_ci    geometry or fragment.
15905bd8deadSopenharmony_ci
15915bd8deadSopenharmony_ci    Change the last sentence of the first paragraph of section 3.2
15925bd8deadSopenharmony_ci    "Source Strings" to:
15935bd8deadSopenharmony_ci
15945bd8deadSopenharmony_ci    Multiple shaders of the same language (vertex, geometry or fragment) can
15955bd8deadSopenharmony_ci    be linked together to form a single program.
15965bd8deadSopenharmony_ci
15975bd8deadSopenharmony_ci    Change the first paragraph of section 4.1.3, "Integers" as follows:
15985bd8deadSopenharmony_ci
15995bd8deadSopenharmony_ci    ... integers are limited to 16 bits of precision, plus a sign
16005bd8deadSopenharmony_ci    representation in the vertex, geometry and fragment languages..
16015bd8deadSopenharmony_ci
16025bd8deadSopenharmony_ci    Change the first paragraph of section 4.1.9, "Arrays", as follows:
16035bd8deadSopenharmony_ci
16045bd8deadSopenharmony_ci    Variables of the same type can be aggregated into one- and two-
16055bd8deadSopenharmony_ci    dimensional arrays by declaring a name followed by brackets ( [ ] for
16065bd8deadSopenharmony_ci    one-dimensional arrays and [][] for two-dimensional arrays) enclosing an
16075bd8deadSopenharmony_ci    optional size. When an array size is specified in a declaration, it must
16085bd8deadSopenharmony_ci    be an integral constant expression (see Section 4.3.3 "Integral Constant
16095bd8deadSopenharmony_ci    Expressions") greater than zero.  If an array is indexed with an
16105bd8deadSopenharmony_ci    expression that is not an integral constant expression or passed as an
16115bd8deadSopenharmony_ci    argument to a function, then its size must be declared before any such
16125bd8deadSopenharmony_ci    use. It is legal to declare an array without a size and then later
16135bd8deadSopenharmony_ci    re-declare the same name as an array of the same type and specify a
16145bd8deadSopenharmony_ci    size. It is illegal to declare an array with a size, and then later (in
16155bd8deadSopenharmony_ci    the same shader) index the same array with an integral constant expression
16165bd8deadSopenharmony_ci    greater than or equal to the declared size. It is also illegal to index an
16175bd8deadSopenharmony_ci    array with a negative constant expression. Arrays declared as formal
16185bd8deadSopenharmony_ci    parameters in a function declaration must specify a size.  Undefined
16195bd8deadSopenharmony_ci    behavior results from indexing an array with a non-constant expression
16205bd8deadSopenharmony_ci    that's greater than or equal to the array's size or less than 0. All basic
16215bd8deadSopenharmony_ci    types and structures can be formed into arrays.
16225bd8deadSopenharmony_ci
16235bd8deadSopenharmony_ci    Two-dimensional arrays can only be declared as "varying in" variables in a
16245bd8deadSopenharmony_ci    geometry shader. See section 4.3.6 for details. All other declarations of
16255bd8deadSopenharmony_ci    two-dimensional arrays are illegal.
16265bd8deadSopenharmony_ci
16275bd8deadSopenharmony_ci    Change the fourth paragraph of section 4.2 "Scoping", as follows:
16285bd8deadSopenharmony_ci
16295bd8deadSopenharmony_ci    Shared globals are global variables declared with the same name in
16305bd8deadSopenharmony_ci    independently compiled units (shaders) of the same language (vertex,
16315bd8deadSopenharmony_ci    geometry or fragment) that are linked together .
16325bd8deadSopenharmony_ci
16335bd8deadSopenharmony_ci    Change section 4.3 "Type Qualifiers"
16345bd8deadSopenharmony_ci
16355bd8deadSopenharmony_ci    Change the "varying", "in" and "out" qualifiers as follows:
16365bd8deadSopenharmony_ci
16375bd8deadSopenharmony_ci    varying - linkage between a vertex shader and geometry shader, or between
16385bd8deadSopenharmony_ci    a geometry shader and a fragment shader, or between a vertex shader and a
16395bd8deadSopenharmony_ci    fragment shader.
16405bd8deadSopenharmony_ci
16415bd8deadSopenharmony_ci    in - for function parameters passed into a function or for input varying
16425bd8deadSopenharmony_ci    variables (geometry only)
16435bd8deadSopenharmony_ci
16445bd8deadSopenharmony_ci    out - for function parameters passed back out of a function, but not
16455bd8deadSopenharmony_ci    initialized for use when passed in. Also for output varying variables
16465bd8deadSopenharmony_ci    (geometry only).
16475bd8deadSopenharmony_ci
16485bd8deadSopenharmony_ci    Change section 4.3.6 "Varying" as follows:
16495bd8deadSopenharmony_ci
16505bd8deadSopenharmony_ci    Varying variables provide the interface between the vertex shader and
16515bd8deadSopenharmony_ci    geometry shader and also between the geometry shader and fragment shader
16525bd8deadSopenharmony_ci    and the fixed functionality between them. If no geometry shader is
16535bd8deadSopenharmony_ci    present, varying variables also provide the interface between the vertex
16545bd8deadSopenharmony_ci    shader and fragment shader.
16555bd8deadSopenharmony_ci
16565bd8deadSopenharmony_ci    The vertex, or geometry shader will compute values per vertex (such
16575bd8deadSopenharmony_ci    as color, texture coordinates, etc) and write them to output variables
16585bd8deadSopenharmony_ci    declared with the "varying" qualifier (vertex or geometry) or "varying
16595bd8deadSopenharmony_ci    out" qualifiers (geometry only). A vertex or geometry shader may also
16605bd8deadSopenharmony_ci    read these output varying variables, getting back the same values it has
16615bd8deadSopenharmony_ci    written. Reading an output varying variable in a vertex or geometry shader
16625bd8deadSopenharmony_ci    returns undefined results if it is read before being written.
16635bd8deadSopenharmony_ci
16645bd8deadSopenharmony_ci    A geometry shader may also read from an input varying variable declared
16655bd8deadSopenharmony_ci    with the "varying in" qualifiers. The value read will be the same value as
16665bd8deadSopenharmony_ci    written by the vertex shader for that varying variable. Since a geometry
16675bd8deadSopenharmony_ci    shader operates on primitives, each input varying variable needs to be
16685bd8deadSopenharmony_ci    declared as an array. Each element of such an array corresponds to a
16695bd8deadSopenharmony_ci    vertex of the primitive being processed. If the varying variable is
16705bd8deadSopenharmony_ci    declared as a scalar or matrix in the vertex shader, it will be a
16715bd8deadSopenharmony_ci    one-dimensional array in the geometry shader. Each array can optionally
16725bd8deadSopenharmony_ci    have a size declared. If a size is not specified, it inferred by the
16735bd8deadSopenharmony_ci    linker and depends on the value of the input primitive type. See table
16745bd8deadSopenharmony_ci    4.3.xxx to determine the exact size. The read-only built-in constant
16755bd8deadSopenharmony_ci    gl_VerticesIn will be set to this value by the linker.  If a size is
16765bd8deadSopenharmony_ci    specified, it has to be the size as given by table 4.3.xxx, otherwise a
16775bd8deadSopenharmony_ci    link error will occur. The built-in constant gl_VerticesIn, if so desired,
16785bd8deadSopenharmony_ci    can be used to size the array correctly for each input primitive
16795bd8deadSopenharmony_ci    type. Varying variables can also be declared as arrays in the vertex
16805bd8deadSopenharmony_ci    shader. This means that those, on input to the geometry shader, must be
16815bd8deadSopenharmony_ci    declared as two- dimensional arrays. The first index to the
16825bd8deadSopenharmony_ci    two-dimensional array holds the vertex number. Declaring a size for the
16835bd8deadSopenharmony_ci    first range of the array is optional, just as it is for one-dimensional
16845bd8deadSopenharmony_ci    arrays.  The second index holds the per-vertex array data. Declaring a
16855bd8deadSopenharmony_ci    size for the second range of the array is not optional, and has to match
16865bd8deadSopenharmony_ci    the declaration in the vertex shader.
16875bd8deadSopenharmony_ci
16885bd8deadSopenharmony_ci                                 Value of built-in
16895bd8deadSopenharmony_ci        Input primitive type     gl_VerticesIn
16905bd8deadSopenharmony_ci        -----------------------  -----------------
16915bd8deadSopenharmony_ci        POINTS                          1
16925bd8deadSopenharmony_ci        LINES                           2
16935bd8deadSopenharmony_ci        LINES_ADJACENCY_ARB             4
16945bd8deadSopenharmony_ci        TRIANGLES                       3
16955bd8deadSopenharmony_ci        TRIANGLES_ADJACENCY_ARB         6
16965bd8deadSopenharmony_ci
16975bd8deadSopenharmony_ci    Table 4.3.xxxx The value of the built-in variable gl_VerticesIn is
16985bd8deadSopenharmony_ci    determined at link time, based on the input primitive type.
16995bd8deadSopenharmony_ci
17005bd8deadSopenharmony_ci    It is illegal to index these varying arrays, or in the case of two-
17015bd8deadSopenharmony_ci    dimensional arrays, the first range of the array, with a negative integral
17025bd8deadSopenharmony_ci    constant expression or an integral constant expression greater than or
17035bd8deadSopenharmony_ci    equal to gl_VerticesIn. A link error will occur in these cases.
17045bd8deadSopenharmony_ci
17055bd8deadSopenharmony_ci    Varying variables that are part of the interface to the fragment shader
17065bd8deadSopenharmony_ci    are set per vertex and interpolated in a perspective correct manner,
17075bd8deadSopenharmony_ci    unless flat shaded, over the primitive being rendered. If single-sampling,
17085bd8deadSopenharmony_ci    the interpolated value is for the fragment center.  If multi-sampling, the
17095bd8deadSopenharmony_ci    interpolated value can be anywhere within the pixel, including the
17105bd8deadSopenharmony_ci    fragment center or one of the fragment samples.
17115bd8deadSopenharmony_ci
17125bd8deadSopenharmony_ci    A fragment shader may read from varying variables and the value read will
17135bd8deadSopenharmony_ci    be the interpolated value, as a function of the fragment's position within
17145bd8deadSopenharmony_ci    the primitive, unless the varying variable is flat shaded. A fragment
17155bd8deadSopenharmony_ci    shader cannot write to a varying variable.
17165bd8deadSopenharmony_ci
17175bd8deadSopenharmony_ci    If a geometry shader is present, the type of the varying variables with
17185bd8deadSopenharmony_ci    the same name declared in the vertex shader and the input varying
17195bd8deadSopenharmony_ci    variables in the geometry shader must match, otherwise the link command
17205bd8deadSopenharmony_ci    will fail. Likewise, the type of the output varying variables with the
17215bd8deadSopenharmony_ci    same name declared in the geometry shader and the varying variables in the
17225bd8deadSopenharmony_ci    fragment shader must match.
17235bd8deadSopenharmony_ci
17245bd8deadSopenharmony_ci    If a geometry shader is not present, the type of the varying variables
17255bd8deadSopenharmony_ci    with the same name declared in both the vertex and fragment shaders must
17265bd8deadSopenharmony_ci    match, otherwise the link command will fail.
17275bd8deadSopenharmony_ci
17285bd8deadSopenharmony_ci    Only those varying variables used (i.e. read) in the geometry or fragment
17295bd8deadSopenharmony_ci    shader must be written to by the vertex or geometry shader; declaring
17305bd8deadSopenharmony_ci    superfluous varying variables in the vertex shader or declaring
17315bd8deadSopenharmony_ci    superfluous output varying variables in the geometry shader is
17325bd8deadSopenharmony_ci    permissible.
17335bd8deadSopenharmony_ci
17345bd8deadSopenharmony_ci    Varying variables are declared as in the following example:
17355bd8deadSopenharmony_ci
17365bd8deadSopenharmony_ci      varying in float foo[];    // geometry shader input. Size of the
17375bd8deadSopenharmony_ci                                 // array set as a result of link, based
17385bd8deadSopenharmony_ci                                 // on the input primitive type.
17395bd8deadSopenharmony_ci
17405bd8deadSopenharmony_ci      varying in float foo[gl_VerticesIn]; // geometry shader input
17415bd8deadSopenharmony_ci  
17425bd8deadSopenharmony_ci      varying in float foo[3];   // geometry shader input. Only legal for
17435bd8deadSopenharmony_ci                                 // the TRIANGLES input primitive type
17445bd8deadSopenharmony_ci
17455bd8deadSopenharmony_ci      varying in float foo[][5]; // Size of the first range set as a
17465bd8deadSopenharmony_ci                                 // result of link. Each vertex holds an
17475bd8deadSopenharmony_ci                                 // array of 5 floats.
17485bd8deadSopenharmony_ci
17495bd8deadSopenharmony_ci      varying out vec4 bar;      // geometry output
17505bd8deadSopenharmony_ci      varying vec3 normal;       // vertex shader output or fragment
17515bd8deadSopenharmony_ci                                 // shader input
17525bd8deadSopenharmony_ci
17535bd8deadSopenharmony_ci    The varying qualifier can be used only with the data types float, vec2,
17545bd8deadSopenharmony_ci    vec3, vec4, mat2, mat3 and mat4 or arrays of these.  Structures cannot be
17555bd8deadSopenharmony_ci    varying. Additionally, the "varying in" and "varying out" qualifiers can
17565bd8deadSopenharmony_ci    only be used in a geometry shader.
17575bd8deadSopenharmony_ci
17585bd8deadSopenharmony_ci    If no vertex shader is active, the fixed functionality pipeline of OpenGL
17595bd8deadSopenharmony_ci    will compute values for the built-in varying variables that will be
17605bd8deadSopenharmony_ci    consumed by the fragment shader. Similarly, if no fragment shader is
17615bd8deadSopenharmony_ci    active, the vertex shader or geometry shader is responsible for computing
17625bd8deadSopenharmony_ci    and writing to the built-in varying variables that are needed for OpenGL's
17635bd8deadSopenharmony_ci    fixed functionality fragment pipeline.
17645bd8deadSopenharmony_ci
17655bd8deadSopenharmony_ci    Varying variables are required to have global scope, and must be declared
17665bd8deadSopenharmony_ci    outside of function bodies, before their first use.
17675bd8deadSopenharmony_ci
17685bd8deadSopenharmony_ci    Change section 7.1 "Vertex Shader Special Variables"
17695bd8deadSopenharmony_ci
17705bd8deadSopenharmony_ci    Rename this section to "Vertex and Geometry Shader Special Variables"
17715bd8deadSopenharmony_ci
17725bd8deadSopenharmony_ci    Anywhere in this section where it reads "vertex language" replace it with
17735bd8deadSopenharmony_ci    "vertex and geometry language".
17745bd8deadSopenharmony_ci
17755bd8deadSopenharmony_ci    Anywhere in this section where it reads "vertex shader" replace it with
17765bd8deadSopenharmony_ci    "vertex shader or geometry shader".
17775bd8deadSopenharmony_ci
17785bd8deadSopenharmony_ci    Change the second paragraph to:
17795bd8deadSopenharmony_ci
17805bd8deadSopenharmony_ci    The variable gl_Position is available only in the vertex and geometry
17815bd8deadSopenharmony_ci    language and is intended for writing the homogeneous vertex position. It
17825bd8deadSopenharmony_ci    can be written at any time during shader execution. It may also be read
17835bd8deadSopenharmony_ci    back by the shader after being written. This value will be used by
17845bd8deadSopenharmony_ci    primitive assembly, clipping, culling, and other fixed functionality
17855bd8deadSopenharmony_ci    operations that operate on primitives after vertex or geometry processing
17865bd8deadSopenharmony_ci    has occurred.  Compilers may generate a diagnostic message if they detect
17875bd8deadSopenharmony_ci    gl_Position is read before being written, but not all such cases are
17885bd8deadSopenharmony_ci    detectable. Writing to gl_Position is optional. If gl_Position is not
17895bd8deadSopenharmony_ci    written but subsequent stages of the OpenGL pipeline consume gl_Position,
17905bd8deadSopenharmony_ci    then results are undefined.
17915bd8deadSopenharmony_ci
17925bd8deadSopenharmony_ci    Change the last sentence of this section into the following:
17935bd8deadSopenharmony_ci
17945bd8deadSopenharmony_ci    The read-only built-in gl_PrimitiveIDIn is available only in the geometry
17955bd8deadSopenharmony_ci    language and is filled with the number of primitives processed by the
17965bd8deadSopenharmony_ci    geometry shader since the last time Begin was called (directly or
17975bd8deadSopenharmony_ci    indirectly via vertex array functions). See section 2.16.4 for more
17985bd8deadSopenharmony_ci    information.
17995bd8deadSopenharmony_ci
18005bd8deadSopenharmony_ci    This variable is intrinsically declared as:
18015bd8deadSopenharmony_ci
18025bd8deadSopenharmony_ci        int gl_PrimitiveIDIn; // read only
18035bd8deadSopenharmony_ci
18045bd8deadSopenharmony_ci    The built-in output variable gl_PrimitiveID is available only in the
18055bd8deadSopenharmony_ci    geometry language and provides a single integer that serves as a primitive
18065bd8deadSopenharmony_ci    identifier.  This written primitive ID is available to fragment shaders.
18075bd8deadSopenharmony_ci    If a fragment shader using primitive IDs is active and a geometry shader
18085bd8deadSopenharmony_ci    is also active, the geometry shader must write to gl_PrimitiveID or the
18095bd8deadSopenharmony_ci    primitive ID in the fragment shader number is undefined.
18105bd8deadSopenharmony_ci
18115bd8deadSopenharmony_ci    The built-in output variable gl_Layer is available only in the geometry
18125bd8deadSopenharmony_ci    language, and provides the number of the layer of textures attached to a
18135bd8deadSopenharmony_ci    FBO to direct rendering to. If a shader statically assigns a value to
18145bd8deadSopenharmony_ci    gl_Layer, layered rendering mode is enabled. See section 2.16.4 for a
18155bd8deadSopenharmony_ci    detailed explanation. If a shader statically assigns a value to gl_Layer,
18165bd8deadSopenharmony_ci    and there is an execution path through the shader that does not set
18175bd8deadSopenharmony_ci    gl_Layer, then the value of gl_Layer may be undefined for executions of
18185bd8deadSopenharmony_ci    the shader that take that path.
18195bd8deadSopenharmony_ci
18205bd8deadSopenharmony_ci    These variables area intrinsically declared as:
18215bd8deadSopenharmony_ci
18225bd8deadSopenharmony_ci        int gl_PrimitiveID;
18235bd8deadSopenharmony_ci        int gl_Layer;
18245bd8deadSopenharmony_ci
18255bd8deadSopenharmony_ci    These variables can be read back by the shader after writing to them, to
18265bd8deadSopenharmony_ci    retrieve what was written. Reading the variable before writing it results
18275bd8deadSopenharmony_ci    in undefined behavior. If it is written more than once, the last value
18285bd8deadSopenharmony_ci    written is consumed by the subsequent operations.
18295bd8deadSopenharmony_ci
18305bd8deadSopenharmony_ci    All built-in variables discussed in this section have global scope.
18315bd8deadSopenharmony_ci
18325bd8deadSopenharmony_ci    Change section 7.2 "Fragment Shader Special Variables"
18335bd8deadSopenharmony_ci
18345bd8deadSopenharmony_ci    Change the first paragraph on p. 44 as follows:
18355bd8deadSopenharmony_ci
18365bd8deadSopenharmony_ci    The fragment shader has access to the read-only built-in variable
18375bd8deadSopenharmony_ci    gl_FrontFacing whose value is true if the fragment belongs to a
18385bd8deadSopenharmony_ci    front-facing primitive. One use of this is to emulate two-sided lighting
18395bd8deadSopenharmony_ci    by selecting one of two colors calculated by the vertex shader or geometry
18405bd8deadSopenharmony_ci    shader.
18415bd8deadSopenharmony_ci
18425bd8deadSopenharmony_ci    Change the first sentence of section 7.4 "Built-in Constants"
18435bd8deadSopenharmony_ci
18445bd8deadSopenharmony_ci    The following built-in constant is provided to geometry shaders.
18455bd8deadSopenharmony_ci
18465bd8deadSopenharmony_ci      const int gl_VerticesIn; // Value set at link time
18475bd8deadSopenharmony_ci
18485bd8deadSopenharmony_ci    The following built-in constants are provided to the vertex, geometry and
18495bd8deadSopenharmony_ci    fragment shaders:
18505bd8deadSopenharmony_ci
18515bd8deadSopenharmony_ci    Change section 7.6 "Varing Variables"
18525bd8deadSopenharmony_ci
18535bd8deadSopenharmony_ci    Unlike user-defined varying variables, the built-in varying variables
18545bd8deadSopenharmony_ci    don't have a strict one-to-one correspondence between the vertex language,
18555bd8deadSopenharmony_ci    geometry language and the fragment language. Four sets are provided, one
18565bd8deadSopenharmony_ci    set for the vertex language output, one set for the geometry language
18575bd8deadSopenharmony_ci    output, one set for the fragment language input and another set for the
18585bd8deadSopenharmony_ci    geometry language input. Their relationship is described below.
18595bd8deadSopenharmony_ci
18605bd8deadSopenharmony_ci    The following built-in varying variables are available to write to in a
18615bd8deadSopenharmony_ci    vertex shader or geometry shader. A particular one should be written to if
18625bd8deadSopenharmony_ci    any functionality in a corresponding geometry shader or fragment shader or
18635bd8deadSopenharmony_ci    fixed pipeline uses it or state derived from it. Otherwise, behavior is
18645bd8deadSopenharmony_ci    undefined.
18655bd8deadSopenharmony_ci
18665bd8deadSopenharmony_ci    Vertex language built-in outputs:
18675bd8deadSopenharmony_ci
18685bd8deadSopenharmony_ci      varying vec4 gl_FrontColor;
18695bd8deadSopenharmony_ci      varying vec4 gl_BackColor;
18705bd8deadSopenharmony_ci      varying vec4 gl_FrontSecondaryColor;
18715bd8deadSopenharmony_ci      varying vec4 gl_BackSecondaryColor;
18725bd8deadSopenharmony_ci      varying vec4 gl_TexCoord[]; // at most will be gl_MaxTextureCoords
18735bd8deadSopenharmony_ci      varying float gl_FogFragCoord;
18745bd8deadSopenharmony_ci
18755bd8deadSopenharmony_ci    Geometry language built-in outputs:
18765bd8deadSopenharmony_ci
18775bd8deadSopenharmony_ci      varying out vec4 gl_FrontColor;
18785bd8deadSopenharmony_ci      varying out vec4 gl_BackColor;
18795bd8deadSopenharmony_ci      varying out vec4 gl_FrontSecondaryColor;
18805bd8deadSopenharmony_ci      varying out vec4 gl_BackSecondaryColor;
18815bd8deadSopenharmony_ci      varying out vec4 gl_TexCoord[]; // at most gl_MaxTextureCoords
18825bd8deadSopenharmony_ci      varying out float gl_FogFragCoord;
18835bd8deadSopenharmony_ci
18845bd8deadSopenharmony_ci    For gl_FogFragCoord, the value written will be used as the "c" value on
18855bd8deadSopenharmony_ci    page 160 of the OpenGL 1.4 Specification by the fixed functionality
18865bd8deadSopenharmony_ci    pipeline. For example, if the z-coordinate of the fragment in eye space is
18875bd8deadSopenharmony_ci    desired as "c", then that's what the vertex or geometry shader should
18885bd8deadSopenharmony_ci    write into gl_FogFragCoord.
18895bd8deadSopenharmony_ci
18905bd8deadSopenharmony_ci    Indices used to subscript gl_TexCoord must either be an integral constant
18915bd8deadSopenharmony_ci    expressions, or this array must be re-declared by the shader with a
18925bd8deadSopenharmony_ci    size. The size can be at most gl_MaxTextureCoords.  Using indexes close to
18935bd8deadSopenharmony_ci    0 may aid the implementation in preserving varying resources.
18945bd8deadSopenharmony_ci
18955bd8deadSopenharmony_ci    The following input varying variables are available to read from in a
18965bd8deadSopenharmony_ci    geometry shader.
18975bd8deadSopenharmony_ci
18985bd8deadSopenharmony_ci      varying in vec4 gl_FrontColorIn[gl_VerticesIn];
18995bd8deadSopenharmony_ci      varying in vec4 gl_BackColorIn[gl_VerticesIn];
19005bd8deadSopenharmony_ci      varying in vec4 gl_FrontSecondaryColorIn[gl_VerticesIn];
19015bd8deadSopenharmony_ci      varying in vec4 gl_BackSecondaryColorIn[gl_VerticesIn];
19025bd8deadSopenharmony_ci      varying in vec4 gl_TexCoordIn[gl_VerticesIn][]; // at most will be 
19035bd8deadSopenharmony_ci                                                      // gl_MaxTextureCoords
19045bd8deadSopenharmony_ci      varying in float gl_FogFragCoordIn[gl_VerticesIn];
19055bd8deadSopenharmony_ci      varying in vec4 gl_PositionIn[gl_VerticesIn];
19065bd8deadSopenharmony_ci      varying in float gl_PointSizeIn[gl_VerticesIn];
19075bd8deadSopenharmony_ci      varying in vec4 gl_ClipVertexIn[gl_VerticesIn];
19085bd8deadSopenharmony_ci
19095bd8deadSopenharmony_ci    All built-in variables are one-dimensional arrays, except for
19105bd8deadSopenharmony_ci    gl_TexCoordIn, which is a two-dimensional array. Each element of a
19115bd8deadSopenharmony_ci    one-dimensional array, or the first index of a two-dimensional array,
19125bd8deadSopenharmony_ci    corresponds to a vertex of the primitive being processed and receives
19135bd8deadSopenharmony_ci    their value from the equivalent vertex output varying variables. See also
19145bd8deadSopenharmony_ci    section 4.3.6.
19155bd8deadSopenharmony_ci
19165bd8deadSopenharmony_ci    The following varying variables are available to read from in a fragment
19175bd8deadSopenharmony_ci    shader. The gl_Color and gl_SecondaryColor names are the same names as
19185bd8deadSopenharmony_ci    attributes passed to the vertex shader. However, there is no name
19195bd8deadSopenharmony_ci    conflict, because attributes are visible only in vertex shaders and the
19205bd8deadSopenharmony_ci    following are only visible in a fragment shader.
19215bd8deadSopenharmony_ci
19225bd8deadSopenharmony_ci      varying vec4 gl_Color;
19235bd8deadSopenharmony_ci      varying vec4 gl_SecondaryColor;
19245bd8deadSopenharmony_ci      varying vec4 gl_TexCoord[]; // at most will be gl_MaxTextureCoords
19255bd8deadSopenharmony_ci      varying float gl_FogFragCoord;
19265bd8deadSopenharmony_ci
19275bd8deadSopenharmony_ci    The values in gl_Color and gl_SecondaryColor will be derived automatically
19285bd8deadSopenharmony_ci    by the system from gl_FrontColor, gl_BackColor, gl_FrontSecondaryColor,
19295bd8deadSopenharmony_ci    and gl_BackSecondaryColor. This selection process is described in section
19305bd8deadSopenharmony_ci    2.14.1 of the OpenGL 2.0 Specification. If fixed functionality is used for
19315bd8deadSopenharmony_ci    vertex processing, then gl_FogFragCoord will either be the z-coordinate of
19325bd8deadSopenharmony_ci    the fragment in eye space, or the interpolation of the fog coordinate, as
19335bd8deadSopenharmony_ci    described in section 3.10 of the OpenGL 1.4 Specification. The
19345bd8deadSopenharmony_ci    gl_TexCoord[] values are the interpolated gl_TexCoord[] values from a
19355bd8deadSopenharmony_ci    vertex or geometry shader or the texture coordinates of any fixed pipeline
19365bd8deadSopenharmony_ci    based vertex functionality.
19375bd8deadSopenharmony_ci
19385bd8deadSopenharmony_ci    Indices to the fragment shader gl_TexCoord array are as described above in
19395bd8deadSopenharmony_ci    the vertex and geometry shader text.
19405bd8deadSopenharmony_ci
19415bd8deadSopenharmony_ci    Change section 8.7 "Texture Lookup Functions"
19425bd8deadSopenharmony_ci
19435bd8deadSopenharmony_ci    Change the first paragraph to:
19445bd8deadSopenharmony_ci
19455bd8deadSopenharmony_ci    Texture lookup functions are available to vertex, geometry and fragment
19465bd8deadSopenharmony_ci    shaders. However, level of detail is not computed by fixed functionality
19475bd8deadSopenharmony_ci    for vertex or geometry shaders, so there are some differences in operation
19485bd8deadSopenharmony_ci    between texture lookups. The functions.
19495bd8deadSopenharmony_ci
19505bd8deadSopenharmony_ci    Change the third and fourth paragraphs to:
19515bd8deadSopenharmony_ci
19525bd8deadSopenharmony_ci    In all functions below, the bias parameter is optional for fragment
19535bd8deadSopenharmony_ci    shaders. The bias parameter is not accepted in a vertex or geometry
19545bd8deadSopenharmony_ci    shader. For a fragment shader, if bias is present, it is added to the
19555bd8deadSopenharmony_ci    calculated level of detail prior to performing the texture access
19565bd8deadSopenharmony_ci    operation. If the bias parameter is not provided, then the implementation
19575bd8deadSopenharmony_ci    automatically selects level of detail: For a texture that is not
19585bd8deadSopenharmony_ci    mip-mapped, the texture is used directly. If it is mip- mapped and running
19595bd8deadSopenharmony_ci    in a fragment shader, the LOD computed by the implementation is used to do
19605bd8deadSopenharmony_ci    the texture lookup. If it is mip- mapped and running on the vertex or
19615bd8deadSopenharmony_ci    geometry shader, then the base LOD of the texture is used.
19625bd8deadSopenharmony_ci
19635bd8deadSopenharmony_ci    The built-ins suffixed with "Lod" are allowed only in a vertex or geometry
19645bd8deadSopenharmony_ci    shader. For the "Lod" functions, lod is directly used as the level of
19655bd8deadSopenharmony_ci    detail.
19665bd8deadSopenharmony_ci
19675bd8deadSopenharmony_ci    Change section 8.9 Noise Functions
19685bd8deadSopenharmony_ci
19695bd8deadSopenharmony_ci    Change the first paragraph to:
19705bd8deadSopenharmony_ci
19715bd8deadSopenharmony_ci    Noise functions are available to the vertex, geometry and fragment
19725bd8deadSopenharmony_ci    shaders.  They are...
19735bd8deadSopenharmony_ci
19745bd8deadSopenharmony_ci    Add a section 8.10 Geometry Shader Functions
19755bd8deadSopenharmony_ci
19765bd8deadSopenharmony_ci    This section contains functions that are geometry language specific.
19775bd8deadSopenharmony_ci
19785bd8deadSopenharmony_ci    Syntax:
19795bd8deadSopenharmony_ci
19805bd8deadSopenharmony_ci        void EmitVertex();   // Geometry only
19815bd8deadSopenharmony_ci        void EndPrimitive(); // Geometry only
19825bd8deadSopenharmony_ci
19835bd8deadSopenharmony_ci    Description:
19845bd8deadSopenharmony_ci
19855bd8deadSopenharmony_ci    The function EmitVertex() specifies that a vertex is completed. A vertex
19865bd8deadSopenharmony_ci    is added to the current output primitive using the current values of the
19875bd8deadSopenharmony_ci    varying output variables and the current values of the special built-in
19885bd8deadSopenharmony_ci    output variables gl_PointSize, gl_ClipVertex, gl_Layer, gl_Position and
19895bd8deadSopenharmony_ci    gl_PrimitiveID.  The values of any unwritten output variables are
19905bd8deadSopenharmony_ci    undefined. The values of all varying output variables and the special
19915bd8deadSopenharmony_ci    built-in output variables are undefined after a call to EmitVertex(). If a
19925bd8deadSopenharmony_ci    geometry shader, in one invocation, emits more vertices than the value
19935bd8deadSopenharmony_ci    GEOMETRY_VERTICES_OUT_ARB, these emits may have no effect.
19945bd8deadSopenharmony_ci
19955bd8deadSopenharmony_ci    The function EndPrimitive() specifies that the current output primitive is
19965bd8deadSopenharmony_ci    completed and a new output primitive (of the same type) should be
19975bd8deadSopenharmony_ci    started. This function does not emit a vertex. The effect of
19985bd8deadSopenharmony_ci    EndPrimitive() is roughly equivalent to calling End followed by a new
19995bd8deadSopenharmony_ci    Begin, where the primitive mode is taken from the program object parameter
20005bd8deadSopenharmony_ci    GEOMETRY_OUTPUT_TYPE_ARB. If the output primitive type is POINTS, calling
20015bd8deadSopenharmony_ci    EndPrimitive() is optional.
20025bd8deadSopenharmony_ci
20035bd8deadSopenharmony_ci    A geometry shader starts with an output primitive containing no
20045bd8deadSopenharmony_ci    vertices. When a geometry shader terminates, the current output primitive
20055bd8deadSopenharmony_ci    is automatically completed. It is not necessary to call EndPrimitive() if
20065bd8deadSopenharmony_ci    the geometry shader writes only a single primitive.
20075bd8deadSopenharmony_ci
20085bd8deadSopenharmony_ci    Add/Change section 9 (Shading language grammar):
20095bd8deadSopenharmony_ci
20105bd8deadSopenharmony_ci      init_declarator_list:
20115bd8deadSopenharmony_ci        single_declaration
20125bd8deadSopenharmony_ci        init_declarator_list COMMA IDENTIFIER
20135bd8deadSopenharmony_ci        init_declarator_list COMMA IDENTIFIER array_declarator_suffix
20145bd8deadSopenharmony_ci        init_declarator_list COMMA IDENTIFIER EQUAL initializer
20155bd8deadSopenharmony_ci  
20165bd8deadSopenharmony_ci      single_declaration:
20175bd8deadSopenharmony_ci        fully_specified_type
20185bd8deadSopenharmony_ci        fully_specified_type IDENTIFIER
20195bd8deadSopenharmony_ci        fully_specified_type IDENTIFIER array_declarator_suffix
20205bd8deadSopenharmony_ci        fully_specified_type IDENTIFIER EQUAL initializer
20215bd8deadSopenharmony_ci  
20225bd8deadSopenharmony_ci      array_declarator_suffix:
20235bd8deadSopenharmony_ci        LEFT_BRACKET RIGHT_BRACKET
20245bd8deadSopenharmony_ci        LEFT_BRACKET constant_expression RIGHT_BRACKET
20255bd8deadSopenharmony_ci        LEFT_BRACKET RIGHT_BRACKET array_declarator_suffix
20265bd8deadSopenharmony_ci        LEFT_BRACKET constant_expression RIGHT_BRACKET
20275bd8deadSopenharmony_ci      array_declarator_suffix
20285bd8deadSopenharmony_ci  
20295bd8deadSopenharmony_ci      type_qualifier:
20305bd8deadSopenharmony_ci        CONST
20315bd8deadSopenharmony_ci        ATTRIBUTE     // Vertex only
20325bd8deadSopenharmony_ci        VARYING
20335bd8deadSopenharmony_ci        VARYING IN    // Geometry only
20345bd8deadSopenharmony_ci        VARYING OUT   // Geometry only
20355bd8deadSopenharmony_ci        UNIFORM
20365bd8deadSopenharmony_ci
20375bd8deadSopenharmony_ciNVIDIA Implementation Details
20385bd8deadSopenharmony_ci
20395bd8deadSopenharmony_ci    Because of a hardware limitation, some GeForce 8 series chips use the
20405bd8deadSopenharmony_ci    odd vertex of an incomplete TRIANGLE_STRIP_ADJACENCY_ARB primitive
20415bd8deadSopenharmony_ci    as a replacement adjacency vertex rather than ignoring it.
20425bd8deadSopenharmony_ci
20435bd8deadSopenharmony_ciIssues
20445bd8deadSopenharmony_ci
20455bd8deadSopenharmony_ci   1. How do geometry shaders fit into the existing GL pipeline?
20465bd8deadSopenharmony_ci
20475bd8deadSopenharmony_ci      RESOLVED:  The following diagram illustrates how geometry shaders fit
20485bd8deadSopenharmony_ci      into the "vertex processing" portion of the GL (Chapter 2 of the OpenGL
20495bd8deadSopenharmony_ci      2.0 Specification).
20505bd8deadSopenharmony_ci
20515bd8deadSopenharmony_ci      First, vertex attributes are specified via immediate-mode commands or
20525bd8deadSopenharmony_ci      through vertex arrays.  They can be conventional attributes (e.g.,
20535bd8deadSopenharmony_ci      glVertex, glColor, glTexCoord) or generic (numbered) attributes.
20545bd8deadSopenharmony_ci
20555bd8deadSopenharmony_ci      Vertices are then transformed, either using a vertex shader or
20565bd8deadSopenharmony_ci      fixed-function vertex processing.  Fixed-function vertex processing
20575bd8deadSopenharmony_ci      includes position transformation (modelview and projection matrices),
20585bd8deadSopenharmony_ci      lighting, texture coordinate generation, and other calculations.  The
20595bd8deadSopenharmony_ci      results of either method are a "transformed vertex", which has a
20605bd8deadSopenharmony_ci      position (in clip coordinates), front and back colors, texture
20615bd8deadSopenharmony_ci      coordinates, generic attributes (vertex shader only), and so on.  Note
20625bd8deadSopenharmony_ci      that on many current GL implementations, vertex processing is performed
20635bd8deadSopenharmony_ci      by executing a "fixed function vertex shader" generated by the driver.
20645bd8deadSopenharmony_ci
20655bd8deadSopenharmony_ci      After vertex transformation, vertices are assembled into primitives,
20665bd8deadSopenharmony_ci      according to the topology (e.g., TRIANGLES, QUAD_STRIP) provided by the
20675bd8deadSopenharmony_ci      call to glBegin().  Primitives are points, lines, triangles, quads, or
20685bd8deadSopenharmony_ci      polygons.  Many GL implementations do not directly support quads or
20695bd8deadSopenharmony_ci      polygons, but instead decompose them into triangles as permitted by the
20705bd8deadSopenharmony_ci      spec.
20715bd8deadSopenharmony_ci
20725bd8deadSopenharmony_ci      After initial primitive assembly, a geometry shader is executed on each
20735bd8deadSopenharmony_ci      individual point, line, or triangle primitive, if one is active.  It can
20745bd8deadSopenharmony_ci      read the attributes of each transformed vertex, perform arbitrary
20755bd8deadSopenharmony_ci      computations, and emit new transformed vertices.  These emitted vertices
20765bd8deadSopenharmony_ci      are themselves assembled into primitives according to the output
20775bd8deadSopenharmony_ci      primitive type of the geometry shader.
20785bd8deadSopenharmony_ci
20795bd8deadSopenharmony_ci      Then, the colors of the vertices of each primitive are clamped to [0,1]
20805bd8deadSopenharmony_ci      (if color clamping is enabled), and flat shading may be performed by
20815bd8deadSopenharmony_ci      taking the color from the provoking vertex of the primitive.
20825bd8deadSopenharmony_ci
20835bd8deadSopenharmony_ci      Each primitive is clipped to the view volume, and to any enabled
20845bd8deadSopenharmony_ci      user-defined clip planes.  Color, texture coordinate, and other
20855bd8deadSopenharmony_ci      attribute values are computed for each new vertex introduced by
20865bd8deadSopenharmony_ci      clipping.
20875bd8deadSopenharmony_ci
20885bd8deadSopenharmony_ci      After clipping, the position of each vertex (in clip coordinates) is
20895bd8deadSopenharmony_ci      converted to normalized device coordinates in the perspective division
20905bd8deadSopenharmony_ci      (divide by w) step, and to window coordinates in the viewport
20915bd8deadSopenharmony_ci      transformation step.
20925bd8deadSopenharmony_ci
20935bd8deadSopenharmony_ci      At the same time, color values may be converted to normalized
20945bd8deadSopenharmony_ci      fixed-point values according to the "Final Color Processing" portion of
20955bd8deadSopenharmony_ci      the specification.
20965bd8deadSopenharmony_ci
20975bd8deadSopenharmony_ci      After the vertices of the primitive are transformed to window
20985bd8deadSopenharmony_ci      coordinate, the GL determines if the primitive is front- or back-facing.
20995bd8deadSopenharmony_ci      That information is used for two-sided color selection, where a single
21005bd8deadSopenharmony_ci      set of colors is selected from either the front or back colors
21015bd8deadSopenharmony_ci      associated with each transformed vertex.
21025bd8deadSopenharmony_ci
21035bd8deadSopenharmony_ci      When all this is done, the final transformed position, colors (primary
21045bd8deadSopenharmony_ci      and secondary), and other attributes are used for rasterization (Chapter
21055bd8deadSopenharmony_ci      3 in the OpenGL 2.0 Specification).
21065bd8deadSopenharmony_ci
21075bd8deadSopenharmony_ci      When the raster position is specified (via glRasterPos), it goes through
21085bd8deadSopenharmony_ci      the entire vertex processing pipeline as though it were a point.
21095bd8deadSopenharmony_ci      However, geometry shaders are never run on the raster position.
21105bd8deadSopenharmony_ci
21115bd8deadSopenharmony_ci
21125bd8deadSopenharmony_ci                        |generic              |conventional
21135bd8deadSopenharmony_ci                        |vertex               |vertex
21145bd8deadSopenharmony_ci                        |attributes           |attributes
21155bd8deadSopenharmony_ci                        |                     |
21165bd8deadSopenharmony_ci                        | +-------------------+
21175bd8deadSopenharmony_ci                        | |                   |
21185bd8deadSopenharmony_ci                        V V                   V
21195bd8deadSopenharmony_ci                      vertex            fixed-function
21205bd8deadSopenharmony_ci                      shader              vertex
21215bd8deadSopenharmony_ci                         |               processing
21225bd8deadSopenharmony_ci                         |                    |
21235bd8deadSopenharmony_ci                         |                    |
21245bd8deadSopenharmony_ci                         +<-------------------+                
21255bd8deadSopenharmony_ci                         |                                     Output
21265bd8deadSopenharmony_ci                         |position, color,                   Primitive
21275bd8deadSopenharmony_ci                         |other vertex data                     Type
21285bd8deadSopenharmony_ci                         |                                       |
21295bd8deadSopenharmony_ci                         V                                       |
21305bd8deadSopenharmony_ci        Begin/       primitive        geometry       primitive   |
21315bd8deadSopenharmony_ci         End ------> assembly  -----> shader   ----> assembly  <-+
21325bd8deadSopenharmony_ci        State            |                               |
21335bd8deadSopenharmony_ci                         V                               |
21345bd8deadSopenharmony_ci                         +<------------------------------+
21355bd8deadSopenharmony_ci                         |
21365bd8deadSopenharmony_ci                         |
21375bd8deadSopenharmony_ci                         |             color            flat
21385bd8deadSopenharmony_ci                         +----------> clamping ---->  shading
21395bd8deadSopenharmony_ci                         |                               |
21405bd8deadSopenharmony_ci                         V                               |
21415bd8deadSopenharmony_ci                         +<------------------------------+
21425bd8deadSopenharmony_ci                         |
21435bd8deadSopenharmony_ci                         |
21445bd8deadSopenharmony_ci                      clipping
21455bd8deadSopenharmony_ci                         |
21465bd8deadSopenharmony_ci                         |        perspective       viewport
21475bd8deadSopenharmony_ci                         +------>   divide    ----> transform
21485bd8deadSopenharmony_ci                         |                              |
21495bd8deadSopenharmony_ci                         |                          +---+-----+
21505bd8deadSopenharmony_ci                         |                          V         |
21515bd8deadSopenharmony_ci                         |           final        facing      |
21525bd8deadSopenharmony_ci                         +------>    color     determination  |
21535bd8deadSopenharmony_ci                         |         processing       |         |
21545bd8deadSopenharmony_ci                         |             |            |         |
21555bd8deadSopenharmony_ci                         |             |            |         |
21565bd8deadSopenharmony_ci                         |             +-----+ +----+         |
21575bd8deadSopenharmony_ci                         |                   | |              |
21585bd8deadSopenharmony_ci                         |                   V V              |
21595bd8deadSopenharmony_ci                         |                two-sided           |
21605bd8deadSopenharmony_ci                         |                 coloring           |
21615bd8deadSopenharmony_ci                         |                    |               |
21625bd8deadSopenharmony_ci                         |                    |               |
21635bd8deadSopenharmony_ci                         +------------------+ | +-------------+
21645bd8deadSopenharmony_ci                                            | | |
21655bd8deadSopenharmony_ci                                            V V V
21665bd8deadSopenharmony_ci                                        rasterization 
21675bd8deadSopenharmony_ci                                              |
21685bd8deadSopenharmony_ci                                              |
21695bd8deadSopenharmony_ci                                              V
21705bd8deadSopenharmony_ci
21715bd8deadSopenharmony_ci   2. Why is this called GL_ARB_geometry_shader4?  There aren't any previous
21725bd8deadSopenharmony_ci      versions of this extension, let alone three?
21735bd8deadSopenharmony_ci
21745bd8deadSopenharmony_ci      RESOLVED:  To match its sibling, ARB_gpu_shader4 and the assembly
21755bd8deadSopenharmony_ci      version NV_gpu_program4. This is the fourth generation of shading
21765bd8deadSopenharmony_ci      functionality, hence the "4" in the name.
21775bd8deadSopenharmony_ci
21785bd8deadSopenharmony_ci   3. Should the GL produce errors at Begin time if an application specifies a
21795bd8deadSopenharmony_ci      primitive mode that is "incompatible" with the geometry shader?  For
21805bd8deadSopenharmony_ci      example, if the geometry shader operates on triangles and the
21815bd8deadSopenharmony_ci      application sends a POINTS primitive?
21825bd8deadSopenharmony_ci
21835bd8deadSopenharmony_ci      RESOLVED:  Yes.  Mismatches of app-specified primitive types and
21845bd8deadSopenharmony_ci      geometry shader input primitive types appear to be errors and would
21855bd8deadSopenharmony_ci      produce weird and wonderful effects.
21865bd8deadSopenharmony_ci
21875bd8deadSopenharmony_ci   4. Can the input primitive type of a geometry shader be determined at run
21885bd8deadSopenharmony_ci      time?
21895bd8deadSopenharmony_ci
21905bd8deadSopenharmony_ci      RESOLVED:  No. Each geometry shader has a single input primitive type,
21915bd8deadSopenharmony_ci      and vertices are presented to the shader in a specific order based on
21925bd8deadSopenharmony_ci      that type.
21935bd8deadSopenharmony_ci
21945bd8deadSopenharmony_ci   5. Can the input primitive type of a geometry shader be changed?
21955bd8deadSopenharmony_ci
21965bd8deadSopenharmony_ci      DISCUSSION: The input primitive type is a property of the program
21975bd8deadSopenharmony_ci      object. A change of the input primitive type means the program object
21985bd8deadSopenharmony_ci      will need to be re-linked. It would be nice if the input primitive type
21995bd8deadSopenharmony_ci      was known at compile time, so that the compiler can do error checking of
22005bd8deadSopenharmony_ci      the type and the number of vertices being accessed by the shader. Since
22015bd8deadSopenharmony_ci      we allow multiple compilation units to form one geometry shader, it is
22025bd8deadSopenharmony_ci      not clear how to achieve that.  Therefore, the input primitive type is a
22035bd8deadSopenharmony_ci      property of the program object, and not of a shader object.
22045bd8deadSopenharmony_ci
22055bd8deadSopenharmony_ci      RESOLVED: Yes, but each change means the program object will have to be
22065bd8deadSopenharmony_ci      re-linked.
22075bd8deadSopenharmony_ci
22085bd8deadSopenharmony_ci   6. Can the output primitive type of a geometry shader be determined
22095bd8deadSopenharmony_ci      at run time?
22105bd8deadSopenharmony_ci
22115bd8deadSopenharmony_ci      RESOLVED:  Not in this extension.
22125bd8deadSopenharmony_ci
22135bd8deadSopenharmony_ci   7. Can the output primitive type of a program object be changed?
22145bd8deadSopenharmony_ci
22155bd8deadSopenharmony_ci      RESOLVED: Yes, but the program object will have to be re-linked in order
22165bd8deadSopenharmony_ci      for the change to have effect on program execution.
22175bd8deadSopenharmony_ci
22185bd8deadSopenharmony_ci   8. Must the output primitive type of a geometry shader match the
22195bd8deadSopenharmony_ci      input primitive type in any way?
22205bd8deadSopenharmony_ci
22215bd8deadSopenharmony_ci      RESOLVED:  No, you can have a geometry shader generate points out of
22225bd8deadSopenharmony_ci      triangles or triangles out of points.  Some combinations are analogous
22235bd8deadSopenharmony_ci      to existing OpenGL operations:  reading triangles and writing points or
22245bd8deadSopenharmony_ci      line strips can be used to emulate a subset of PolygonMode
22255bd8deadSopenharmony_ci      functionality.  Reading points and writing triangle strips can be used
22265bd8deadSopenharmony_ci      to emulate point sprites.
22275bd8deadSopenharmony_ci
22285bd8deadSopenharmony_ci   9. Are primitives emitted by a geometry shader processed like any other
22295bd8deadSopenharmony_ci      OpenGL primitive?
22305bd8deadSopenharmony_ci
22315bd8deadSopenharmony_ci      RESOLVED:  Yes.  Antialiasing, stippling, polygon offset, polygon mode,
22325bd8deadSopenharmony_ci      culling, two-sided lighting and color selection, point sprite
22335bd8deadSopenharmony_ci      operations, and fragment processing all work as expected.
22345bd8deadSopenharmony_ci
22355bd8deadSopenharmony_ci      One limitation is that the only output primitive types supported are
22365bd8deadSopenharmony_ci      points, line strips, and triangle strips, none of which meaningfully
22375bd8deadSopenharmony_ci      support edge flags that are sometimes used in conjunction with the POINT
22385bd8deadSopenharmony_ci      and LINE polygon modes. Edge flags are always ignored for line-mode
22395bd8deadSopenharmony_ci      triangle strips.
22405bd8deadSopenharmony_ci
22415bd8deadSopenharmony_ci  10. Should geometry shaders support additional input primitive types?
22425bd8deadSopenharmony_ci 
22435bd8deadSopenharmony_ci      RESOLVED:  Possibly in a future extension.  It should be straightforward
22445bd8deadSopenharmony_ci      to build a future extension to support geometry shaders that operate on
22455bd8deadSopenharmony_ci      quads.  Other primitive types might be more demanding on hardware. Quads
22465bd8deadSopenharmony_ci      with adjacency would require 12 vertices per shader execution. General
22475bd8deadSopenharmony_ci      polygons may require even more, since there is no fixed bound on the
22485bd8deadSopenharmony_ci      number of vertices in a polygon.
22495bd8deadSopenharmony_ci
22505bd8deadSopenharmony_ci  11. Should geometry shaders support additional output primitive types?
22515bd8deadSopenharmony_ci
22525bd8deadSopenharmony_ci      RESOLVED:  Possibly in a future extension.  Additional output types
22535bd8deadSopenharmony_ci      (e.g., independent lines, line loops, triangle fans, polygons) may be
22545bd8deadSopenharmony_ci      useful in the future; triangle fans/polygons seem particularly useful.
22555bd8deadSopenharmony_ci
22565bd8deadSopenharmony_ci  12. How are adjacency primitives processed by the GL?
22575bd8deadSopenharmony_ci
22585bd8deadSopenharmony_ci      RESOLVED: The primitive type of an adjacent primitive is set as a Begin
22595bd8deadSopenharmony_ci      mode parameter. Any vertex of an adjacency primitive will be treated as
22605bd8deadSopenharmony_ci      a regular vertex, and processed by a vertex shader as well as the
22615bd8deadSopenharmony_ci      geometry shader. The geometry shader cannot output adjacency primitives,
22625bd8deadSopenharmony_ci      thus processing stops with the geometry shader. If a geometry shader is
22635bd8deadSopenharmony_ci      not active, the GL ignores the "adjacent" vertices in the adjacency
22645bd8deadSopenharmony_ci      primitive.
22655bd8deadSopenharmony_ci
22665bd8deadSopenharmony_ci  13. Should we provide additional adjacency primitive types that can be
22675bd8deadSopenharmony_ci      used inside a Begin/End?
22685bd8deadSopenharmony_ci
22695bd8deadSopenharmony_ci      RESOLVED:  Not in this extension.  It may be desirable to add new
22705bd8deadSopenharmony_ci      primitive types (e.g., TRIANGLE_FAN_ADJACENCY) in a future extension.
22715bd8deadSopenharmony_ci
22725bd8deadSopenharmony_ci  14. How do geometry shaders interact with RasterPos?
22735bd8deadSopenharmony_ci
22745bd8deadSopenharmony_ci      RESOLVED:  Geometry shaders are ignored when specifying the raster
22755bd8deadSopenharmony_ci      position.
22765bd8deadSopenharmony_ci
22775bd8deadSopenharmony_ci  15. How do geometry shaders interact with pixel primitives
22785bd8deadSopenharmony_ci      (DrawPixels, Bitmap)?
22795bd8deadSopenharmony_ci
22805bd8deadSopenharmony_ci      RESOLVED:  They do not.
22815bd8deadSopenharmony_ci
22825bd8deadSopenharmony_ci  16. Is there a limit on the number of vertices that can be emitted by
22835bd8deadSopenharmony_ci      a geometry shader?
22845bd8deadSopenharmony_ci
22855bd8deadSopenharmony_ci      RESOLVED:  Unfortunately, yes.  Besides practical hardware limits, there
22865bd8deadSopenharmony_ci      may also be practical performance advantages when applications guarantee
22875bd8deadSopenharmony_ci      a tight upper bound on the number of vertices a geometry shader will
22885bd8deadSopenharmony_ci      emit.  GPUs frequently excecute programs in parallel, and there are
22895bd8deadSopenharmony_ci      substantial implementation challenges to parallel execution of geometry
22905bd8deadSopenharmony_ci      threads that can write an unbounded number of results, particular given
22915bd8deadSopenharmony_ci      that all the primitives generated by the first geometry shader
22925bd8deadSopenharmony_ci      invocation must be consumed before any of the primitives generated by
22935bd8deadSopenharmony_ci      the second program invocation.  Limiting the amount of data a geometry
22945bd8deadSopenharmony_ci      shader can write substantially eases the implementation burden.
22955bd8deadSopenharmony_ci
22965bd8deadSopenharmony_ci      A program object, holding a geometry shader, must declare a maximum
22975bd8deadSopenharmony_ci      number of vertices that can be emitted. There is an
22985bd8deadSopenharmony_ci      implementation-dependent limit on the total number of vertices a program
22995bd8deadSopenharmony_ci      object can emit (256 minimum) and the product of the number of vertices
23005bd8deadSopenharmony_ci      emitted and the number of components of all active varying variables
23015bd8deadSopenharmony_ci      (1024 minimum).
23025bd8deadSopenharmony_ci
23035bd8deadSopenharmony_ci      It would be ideal if the limit could be inferred from the instructions
23045bd8deadSopenharmony_ci      in the shader itself, and that would be possible for many shaders,
23055bd8deadSopenharmony_ci      particularly ones with straight-line flow control.  For shaders with
23065bd8deadSopenharmony_ci      more complicated flow control (subroutines, data- dependent looping, and
23075bd8deadSopenharmony_ci      so on), it would be impossible to make such an inference and a "safe"
23085bd8deadSopenharmony_ci      limit would have to be used with adverse and possibly unexpected
23095bd8deadSopenharmony_ci      performance consequences.
23105bd8deadSopenharmony_ci
23115bd8deadSopenharmony_ci      The limit on the number of EmitVertex() calls that can be issued can not
23125bd8deadSopenharmony_ci      always be enforced at compile time, or even at Begin time.  We specify
23135bd8deadSopenharmony_ci      that if a shader tries to emit more vertices than allowed, emits that
23145bd8deadSopenharmony_ci      exceed the limit may or may not have any effect.
23155bd8deadSopenharmony_ci
23165bd8deadSopenharmony_ci  17. Should it be possible to change the limit GEOMETRY_VERTICES_OUT_ARB, the
23175bd8deadSopenharmony_ci      number of vertices emitted by a geometry shader, after the program
23185bd8deadSopenharmony_ci      object, containing the shader, is linked?
23195bd8deadSopenharmony_ci
23205bd8deadSopenharmony_ci      RESOLVED: NO. See also issue 31. Changing this limit might require a
23215bd8deadSopenharmony_ci      re-compile and/or re-link of the shaders and program object on certain
23225bd8deadSopenharmony_ci      implementations. Pretending that this limit can be changed without
23235bd8deadSopenharmony_ci      re-linking does not reflect reality.
23245bd8deadSopenharmony_ci
23255bd8deadSopenharmony_ci  18. How do user clipping and geometry shaders interact?
23265bd8deadSopenharmony_ci
23275bd8deadSopenharmony_ci      RESOLVED: Just like vertex shaders and user clipping interact. The
23285bd8deadSopenharmony_ci      geometry shader needs to provide the (eye) position gl_ClipVertex.
23295bd8deadSopenharmony_ci      Primitives are clipped after geometry shader execution, not before.
23305bd8deadSopenharmony_ci
23315bd8deadSopenharmony_ci  19. How do edge flags interact with adjacency primitives?
23325bd8deadSopenharmony_ci
23335bd8deadSopenharmony_ci      RESOLVED:  If geometry programs are disabled, adjacency primitives are
23345bd8deadSopenharmony_ci      still supported.  For TRIANGLES_ADJACENCY_ARB, edge flags will apply as
23355bd8deadSopenharmony_ci      they do for TRIANGLES.  Such primitives are rendered as independent
23365bd8deadSopenharmony_ci      triangles as though the adjacency vertices were not provided.  Edge
23375bd8deadSopenharmony_ci      flags for the "real" vertices are supported.  For all other adjacency
23385bd8deadSopenharmony_ci      primitive types, edge flags are irrelevant.
23395bd8deadSopenharmony_ci
23405bd8deadSopenharmony_ci  20. Now that a third shader object type is added, what combinations of
23415bd8deadSopenharmony_ci      GLSL, assembly (ARB or NV) low level and fixed-function do we want
23425bd8deadSopenharmony_ci      to support?
23435bd8deadSopenharmony_ci
23445bd8deadSopenharmony_ci      DISCUSSION: With the addition of the geometry shader, the number of
23455bd8deadSopenharmony_ci      combinations the GL pipeline could support doubled (there is no
23465bd8deadSopenharmony_ci      fixed-function geometry shading).  Possible combinations now are:
23475bd8deadSopenharmony_ci
23485bd8deadSopenharmony_ci        vertex        geometry        fragment
23495bd8deadSopenharmony_ci
23505bd8deadSopenharmony_ci        ff/ASM/GLSL   none/ASM/GLSL   ff/ASM/GLSL
23515bd8deadSopenharmony_ci
23525bd8deadSopenharmony_ci      for a total of 3 x 3 x 3 is 27 combinations. Before the geometry shader
23535bd8deadSopenharmony_ci      was added, the number of combinations was 9, and those we need to
23545bd8deadSopenharmony_ci      support. We have a choice on the other 18.
23555bd8deadSopenharmony_ci
23565bd8deadSopenharmony_ci      RESOLUTION: It makes sense to draw a line at raster in the GL
23575bd8deadSopenharmony_ci      pipeline. The 'north' side of this line covers vertex and geometry
23585bd8deadSopenharmony_ci      shaders, the 'south' side fragment shaders. We now add a simple rule
23595bd8deadSopenharmony_ci      that states that if a program object contains anything north of this
23605bd8deadSopenharmony_ci      line, the north side will be 100% GLSL. This means that:
23615bd8deadSopenharmony_ci
23625bd8deadSopenharmony_ci      a) GLSL program objects with a vertex shader can only use a geometry
23635bd8deadSopenharmony_ci      shader and not an assembly geometry program.  If an assembly geometry
23645bd8deadSopenharmony_ci      program is enabled, it is bypassed.  This also avoids a tricky case -- a
23655bd8deadSopenharmony_ci      GLSL program object with a vertex and a fragment program linked
23665bd8deadSopenharmony_ci      together.  Injecting an assembly geometry shader in the middle at run
23675bd8deadSopenharmony_ci      time won't work well.
23685bd8deadSopenharmony_ci
23695bd8deadSopenharmony_ci      b) GLSL program objects with a geometry shader must have a vertex shader
23705bd8deadSopenharmony_ci      (cannot be ARB/NV or fixed-function vertex shading).
23715bd8deadSopenharmony_ci
23725bd8deadSopenharmony_ci      The 'south' side in this program object still can be any of
23735bd8deadSopenharmony_ci      ff/ARB/NV/GLSL.
23745bd8deadSopenharmony_ci
23755bd8deadSopenharmony_ci  21. How do geometry shaders interact with color clamping?
23765bd8deadSopenharmony_ci
23775bd8deadSopenharmony_ci      RESOLVED:  Geometry shader execution occurs prior to color clamping in
23785bd8deadSopenharmony_ci      the pipeline.  This means the colors written by vertex shaders are not
23795bd8deadSopenharmony_ci      clamped to [0,1] before they are read by geometry shaders.  If color
23805bd8deadSopenharmony_ci      clamping is enabled, any vertex colors written by the geometry shader
23815bd8deadSopenharmony_ci      will have their components clamped to [0,1].
23825bd8deadSopenharmony_ci
23835bd8deadSopenharmony_ci  22. What is a primitive ID and a vertex ID? I am confused.
23845bd8deadSopenharmony_ci
23855bd8deadSopenharmony_ci      DISCUSSION: A vertex shader can read a built-in attribute that holds the
23865bd8deadSopenharmony_ci      ID of the current vertex it is processing. See the ARB_gpu_shader4 spec
23875bd8deadSopenharmony_ci      for more information on vertex ID. If the geometry shader needs access
23885bd8deadSopenharmony_ci      to a vertex ID as well, it can be passed as a user-defined varying
23895bd8deadSopenharmony_ci      variable. A geometry shader can read a built-in varying variable that
23905bd8deadSopenharmony_ci      holds the ID of the current primitive it is processing. It also has the
23915bd8deadSopenharmony_ci      ability to write to a built-in output primitive ID variable, to
23925bd8deadSopenharmony_ci      communicate the primitive ID to a fragment shader.  A fragment shader
23935bd8deadSopenharmony_ci      can read a built-in attribute that holds the ID of the current primitive
23945bd8deadSopenharmony_ci      it is processing. A primitive ID will be generated even if no geometry
23955bd8deadSopenharmony_ci      shader is active.
23965bd8deadSopenharmony_ci
23975bd8deadSopenharmony_ci  23. After a call to EmitVertex(), should the values of the output varying
23985bd8deadSopenharmony_ci      variables be retained or be undefined?
23995bd8deadSopenharmony_ci
24005bd8deadSopenharmony_ci      DISCUSSION: There is not a clear answer to this question .The underlying
24015bd8deadSopenharmony_ci      HW mechanism is as follows. An array of output registers is set aside to
24025bd8deadSopenharmony_ci      store vertices that make up primitives.  After each EmitVertex() a
24035bd8deadSopenharmony_ci      pointer into that array is incremented.  The shader no longer has access
24045bd8deadSopenharmony_ci      to the previous set of values.  This argues that the values of output
24055bd8deadSopenharmony_ci      varying variables should be undefined after an EmitVertex() call. The
24065bd8deadSopenharmony_ci      shader is responsible for writing values to all varying variables it
24075bd8deadSopenharmony_ci      wants to emit, for each emit. The counter argument to this is that this
24085bd8deadSopenharmony_ci      is not a nice model for GLSL to program in. The compiler can store
24095bd8deadSopenharmony_ci      varying outputs in a temp register and preserve their values across
24105bd8deadSopenharmony_ci      EmitVertex() calls, at the cost of increased register pressure.
24115bd8deadSopenharmony_ci
24125bd8deadSopenharmony_ci      RESOLUTION: For now, without being a clear winner, we've decided to go
24135bd8deadSopenharmony_ci      with the undefined option. The shader is responsible for writng values
24145bd8deadSopenharmony_ci      to all varying variabvles it wants to emit, for each emit.
24155bd8deadSopenharmony_ci
24165bd8deadSopenharmony_ci  24. How to distinguish between input and output "varying" variables?
24175bd8deadSopenharmony_ci
24185bd8deadSopenharmony_ci      DISCUSSION: Geometry shader outputs are varying variables consistent
24195bd8deadSopenharmony_ci      with the existing definition of varying (used to communicate to the
24205bd8deadSopenharmony_ci      fragment processing stage). Geometry inputs are received from a vertex
24215bd8deadSopenharmony_ci      shader writing to its varying variable outputs. The inputs could be
24225bd8deadSopenharmony_ci      called "varying", to match with the vertex shader, or could be called
24235bd8deadSopenharmony_ci      "attributes" to match the vertex shader inputs (which are called
24245bd8deadSopenharmony_ci      attributes).
24255bd8deadSopenharmony_ci
24265bd8deadSopenharmony_ci      RESOLUTION: We'll call input variables "varying", and not
24275bd8deadSopenharmony_ci      "attributes". To distinguish between input and output, they will be
24285bd8deadSopenharmony_ci      further qualified with the words "in" and "out" resulting in, for
24295bd8deadSopenharmony_ci      example:
24305bd8deadSopenharmony_ci
24315bd8deadSopenharmony_ci        varying in float foo;
24325bd8deadSopenharmony_ci        varying out vec4 bar[];
24335bd8deadSopenharmony_ci  
24345bd8deadSopenharmony_ci  25. What is the syntax for declaring varying input variables?
24355bd8deadSopenharmony_ci
24365bd8deadSopenharmony_ci      DISCUSSION: We need a way to distinguish between the vertices of the
24375bd8deadSopenharmony_ci      input primitive.  Suggestions:
24385bd8deadSopenharmony_ci
24395bd8deadSopenharmony_ci        1. Declare each input varying variable as an unsized array. Its size
24405bd8deadSopenharmony_ci           is inferred by the linker based on the output primitive type.
24415bd8deadSopenharmony_ci
24425bd8deadSopenharmony_ci        2. Declare each input varying variable as a sized array. If the size
24435bd8deadSopenharmony_ci           does not match the output primitive type, a link error occurs.
24445bd8deadSopenharmony_ci
24455bd8deadSopenharmony_ci        3. Have an array of structures, where the structure contains the
24465bd8deadSopenharmony_ci           attributes for each vertex.
24475bd8deadSopenharmony_ci
24485bd8deadSopenharmony_ci      RESOLUTION: Option 1 seems simple and solves the problem, but it is not
24495bd8deadSopenharmony_ci      a clear winner over the other two. To aid the shader writer in figuring
24505bd8deadSopenharmony_ci      out the size of each array, a new built-in constant, gl_VerticesIn, is
24515bd8deadSopenharmony_ci      defined that holds the number of vertices for the current input
24525bd8deadSopenharmony_ci      primitive type.
24535bd8deadSopenharmony_ci
24545bd8deadSopenharmony_ci  26. Does gl_PointSize, gl_Layer, gl_ClipVertex count agains the
24555bd8deadSopenharmony_ci      MAX_GEOMETRY_VARYING_COMPONENTS limit?
24565bd8deadSopenharmony_ci
24575bd8deadSopenharmony_ci      RESOLUTION: Core OpenGL 2.0 makes a distinction between varying
24585bd8deadSopenharmony_ci      variables, output from a vertex shader and interpolated over a
24595bd8deadSopenharmony_ci      primitive, and 'special built-in variables' that are outputs, but not
24605bd8deadSopenharmony_ci      interpolated across a primitive. Only varying variables do count against
24615bd8deadSopenharmony_ci      the MAX_VERTEX_VARYING_COMPONENTS limit.  gl_PointSize, gl_Layer,
24625bd8deadSopenharmony_ci      gl_ClipVertex and gl_Position are 'special built-in' variables, and
24635bd8deadSopenharmony_ci      therefore should not count against the limit. If HW does need to take
24645bd8deadSopenharmony_ci      components away to support those, that is ok. The actual spec language
24655bd8deadSopenharmony_ci      does mention possible implementation dependencies.
24665bd8deadSopenharmony_ci
24675bd8deadSopenharmony_ci  27. Should writing to gl_Position be optional?
24685bd8deadSopenharmony_ci
24695bd8deadSopenharmony_ci      DISCUSSION: Before this extensions, the OpenGL Shading Language required
24705bd8deadSopenharmony_ci      that gl_Position be written to in a vertex shader. With the addition of
24715bd8deadSopenharmony_ci      geometry shaders, it is not necessary anymore for a vertex shader to
24725bd8deadSopenharmony_ci      output gl_Position. The geometry shader can do so. With the addition of
24735bd8deadSopenharmony_ci      transform-feedback (see the transform feedback specification) it is not
24745bd8deadSopenharmony_ci      necessary useful for the geometry shader to write out gl_Position
24755bd8deadSopenharmony_ci      either.
24765bd8deadSopenharmony_ci
24775bd8deadSopenharmony_ci      RESOLUTION: Yes, this should be optional.
24785bd8deadSopenharmony_ci
24795bd8deadSopenharmony_ci  28. Should geometry shaders be able to select a layer of a 3D texture, cube
24805bd8deadSopenharmony_ci      map texture, or array texture at run time?  If so, how?
24815bd8deadSopenharmony_ci
24825bd8deadSopenharmony_ci      RESOLVED: See also issue 32. This extension provides a per-vertex output
24835bd8deadSopenharmony_ci      called "gl_Layer", which is an integer specifying the layer to render
24845bd8deadSopenharmony_ci      to. In order to get defined results, the value of gl_Layer needs to be
24855bd8deadSopenharmony_ci      constant for each primitive (point, line or triangle) being emitted by a
24865bd8deadSopenharmony_ci      geometry shader. This layer value is used for all fragments generated by
24875bd8deadSopenharmony_ci      that primitive.
24885bd8deadSopenharmony_ci
24895bd8deadSopenharmony_ci      The EXT_framebuffer_object (FBO) extension is used for rendering to
24905bd8deadSopenharmony_ci      textures, but for cube maps and 3D textures, it only provides the
24915bd8deadSopenharmony_ci      ability to attach a single face or layer of such textures.
24925bd8deadSopenharmony_ci
24935bd8deadSopenharmony_ci      This extension generalizes FBO by creates new entry points to bind an
24945bd8deadSopenharmony_ci      entire texture level (FramebufferTextureARB) or a single layer of a
24955bd8deadSopenharmony_ci      texture level (FramebufferTextureLayerARB) or a single face of a level
24965bd8deadSopenharmony_ci      of a cube map texture (FramebufferTextureFaceARB) to an attachment
24975bd8deadSopenharmony_ci      point.  The existing FBO binding functions, FramebufferTexture[123]DARB
24985bd8deadSopenharmony_ci      are retained, and are defined in terms of the more general new
24995bd8deadSopenharmony_ci      functions.
25005bd8deadSopenharmony_ci
25015bd8deadSopenharmony_ci      The new functions do not have a dimension in the function name or a
25025bd8deadSopenharmony_ci      <textarget> parameter, which can be inferred from the provided
25035bd8deadSopenharmony_ci      texture.
25045bd8deadSopenharmony_ci
25055bd8deadSopenharmony_ci      When an entire texel level of a cube map, 3D, or array texture is
25065bd8deadSopenharmony_ci      attached, that attachment is considered layered.  The framebuffer is
25075bd8deadSopenharmony_ci      considered layered if any attachment is layered.  When the framebuffer
25085bd8deadSopenharmony_ci      is layered, there are three additional completeness requirements:
25095bd8deadSopenharmony_ci
25105bd8deadSopenharmony_ci        * all attachments must be layered
25115bd8deadSopenharmony_ci        * all color attachments must be from textures of identical type
25125bd8deadSopenharmony_ci        * all attachments must have the same number of layers
25135bd8deadSopenharmony_ci
25145bd8deadSopenharmony_ci      We expect subsequent versions of the FBO spec to relax the requirement
25155bd8deadSopenharmony_ci      that all attachments must have the same width and height, and plan to
25165bd8deadSopenharmony_ci      relax the similar requirement for layer count at that time.
25175bd8deadSopenharmony_ci
25185bd8deadSopenharmony_ci      When rendering to a layered framebuffer, layer zero is used unless a
25195bd8deadSopenharmony_ci      geometry shader that writes (statically assings, to be precise) to
25205bd8deadSopenharmony_ci      gl_Layer. When rendering to a non-layered framebuffer, the value of
25215bd8deadSopenharmony_ci      gl_Layer is ignored and the set of single-image attachments are used.
25225bd8deadSopenharmony_ci      When reading from a layered framebuffer (e.g., ReadPixels), layer zero
25235bd8deadSopenharmony_ci      is always used.  When clearing a layered framebuffer, all layers are
25245bd8deadSopenharmony_ci      cleared to the corresponding clear values.
25255bd8deadSopenharmony_ci
25265bd8deadSopenharmony_ci      Several other approaches were considered, including leveraging existing
25275bd8deadSopenharmony_ci      FBO attachment functions and requiring the use of FramebufferTexture3D
25285bd8deadSopenharmony_ci      with a <zoffset> of zero to make a framebuffer attachment "layerable"
25295bd8deadSopenharmony_ci      (attaching layer zero means that the attachment could be used for either
25305bd8deadSopenharmony_ci      layered- or non- layered rendering).  Whether rendering was layered or
25315bd8deadSopenharmony_ci      not could either be inferred from the active geometry shader, or set as
25325bd8deadSopenharmony_ci      a new property of the framebuffer object.  There is presently no
25335bd8deadSopenharmony_ci      FramebufferParameter API to set a property of a framebuffer, so it would
25345bd8deadSopenharmony_ci      have been necessary to create new set/query APIs if this approach were
25355bd8deadSopenharmony_ci      chosen.
25365bd8deadSopenharmony_ci
25375bd8deadSopenharmony_ci  29. How should per-vertex point size work with geometry shaders?
25385bd8deadSopenharmony_ci
25395bd8deadSopenharmony_ci      RESOLVED: The value of the existing VERTEX_PROGRAM_POINT_SIZE enable, to
25405bd8deadSopenharmony_ci      control the point size behavior of a vertex shader, does not affect
25415bd8deadSopenharmony_ci      geometry shaders.  Specifically, If a geometry shader is active, the
25425bd8deadSopenharmony_ci      point size is taken from the point size output gl_PointSize of the
25435bd8deadSopenharmony_ci      vertex shader, regardless of the value of VERTEX_PROGRAM_POINT_SIZE.
25445bd8deadSopenharmony_ci
25455bd8deadSopenharmony_ci  30. Geometry shaders don't provide a QUADS or generic POLYGON input
25465bd8deadSopenharmony_ci      primitive type.  In this extension, what happens if an application
25475bd8deadSopenharmony_ci      provides QUADS, QUAD_STRIP, or POLYGON primitives?
25485bd8deadSopenharmony_ci
25495bd8deadSopenharmony_ci      RESOLVED:  Not all vendors supporting this extension were able to accept
25505bd8deadSopenharmony_ci      quads and polygon primitives as input, so such functionality was not
25515bd8deadSopenharmony_ci      provided in this extension.  This extension requires that primitives
25525bd8deadSopenharmony_ci      provided to the GL must match the input primitive type of the active
25535bd8deadSopenharmony_ci      geometry shader (if any).  QUADS, QUAD_STRIP, and POLYGON primitives are
25545bd8deadSopenharmony_ci      considered not to match any input primitive type, so an
25555bd8deadSopenharmony_ci      INVALID_OPERATION error will result.
25565bd8deadSopenharmony_ci
25575bd8deadSopenharmony_ci      The NV_geometry_shader4 extension (built on top of this one) allows
25585bd8deadSopenharmony_ci      applications to provide quads or general polygon primitives to a
25595bd8deadSopenharmony_ci      geometry shader with an input primitive type of TRIANGLES.  Such
25605bd8deadSopenharmony_ci      primitives are decomposed into triangles, and a geometry shader is run
25615bd8deadSopenharmony_ci      on each triangle independently.
25625bd8deadSopenharmony_ci
25635bd8deadSopenharmony_ci  31. Geometry shaders provide a limit on the number of vertices that can be
25645bd8deadSopenharmony_ci      emitted.  Can this limit be changed at dynamically?
25655bd8deadSopenharmony_ci
25665bd8deadSopenharmony_ci      RESOLVED: See also issue 17.  Not in this extension.  This functionality
25675bd8deadSopenharmony_ci      was not provided because it would be an expensive operation on some
25685bd8deadSopenharmony_ci      implementations of this extension.  The NV_geometry_shader4 extension
25695bd8deadSopenharmony_ci      (layered on top of this one) does allow applications to change this
25705bd8deadSopenharmony_ci      limit dynamically.
25715bd8deadSopenharmony_ci
25725bd8deadSopenharmony_ci      An application can change the vertex output limit at any time.  To allow
25735bd8deadSopenharmony_ci      for the possibility of dynamic changes (as in NV_geometry_shader4) but
25745bd8deadSopenharmony_ci      not require it, a limit change is not guaranteed to take effect unless
25755bd8deadSopenharmony_ci      the program object is re-linked.  However, there is no guarantee that
25765bd8deadSopenharmony_ci      such limit changes will not take effect immediately.
25775bd8deadSopenharmony_ci
25785bd8deadSopenharmony_ci  32. See also issue 28. Each vertex emitted by a geometry shader can specify
25795bd8deadSopenharmony_ci      a layer to render to using the output variable "gl_Layer".  For
25805bd8deadSopenharmony_ci      LINE_STRIP and TRIANGLE_STRIP output primitive types, which vertex's
25815bd8deadSopenharmony_ci      layer is used?
25825bd8deadSopenharmony_ci
25835bd8deadSopenharmony_ci      RESOLVED:  The vertex from which the layer is extracted is unfortunately
25845bd8deadSopenharmony_ci      undefined.  In practice, some implementations of this extension will
25855bd8deadSopenharmony_ci      extract the layer number from the first vertex of the output primitive;
25865bd8deadSopenharmony_ci      others will extract it from the last (provoking) vertex.  A future
25875bd8deadSopenharmony_ci      geometry shader extension may choose to define this behavior one way or
25885bd8deadSopenharmony_ci      the other.
25895bd8deadSopenharmony_ci
25905bd8deadSopenharmony_ci      To get portable results, the layer number should be the same for all
25915bd8deadSopenharmony_ci      vertices in any single primitive emitted by the geometry shader.  The
25925bd8deadSopenharmony_ci      EndPrimitive() built-in function available in a geometry shader starts a
25935bd8deadSopenharmony_ci      new primitive, and the layer number emitted can be safely changed after
25945bd8deadSopenharmony_ci      EndPrimitive() is called.
25955bd8deadSopenharmony_ci
25965bd8deadSopenharmony_ci  33. The grammar allows "varying", "varying out", and "varying in" as
25975bd8deadSopenharmony_ci      type-qualifiers for geometry shaders.  What does "varying" without "in"
25985bd8deadSopenharmony_ci      or "out" mean for a geometry shader?
25995bd8deadSopenharmony_ci
26005bd8deadSopenharmony_ci      RESOLVED:  The "varying" type qualifier in a geometry shader not
26015bd8deadSopenharmony_ci      followed by "in" or "out" means the same as "varying out".
26025bd8deadSopenharmony_ci
26035bd8deadSopenharmony_ci      This is consistent with the specification saying: "In order to seamlessly
26045bd8deadSopenharmony_ci      be able to insert or remove a geometry shader from a program object,
26055bd8deadSopenharmony_ci      the rules, names and types of the output built-in varying variables and
26065bd8deadSopenharmony_ci      user-defined varying variables are the same as for the vertex shader."
26075bd8deadSopenharmony_ci
26085bd8deadSopenharmony_ci  34. What happens if you try to do a framebuffer blit (EXT_framebuffer_blit)
26095bd8deadSopenharmony_ci      to/from a layered framebuffer?
26105bd8deadSopenharmony_ci
26115bd8deadSopenharmony_ci      RESOLVED:  BlitFramebufferEXT() is a two-dimensional operation (only has
26125bd8deadSopenharmony_ci      a width and height), so only reads/writes layer zero.  The framebuffer
26135bd8deadSopenharmony_ci      blit operation is defined partially in terms of CopyPixels, which itself
26145bd8deadSopenharmony_ci      is defined in terms of ReadPixels and DrawPixels.  This spec defines
26155bd8deadSopenharmony_ci      both operations to use layer zero when a layered framebuffer is
26165bd8deadSopenharmony_ci      involved.
26175bd8deadSopenharmony_ci
26185bd8deadSopenharmony_ci      It may be desirable to provide a three-dimensional framebuffer blit
26195bd8deadSopenharmony_ci      operation or an explicit copy single-step operation between two
26205bd8deadSopenharmony_ci      three-dimensional, cube map, or array textures.  That functionality is
26215bd8deadSopenharmony_ci      left for a future extension or OpenGL version.
26225bd8deadSopenharmony_ci
26235bd8deadSopenharmony_ci  35. Why are the MAX_VARYING_COMPONENTS and FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER
26245bd8deadSopenharmony_ci      tokens un-suffixed?
26255bd8deadSopenharmony_ci
26265bd8deadSopenharmony_ci      PROPOSED: Both of these tokens are provided in un-suffixed form in
26275bd8deadSopenharmony_ci      OpenGL 3.0, which was released simultaneously with
26285bd8deadSopenharmony_ci      ARB_geometry_shader4, and are not going to change their meaning
26295bd8deadSopenharmony_ci      when this extension is promoted to a future core release since
26305bd8deadSopenharmony_ci      their meaning is already defined by both 3.0 and this extension
26315bd8deadSopenharmony_ci      to be the same
26325bd8deadSopenharmony_ci
26335bd8deadSopenharmony_ciRevision History
26345bd8deadSopenharmony_ci
26355bd8deadSopenharmony_ci    Rev.    Date    Author    Changes
26365bd8deadSopenharmony_ci    ----  --------  --------  -----------------------------------------
26375bd8deadSopenharmony_ci     26   01/21/11  pbrown    Add language describing MAX_COMBINED_
26385bd8deadSopenharmony_ci                              GEOMETRY_UNIFORM_COMPONENTS from an interaction
26395bd8deadSopenharmony_ci                              with ARB_uniform_buffer_object (bug 7027).
26405bd8deadSopenharmony_ci
26415bd8deadSopenharmony_ci     25   12/21/09  jjones    Add GLX protocol.
26425bd8deadSopenharmony_ci
26435bd8deadSopenharmony_ci     24   07/21/09  pbrown    Clarify that when doing layered rendering,
26445bd8deadSopenharmony_ci                              a layer specified in the shader is used to
26455bd8deadSopenharmony_ci                              select the depth and stencil layers accessed.
26465bd8deadSopenharmony_ci
26475bd8deadSopenharmony_ci     23   06/30/09  pbrown    Add interaction with OpenGL 3.2.
26485bd8deadSopenharmony_ci
26495bd8deadSopenharmony_ci     22   08/07/08  jleech    Strip ARB suffix from a few tokens already
26505bd8deadSopenharmony_ci                              in OpenGL 3.0 (see issue 35).
26515bd8deadSopenharmony_ci
26525bd8deadSopenharmony_ci     21   07/09/08  jsandmel  last edit accidentally added dependencies
26535bd8deadSopenharmony_ci                              on ARB_framebuffer_object.  as per working
26545bd8deadSopenharmony_ci                              group meeting 7/11, this was unintentional, so
26555bd8deadSopenharmony_ci                              it's now been reverted back to a dependency on
26565bd8deadSopenharmony_ci                              EXT_framebuffer_object
26575bd8deadSopenharmony_ci
26585bd8deadSopenharmony_ci     20   07/09/08  jsandmel  converted to ARB.  no functional changes.
26595bd8deadSopenharmony_ci           
26605bd8deadSopenharmony_ci    
26615bd8deadSopenharmony_ci     19   04/04/08  pbrown    Changed MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB
26625bd8deadSopenharmony_ci                              minimum value to zero, to match discussion (from
26635bd8deadSopenharmony_ci                              aeddy).  Added separators to group pictures and 
26645bd8deadSopenharmony_ci                              discussions of each of the new primitive types
26655bd8deadSopenharmony_ci                              together.
26665bd8deadSopenharmony_ci
26675bd8deadSopenharmony_ci     18   03/15/08  pbrown    Additional dependency on EXT_framebuffer_blit;
26685bd8deadSopenharmony_ci                              blits to/from layered targets affect only
26695bd8deadSopenharmony_ci                              layer zero.
26705bd8deadSopenharmony_ci
26715bd8deadSopenharmony_ci     17   05/22/07  mjk       Clarify that "varying" means the same as
26725bd8deadSopenharmony_ci                              "varying out" in a geometry shader.
26735bd8deadSopenharmony_ci
26745bd8deadSopenharmony_ci     16   01/10/07  pbrown    Specify that the total component limit is
26755bd8deadSopenharmony_ci                              enforced at LinkProgram time.
26765bd8deadSopenharmony_ci
26775bd8deadSopenharmony_ci     15   12/15/06  pbrown    Documented that the '#extension' token
26785bd8deadSopenharmony_ci                              for this extension should begin with "GL_",
26795bd8deadSopenharmony_ci                              as apparently called for per convention.
26805bd8deadSopenharmony_ci
26815bd8deadSopenharmony_ci     14      --               Pre-release revisions.
2682