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