15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    ARB_pipeline_statistics_query
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_ARB_pipeline_statistics_query
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Brian Paul, VMware Inc. (brianp 'at' vmware.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciContributors
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    Brian Paul, VMware
165bd8deadSopenharmony_ci    Daniel Rakos, AMD
175bd8deadSopenharmony_ci    Graham Sellers, AMD
185bd8deadSopenharmony_ci    Pat Brown, NVIDIA
195bd8deadSopenharmony_ci    Piers Daniell, NVIDIA
205bd8deadSopenharmony_ci
215bd8deadSopenharmony_ciNotice
225bd8deadSopenharmony_ci
235bd8deadSopenharmony_ci    Copyright (c) 2014 The Khronos Group Inc. Copyright terms at
245bd8deadSopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
255bd8deadSopenharmony_ci
265bd8deadSopenharmony_ciSpecification Update Policy
275bd8deadSopenharmony_ci
285bd8deadSopenharmony_ci    Khronos-approved extension specifications are updated in response to
295bd8deadSopenharmony_ci    issues and bugs prioritized by the Khronos OpenGL Working Group. For
305bd8deadSopenharmony_ci    extensions which have been promoted to a core Specification, fixes will
315bd8deadSopenharmony_ci    first appear in the latest version of that core Specification, and will
325bd8deadSopenharmony_ci    eventually be backported to the extension document. This policy is
335bd8deadSopenharmony_ci    described in more detail at
345bd8deadSopenharmony_ci        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
355bd8deadSopenharmony_ci
365bd8deadSopenharmony_ciStatus
375bd8deadSopenharmony_ci
385bd8deadSopenharmony_ci    Complete.
395bd8deadSopenharmony_ci    Approved by the ARB on June 26, 2014.
405bd8deadSopenharmony_ci    Ratified by the Khronos Board of Promoters on August 7, 2014.
415bd8deadSopenharmony_ci
425bd8deadSopenharmony_ciVersion
435bd8deadSopenharmony_ci
445bd8deadSopenharmony_ci    Date: 2017-07-23
455bd8deadSopenharmony_ci    Revision: 11
465bd8deadSopenharmony_ci
475bd8deadSopenharmony_ciNumber
485bd8deadSopenharmony_ci
495bd8deadSopenharmony_ci    ARB Extension #171
505bd8deadSopenharmony_ci
515bd8deadSopenharmony_ciDependencies
525bd8deadSopenharmony_ci
535bd8deadSopenharmony_ci    OpenGL 3.0 is required.
545bd8deadSopenharmony_ci
555bd8deadSopenharmony_ci    The extension is written against the OpenGL 4.4 Specification, Core
565bd8deadSopenharmony_ci    Profile, March 19, 2014.
575bd8deadSopenharmony_ci
585bd8deadSopenharmony_ci    OpenGL 3.2 and ARB_geometry_shader4 affect the definition of this
595bd8deadSopenharmony_ci    extension.
605bd8deadSopenharmony_ci
615bd8deadSopenharmony_ci    OpenGL 4.0 and ARB_gpu_shader5 affect the definition of this extension.
625bd8deadSopenharmony_ci
635bd8deadSopenharmony_ci    OpenGL 4.0 and ARB_tessellation_shader affect the definition of this
645bd8deadSopenharmony_ci    extension.
655bd8deadSopenharmony_ci
665bd8deadSopenharmony_ci    OpenGL 4.3 and ARB_compute_shader affect the definition of this extension.
675bd8deadSopenharmony_ci
685bd8deadSopenharmony_ci    This extension interacts with AMD_transform_feedback4.
695bd8deadSopenharmony_ci
705bd8deadSopenharmony_ciOverview
715bd8deadSopenharmony_ci
725bd8deadSopenharmony_ci    This extension introduces new query types that allow applications to get
735bd8deadSopenharmony_ci    statistics information about different parts of the pipeline:
745bd8deadSopenharmony_ci
755bd8deadSopenharmony_ci      * Number of vertices and primitives issued to the GL;
765bd8deadSopenharmony_ci
775bd8deadSopenharmony_ci      * Number of times a vertex shader, tessellation evaluation shader,
785bd8deadSopenharmony_ci        geometry shader, fragment shader, and compute shader was invoked;
795bd8deadSopenharmony_ci
805bd8deadSopenharmony_ci      * Number of patches processed by the tessellation control shader stage;
815bd8deadSopenharmony_ci
825bd8deadSopenharmony_ci      * Number of primitives emitted by a geometry shader;
835bd8deadSopenharmony_ci
845bd8deadSopenharmony_ci      * Number of primitives that entered the primitive clipping stage;
855bd8deadSopenharmony_ci
865bd8deadSopenharmony_ci      * Number of primitives that are output by the primitive clipping stage;
875bd8deadSopenharmony_ci
885bd8deadSopenharmony_ciIP Status
895bd8deadSopenharmony_ci
905bd8deadSopenharmony_ci    No known IP claims.
915bd8deadSopenharmony_ci
925bd8deadSopenharmony_ciNew Procedures and Functions
935bd8deadSopenharmony_ci
945bd8deadSopenharmony_ci    None.
955bd8deadSopenharmony_ci
965bd8deadSopenharmony_ciNew Tokens
975bd8deadSopenharmony_ci
985bd8deadSopenharmony_ci    Accepted by the <target> parameter of BeginQuery, EndQuery, GetQueryiv,
995bd8deadSopenharmony_ci    BeginQueryIndexed, EndQueryIndexed and GetQueryIndexediv:
1005bd8deadSopenharmony_ci
1015bd8deadSopenharmony_ci        VERTICES_SUBMITTED_ARB                          0x82EE
1025bd8deadSopenharmony_ci        PRIMITIVES_SUBMITTED_ARB                        0x82EF
1035bd8deadSopenharmony_ci        VERTEX_SHADER_INVOCATIONS_ARB                   0x82F0
1045bd8deadSopenharmony_ci        TESS_CONTROL_SHADER_PATCHES_ARB                 0x82F1
1055bd8deadSopenharmony_ci        TESS_EVALUATION_SHADER_INVOCATIONS_ARB          0x82F2
1065bd8deadSopenharmony_ci        GEOMETRY_SHADER_INVOCATIONS                     0x887F
1075bd8deadSopenharmony_ci        GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB          0x82F3
1085bd8deadSopenharmony_ci        FRAGMENT_SHADER_INVOCATIONS_ARB                 0x82F4
1095bd8deadSopenharmony_ci        COMPUTE_SHADER_INVOCATIONS_ARB                  0x82F5
1105bd8deadSopenharmony_ci        CLIPPING_INPUT_PRIMITIVES_ARB                   0x82F6
1115bd8deadSopenharmony_ci        CLIPPING_OUTPUT_PRIMITIVES_ARB                  0x82F7
1125bd8deadSopenharmony_ci
1135bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 4.4 (Core Profile) Specification (Event Model)
1145bd8deadSopenharmony_ci
1155bd8deadSopenharmony_ci    Modify Section 4.2, Query Objects and Asynchronous Queries
1165bd8deadSopenharmony_ci
1175bd8deadSopenharmony_ci    (add to the end of the bullet list on the first paragraph on p. 39)
1185bd8deadSopenharmony_ci
1195bd8deadSopenharmony_ci      * Submission queries with a target of VERTICES_SUBMITTED_ARB and
1205bd8deadSopenharmony_ci        PRIMITIVES_SUBMITTED_ARB return information on the number of vertices
1215bd8deadSopenharmony_ci        and primitives transferred to the GL, respectively (see section 10.11).
1225bd8deadSopenharmony_ci
1235bd8deadSopenharmony_ci      * Vertex shader queries with a target of VERTEX_SHADER_INVOCATIONS_ARB
1245bd8deadSopenharmony_ci        return information on the number of times the vertex shader has been
1255bd8deadSopenharmony_ci        invoked (see section 11.1.4).
1265bd8deadSopenharmony_ci
1275bd8deadSopenharmony_ci      * Tessellation shader queries with a target of TESS_CONTROL_SHADER_-
1285bd8deadSopenharmony_ci        PATCHES_ARB and TESS_EVALUATION_SHADER_INVOCATIONS_ARB return
1295bd8deadSopenharmony_ci        information on the number of patches processed by the tessellation
1305bd8deadSopenharmony_ci        control shader stage and the number of times the tessellation
1315bd8deadSopenharmony_ci        evaluation shader has been invoked, respectively (see section 11.2.4).
1325bd8deadSopenharmony_ci
1335bd8deadSopenharmony_ci      * Geometry shader queries with a target of GEOMETRY_SHADER_INVOCATIONS
1345bd8deadSopenharmony_ci        and GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB return information on the
1355bd8deadSopenharmony_ci        number of times the geometry shader has been invoked and the number of
1365bd8deadSopenharmony_ci        primitives it emitted (see section 11.3.5).
1375bd8deadSopenharmony_ci
1385bd8deadSopenharmony_ci      * Primitive clipping queries with a target of CLIPPING_INPUT_-
1395bd8deadSopenharmony_ci        PRIMITIVES_ARB and CLIPPING_OUTPUT_PRIMITIVES_ARB return information
1405bd8deadSopenharmony_ci        on the number of primitives that were processed in the primitive
1415bd8deadSopenharmony_ci        clipping stage and the number of primitives that were output by the
1425bd8deadSopenharmony_ci        primitive clipping stage and are further processed by the
1435bd8deadSopenharmony_ci        rasterization stage, respectively (see section 13.5.2).
1445bd8deadSopenharmony_ci
1455bd8deadSopenharmony_ci      * Fragment shader queries with a target of FRAGMENT_SHADER_INVOCATIONS_-
1465bd8deadSopenharmony_ci        ARB return information on the number of times the fragment shader has
1475bd8deadSopenharmony_ci        been invoked (see section 15.3).
1485bd8deadSopenharmony_ci
1495bd8deadSopenharmony_ci      * Compute shader queries with a target of COMPUTE_SHADER_INVOCATIONS_ARB
1505bd8deadSopenharmony_ci        return information on the number of times the compute shader has been
1515bd8deadSopenharmony_ci        invoked (see section 19.2).
1525bd8deadSopenharmony_ci
1535bd8deadSopenharmony_ci    (replace the INVALID_ENUM error for the <target> parameter of
1545bd8deadSopenharmony_ci    BeginQueryIndexed on p. 40):
1555bd8deadSopenharmony_ci
1565bd8deadSopenharmony_ci    An INVALID_ENUM error is generated if <target> is TIMESTAMP, or is not
1575bd8deadSopenharmony_ci    one of the query object targets described in section 4.2.
1585bd8deadSopenharmony_ci
1595bd8deadSopenharmony_ci    (replace the INVALID_ENUM error for the <target> parameter of
1605bd8deadSopenharmony_ci    EndQueryIndexed on p. 41):
1615bd8deadSopenharmony_ci
1625bd8deadSopenharmony_ci    An INVALID_ENUM error is generated if <target> is TIMESTAMP, or is not
1635bd8deadSopenharmony_ci    one of the query object targets described in section 4.2.
1645bd8deadSopenharmony_ci
1655bd8deadSopenharmony_ci    (modify the INVALID_VALUE error for <index> on non-indexed <target>s on
1665bd8deadSopenharmony_ci    p. 42):
1675bd8deadSopenharmony_ci
1685bd8deadSopenharmony_ci    An INVALID_OPERATION error is generated if <target> is a valid target
1695bd8deadSopenharmony_ci    other than PRIMITIVES_GENERATED or
1705bd8deadSopenharmony_ci    TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, and <index> is not zero.
1715bd8deadSopenharmony_ci
1725bd8deadSopenharmony_ci
1735bd8deadSopenharmony_ci    Modify Section 4.2.1, Query Object Queries
1745bd8deadSopenharmony_ci
1755bd8deadSopenharmony_ci    (add before the errors section for GetQueryIndexediv on p. 43)
1765bd8deadSopenharmony_ci
1775bd8deadSopenharmony_ci      For pipeline statistics queries (VERTICES_SUBMITTED_ARB, PRIMITIVES_-
1785bd8deadSopenharmony_ci      SUBMITTED_ARB, VERTEX_SHADER_INVOCATIONS_ARB, TESS_CONTROL_SHADER_-
1795bd8deadSopenharmony_ci      PATCHES_ARB, TESS_EVALUATION_SHADER_INVOCATIONS_ARB, GEOMETRY_SHADER_-
1805bd8deadSopenharmony_ci      INVOCATIONS, FRAGMENT_SHADER_INVOCATIONS_ARB, COMPUTE_SHADER_-
1815bd8deadSopenharmony_ci      INVOCATIONS_ARB, GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB, CLIPPING_-
1825bd8deadSopenharmony_ci      INPUT_PRIMITIVES_ARB, CLIPPING_OUTPUT_PRIMITIVES_ARB), if the number
1835bd8deadSopenharmony_ci      of bits is non-zero, the minimum number of bits allowed is 32.
1845bd8deadSopenharmony_ci
1855bd8deadSopenharmony_ci    (replace the INVALID_ENUM error for the <target> parameter of
1865bd8deadSopenharmony_ci    GetQueryIndexediv on p. 43):
1875bd8deadSopenharmony_ci
1885bd8deadSopenharmony_ci    An INVALID_ENUM error is generated if <target> is not one of the query
1895bd8deadSopenharmony_ci    object targets described in section 4.2.
1905bd8deadSopenharmony_ci
1915bd8deadSopenharmony_ci    (modify the INVALID_VALUE error for <index> on non-indexed <target>s on
1925bd8deadSopenharmony_ci    p. 43):
1935bd8deadSopenharmony_ci
1945bd8deadSopenharmony_ci    An INVALID_OPERATION error is generated if <target> is a valid target
1955bd8deadSopenharmony_ci    other than PRIMITIVES_GENERATED or
1965bd8deadSopenharmony_ci    TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, and <index> is not zero.
1975bd8deadSopenharmony_ci
1985bd8deadSopenharmony_ciAdditions to Chapter 10 of the OpenGL 4.4 (Core Profile) Specification (Vertex Specification and Drawing Commands)
1995bd8deadSopenharmony_ci
2005bd8deadSopenharmony_ci    Add new Section after 10.10, Conditional Rendering
2015bd8deadSopenharmony_ci
2025bd8deadSopenharmony_ci    10.11 Submission Queries
2035bd8deadSopenharmony_ci
2045bd8deadSopenharmony_ci    Submission queries use query objects to track the number of vertices and
2055bd8deadSopenharmony_ci    primitives that are issued to the GL using draw commands.
2065bd8deadSopenharmony_ci
2075bd8deadSopenharmony_ci    When BeginQuery is called with a target of VERTICES_SUBMITTED_ARB, the
2085bd8deadSopenharmony_ci    submitted vertices count maintained by the GL is set to zero. When a
2095bd8deadSopenharmony_ci    vertices submitted query is active, the submitted vertices count is
2105bd8deadSopenharmony_ci    incremented every time a vertex is transferred to the GL (see sections
2115bd8deadSopenharmony_ci    10.3.4, and 10.5). In case of primitive types with adjacency information
2125bd8deadSopenharmony_ci    (see sections 10.1.11 through 10.1.14) implementations may or may not
2135bd8deadSopenharmony_ci    count vertices not belonging to the main primitive. In case of line loop
2145bd8deadSopenharmony_ci    primitives implementations are allowed to count the first vertex twice
2155bd8deadSopenharmony_ci    for the purposes of VERTICES_SUBMITTED_ARB queries. Additionally,
2165bd8deadSopenharmony_ci    vertices corresponding to incomplete primitives may or may not be counted.
2175bd8deadSopenharmony_ci
2185bd8deadSopenharmony_ci    When BeginQuery is called with a target of PRIMITIVES_SUBMITTED_ARB, the
2195bd8deadSopenharmony_ci    submitted primitives count maintained by the GL is set to zero. When a
2205bd8deadSopenharmony_ci    primitives submitted query is active, the submitted primitives count is
2215bd8deadSopenharmony_ci    incremented every time a point, line, triangle, or patch primitive is
2225bd8deadSopenharmony_ci    transferred to the GL (see sections 10.1, 10.3.5, and 10.5). Restarting
2235bd8deadSopenharmony_ci    a primitive topology using the primitive restart index has no effect on
2245bd8deadSopenharmony_ci    the issued primitives count. Incomplete primitives may or may not be
2255bd8deadSopenharmony_ci    counted.
2265bd8deadSopenharmony_ci
2275bd8deadSopenharmony_ciAdditions to Chapter 11 of the OpenGL 4.4 (Core Profile) Specification (Programmable Vertex Processing)
2285bd8deadSopenharmony_ci
2295bd8deadSopenharmony_ci    Modify Section 11.1.3, Shader Execution
2305bd8deadSopenharmony_ci
2315bd8deadSopenharmony_ci    (add after bullet list on p. 352)
2325bd8deadSopenharmony_ci
2335bd8deadSopenharmony_ci    Implementations are allowed to skip the execution of certain shader
2345bd8deadSopenharmony_ci    invocations, and to execute additional shader invocations for any shader
2355bd8deadSopenharmony_ci    type during programmable vertex processing due to implementation dependent
2365bd8deadSopenharmony_ci    reasons, including the execution of shader invocations that don't have an
2375bd8deadSopenharmony_ci    active program object present for the particular shader stage, as long as
2385bd8deadSopenharmony_ci    the results of rendering otherwise remain unchanged.
2395bd8deadSopenharmony_ci
2405bd8deadSopenharmony_ci    Add new Section after 11.1.3, Shader Execution
2415bd8deadSopenharmony_ci
2425bd8deadSopenharmony_ci    11.1.4 Vertex Shader Queries
2435bd8deadSopenharmony_ci
2445bd8deadSopenharmony_ci    Vertex shader queries use query objects to track the number of vertex
2455bd8deadSopenharmony_ci    shader invocations.
2465bd8deadSopenharmony_ci
2475bd8deadSopenharmony_ci    When BeginQuery is called with a target of VERTEX_SHADER_INVOCATIONS_ARB,
2485bd8deadSopenharmony_ci    the vertex shader invocations count maintained by the GL is set to zero.
2495bd8deadSopenharmony_ci    When a vertex shader invocations query is active, the counter is
2505bd8deadSopenharmony_ci    incremented every time the vertex shader is invoked (see section 11.1).
2515bd8deadSopenharmony_ci
2525bd8deadSopenharmony_ci    The result of vertex shader queries may be implementation dependent due
2535bd8deadSopenharmony_ci    to reasons described in section 11.1.3.
2545bd8deadSopenharmony_ci
2555bd8deadSopenharmony_ci    Add new Section after 11.2.3, Tessellation Evaluation Shaders
2565bd8deadSopenharmony_ci
2575bd8deadSopenharmony_ci    11.2.4 Tessellation Shader Queries
2585bd8deadSopenharmony_ci
2595bd8deadSopenharmony_ci    Tessellation shader queries use query objects to track the number of
2605bd8deadSopenharmony_ci    tessellation control shader and tessellation evaluation shader invocations.
2615bd8deadSopenharmony_ci
2625bd8deadSopenharmony_ci    When BeginQuery is called with a target of TESS_CONTROL_SHADER_PATCHES_ARB,
2635bd8deadSopenharmony_ci    the tessellation control shader patches count maintained by the GL is set
2645bd8deadSopenharmony_ci    to zero. When a tessellation control shader patches query is active, the
2655bd8deadSopenharmony_ci    counter is incremented every time a patch is processed by the tessellation
2665bd8deadSopenharmony_ci    control shader stage (see section 11.2.1).
2675bd8deadSopenharmony_ci
2685bd8deadSopenharmony_ci    When BeginQuery is called with a target of TESS_EVALUATION_SHADER_-
2695bd8deadSopenharmony_ci    INVOCATIONS_ARB, the tessellation evaluation shader invocations count
2705bd8deadSopenharmony_ci    maintained by the GL is set to zero. When a tessellation evaluation shader
2715bd8deadSopenharmony_ci    invocations query is active, the counter is incremented every time the
2725bd8deadSopenharmony_ci    tessellation evaluation shader is invoked (see section 11.2.3).
2735bd8deadSopenharmony_ci
2745bd8deadSopenharmony_ci    The result of tessellation shader queries may be implementation dependent
2755bd8deadSopenharmony_ci    due to reasons described in section 11.1.3.
2765bd8deadSopenharmony_ci
2775bd8deadSopenharmony_ci    Add new Section after 11.3.4, Geometry Shader Execution Environment
2785bd8deadSopenharmony_ci
2795bd8deadSopenharmony_ci    11.3.5 Geometry Shader Queries
2805bd8deadSopenharmony_ci
2815bd8deadSopenharmony_ci    Geometry shader queries use query objects to track the number of geometry
2825bd8deadSopenharmony_ci    shader invocations and the number of primitives those emitted.
2835bd8deadSopenharmony_ci
2845bd8deadSopenharmony_ci    When BeginQuery is called with a target of GEOMETRY_SHADER_INVOCATIONS,
2855bd8deadSopenharmony_ci    the geometry shader invocations count maintained by the GL is set to zero.
2865bd8deadSopenharmony_ci    When a geometry shader invocations query is active, the counter is
2875bd8deadSopenharmony_ci    incremented every time the geometry shader is invoked (see section 11.3).
2885bd8deadSopenharmony_ci    In case of instanced geometry shaders (see section 11.3.4.2) the geometry
2895bd8deadSopenharmony_ci    shader invocations count is incremented for each separate instanced
2905bd8deadSopenharmony_ci    invocation.
2915bd8deadSopenharmony_ci
2925bd8deadSopenharmony_ci    When BeginQuery is called with a target of GEOMETRY_SHADER_PRIMITIVES_-
2935bd8deadSopenharmony_ci    EMITTED_ARB, the geometry shader output primitives count maintained by the
2945bd8deadSopenharmony_ci    GL is set to zero. When a geometry shader primitives emitted query is
2955bd8deadSopenharmony_ci    active, the counter is incremented every time the geometry shader emits
2965bd8deadSopenharmony_ci    a primitive to a vertex stream. Implementations may or may not count
2975bd8deadSopenharmony_ci    primitives emitted to a vertex stream that isn't further processed by the
2985bd8deadSopenharmony_ci    GL (see section 11.3.2). Restarting primitive topology using the shading
2995bd8deadSopenharmony_ci    language built-in functions EndPrimitive or EndStreamPrimitive does not
3005bd8deadSopenharmony_ci    increment the geometry shader output primitives count.
3015bd8deadSopenharmony_ci
3025bd8deadSopenharmony_ci    The result of geometry shader queries may be implementation dependent due
3035bd8deadSopenharmony_ci    to reasons described in section 11.1.3.
3045bd8deadSopenharmony_ci
3055bd8deadSopenharmony_ciAdditions to Chapter 13 of the OpenGL 4.4 (Core Profile) Specification (Fixed-Function Vertex Post-Processing)
3065bd8deadSopenharmony_ci
3075bd8deadSopenharmony_ci    Modify Section 13.5, Primitive Clipping
3085bd8deadSopenharmony_ci
3095bd8deadSopenharmony_ci    (add new paragraph before the last paragraph of the section on p. 405)
3105bd8deadSopenharmony_ci
3115bd8deadSopenharmony_ci    Implementations are allowed to pass incoming primitives unchanged and to
3125bd8deadSopenharmony_ci    output multiple primitives for an incoming primitive due to implementation
3135bd8deadSopenharmony_ci    dependent reasons as long as the results of rendering otherwise remain
3145bd8deadSopenharmony_ci    unchanged.
3155bd8deadSopenharmony_ci
3165bd8deadSopenharmony_ci    Add new Section after 13.5.1, Clipping Shader Outputs
3175bd8deadSopenharmony_ci
3185bd8deadSopenharmony_ci    13.5.2 Primitive Clipping Queries
3195bd8deadSopenharmony_ci
3205bd8deadSopenharmony_ci    Primitive clipping queries use query objects to track the number of
3215bd8deadSopenharmony_ci    primitives that are processed by the primitive clipping stage and the
3225bd8deadSopenharmony_ci    number of primitives that are output by the primitive clipping stage and
3235bd8deadSopenharmony_ci    are further processed by the rasterization stage.
3245bd8deadSopenharmony_ci
3255bd8deadSopenharmony_ci    When BeginQuery is called with a target of CLIPPING_INPUT_PRIMITIVES_ARB,
3265bd8deadSopenharmony_ci    the clipping input primitives count maintained by the GL is set to zero.
3275bd8deadSopenharmony_ci    When a clipping input primitives query is active, the counter is
3285bd8deadSopenharmony_ci    incremented every time a primitive reaches the primitive clipping stage
3295bd8deadSopenharmony_ci    (see section 13.5).
3305bd8deadSopenharmony_ci
3315bd8deadSopenharmony_ci    When BeginQuery is called with a target of CLIPPING_OUTPUT_PRIMITIVES_ARB,
3325bd8deadSopenharmony_ci    the clipping output primitives count maintained by the GL is set to zero.
3335bd8deadSopenharmony_ci    When a clipping output primitives query is active, the counter is
3345bd8deadSopenharmony_ci    incremented every time a primitive passes the primitive clipping stage.
3355bd8deadSopenharmony_ci    The actual number of primitives output by the primitive clipping stage for
3365bd8deadSopenharmony_ci    a particular input primitive is implementation dependent (see section 13.5)
3375bd8deadSopenharmony_ci    but must satisfy the following conditions:
3385bd8deadSopenharmony_ci
3395bd8deadSopenharmony_ci      * If at least one vertex of the input primitive lies inside the clipping
3405bd8deadSopenharmony_ci        volume, the counter is incremented by one or more.
3415bd8deadSopenharmony_ci
3425bd8deadSopenharmony_ci      * Otherwise, the counter is incremented by zero or more.
3435bd8deadSopenharmony_ci
3445bd8deadSopenharmony_ci    If RASTERIZER_DISCARD is enabled, implementations are allowed to discard
3455bd8deadSopenharmony_ci    primitives right after the optional transform feedback state (see Section
3465bd8deadSopenharmony_ci    14.1). As a result, if RASTERIZER_DISCARD is enabled, the clipping input
3475bd8deadSopenharmony_ci    and output primitives count may not be incremented.
3485bd8deadSopenharmony_ci
3495bd8deadSopenharmony_ciAdditions to Chapter 15 of the OpenGL 4.4 (Core Profile) Specification (Programmable Fragment Processing)
3505bd8deadSopenharmony_ci
3515bd8deadSopenharmony_ci    Modify Section 15.2, Shader Execution
3525bd8deadSopenharmony_ci
3535bd8deadSopenharmony_ci    (add after first paragraph on p. 434)
3545bd8deadSopenharmony_ci
3555bd8deadSopenharmony_ci    Implementations are allowed to skip the execution of certain fragment
3565bd8deadSopenharmony_ci    shader invocations, and to execute additional fragment shader invocations
3575bd8deadSopenharmony_ci    during programmable fragment processing due to implementation dependent
3585bd8deadSopenharmony_ci    reasons, including the execution of fragment shader invocations when there
3595bd8deadSopenharmony_ci    isn't an active program object present for the fragment shader stage, as
3605bd8deadSopenharmony_ci    long as the results of rendering otherwise remain unchanged.
3615bd8deadSopenharmony_ci
3625bd8deadSopenharmony_ci    Add new Section after 15.2, Shader Execution
3635bd8deadSopenharmony_ci
3645bd8deadSopenharmony_ci    15.3 Fragment Shader Queries
3655bd8deadSopenharmony_ci
3665bd8deadSopenharmony_ci    Fragment shader queries use query objects to track the number of fragment
3675bd8deadSopenharmony_ci    shader invocations.
3685bd8deadSopenharmony_ci
3695bd8deadSopenharmony_ci    When BeginQuery is called with a target of FRAGMENT_SHADER_INVOCATIONS_ARB,
3705bd8deadSopenharmony_ci    the fragment shader invocations count maintained by the GL is set to zero.
3715bd8deadSopenharmony_ci    When a fragment shader invocations query is active, the counter is
3725bd8deadSopenharmony_ci    incremented every time the fragment shader is invoked (see section 15.2).
3735bd8deadSopenharmony_ci
3745bd8deadSopenharmony_ci    The result of fragment shader queries may be implementation dependent due
3755bd8deadSopenharmony_ci    to reasons described in section 15.2.
3765bd8deadSopenharmony_ci
3775bd8deadSopenharmony_ciAdditions to Chapter 19 of the OpenGL 4.4 (Core Profile) Specification (Compute Shaders)
3785bd8deadSopenharmony_ci
3795bd8deadSopenharmony_ci    Add new Section after 19.1, Compute Shader Variables
3805bd8deadSopenharmony_ci
3815bd8deadSopenharmony_ci    19.2 Compute Shader Queries
3825bd8deadSopenharmony_ci
3835bd8deadSopenharmony_ci    Compute shader queries use query objects to track the number of compute
3845bd8deadSopenharmony_ci    shader invocations.
3855bd8deadSopenharmony_ci
3865bd8deadSopenharmony_ci    When BeginQuery is called with a target of COMPUTE_SHADER_INVOCATIONS_ARB,
3875bd8deadSopenharmony_ci    the compute shader invocations count maintained by the GL is set to zero.
3885bd8deadSopenharmony_ci    When a compute shader invocations query is active, the counter is
3895bd8deadSopenharmony_ci    incremented every time the compute shader is invoked (see chapter 19).
3905bd8deadSopenharmony_ci
3915bd8deadSopenharmony_ci    Implementations are allowed to skip the execution of certain compute
3925bd8deadSopenharmony_ci    shader invocations, and to execute additional compute shader invocations
3935bd8deadSopenharmony_ci    due to implementation dependent reasons as long as the results of
3945bd8deadSopenharmony_ci    rendering otherwise remain unchanged.
3955bd8deadSopenharmony_ci
3965bd8deadSopenharmony_ciAdditions to the AGL/EGL/GLX/WGL Specifications
3975bd8deadSopenharmony_ci
3985bd8deadSopenharmony_ci    None.
3995bd8deadSopenharmony_ci
4005bd8deadSopenharmony_ciDependencies on OpenGL 3.2 and ARB_geometry_shader4
4015bd8deadSopenharmony_ci
4025bd8deadSopenharmony_ci    If OpenGL 3.2 and ARB_geometry_shader4 are not supported then remove all
4035bd8deadSopenharmony_ci    references to GEOMETRY_SHADER_INVOCATIONS and
4045bd8deadSopenharmony_ci    GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB.
4055bd8deadSopenharmony_ci
4065bd8deadSopenharmony_ciDependencies on OpenGL 4.0 and ARB_gpu_shader5
4075bd8deadSopenharmony_ci
4085bd8deadSopenharmony_ci    If OpenGL 4.0 and ARB_gpu_shader5 are not supported then rename
4095bd8deadSopenharmony_ci    GEOMETRY_SHADER_INVOCATIONS to GEOMETRY_SHADER_INVOCATIONS_ARB.
4105bd8deadSopenharmony_ci
4115bd8deadSopenharmony_ciDependencies on OpenGL 4.0 and ARB_tessellation_shader
4125bd8deadSopenharmony_ci
4135bd8deadSopenharmony_ci    If OpenGL 4.0 and ARB_tessellation_shader are not supported then remove
4145bd8deadSopenharmony_ci    all references to TESS_CONTROL_SHADER_PATCHES_ARB and
4155bd8deadSopenharmony_ci    TESS_EVALUATION_SHADER_INVOCATIONS_ARB.
4165bd8deadSopenharmony_ci
4175bd8deadSopenharmony_ciDependencies on OpenGL 4.3 and ARB_compute_shader
4185bd8deadSopenharmony_ci
4195bd8deadSopenharmony_ci    If OpenGL 4.3 and ARB_compute_shader are not supported then remove all
4205bd8deadSopenharmony_ci    references to COMPUTE_SHADER_INVOCATIONS_ARB.
4215bd8deadSopenharmony_ci
4225bd8deadSopenharmony_ciDependencies on AMD_transform_feedback4
4235bd8deadSopenharmony_ci
4245bd8deadSopenharmony_ci    If AMD_transform_feedback4 is supported then GEOMETRY_SHADER_PRIMITIVES_-
4255bd8deadSopenharmony_ci    EMITTED_ARB counts primitives emitted to any of the vertex streams for
4265bd8deadSopenharmony_ci    which STREAM_RASTERIZATION_AMD is enabled.
4275bd8deadSopenharmony_ci
4285bd8deadSopenharmony_ciNew State
4295bd8deadSopenharmony_ci
4305bd8deadSopenharmony_ci    Modify Table 23.74, Miscellaneous
4315bd8deadSopenharmony_ci
4325bd8deadSopenharmony_ci    (update the state table to cover the new query types on p. 599)
4335bd8deadSopenharmony_ci
4345bd8deadSopenharmony_ci    Get Value      Type   Get Command  Initial Value  Description                Sec.
4355bd8deadSopenharmony_ci    -------------  -----  -----------  -------------  -------------------------  -----
4365bd8deadSopenharmony_ci    CURRENT_QUERY  18xZ+  GetQueryiv         0        Active query object names  4.2.1
4375bd8deadSopenharmony_ci
4385bd8deadSopenharmony_ciNew Implementation Dependent State
4395bd8deadSopenharmony_ci
4405bd8deadSopenharmony_ci    Modify Table 23.69, Implementation Dependent Values
4415bd8deadSopenharmony_ci
4425bd8deadSopenharmony_ci    (update the state table to cover the new query types on p. 594)
4435bd8deadSopenharmony_ci
4445bd8deadSopenharmony_ci    Get Value           Type   Get Command  Minimum Value   Description         Sec.
4455bd8deadSopenharmony_ci    ------------------  -----  -----------  --------------  ------------------  -----
4465bd8deadSopenharmony_ci    QUERY_COUNTER_BITS  18xZ+  GetQueryiv   see sec. 4.2.1  Asynchronous query  4.1.1
4475bd8deadSopenharmony_ci                                                            counter bits
4485bd8deadSopenharmony_ci
4495bd8deadSopenharmony_ciIssues
4505bd8deadSopenharmony_ci
4515bd8deadSopenharmony_ci    (1) Why is this extension necessary?
4525bd8deadSopenharmony_ci
4535bd8deadSopenharmony_ci      RESOLVED: A competing graphics API supports this feature. This extension
4545bd8deadSopenharmony_ci      will allow one to easier implement that API's features on top of OpenGL.
4555bd8deadSopenharmony_ci      Also, this feature could be useful for profiling tools and debuggers.
4565bd8deadSopenharmony_ci
4575bd8deadSopenharmony_ci    (2) Should a single query (such as GL_PIPELINE_STATISTICS) return all the
4585bd8deadSopenharmony_ci        statistics in an 11-field record or should there be separate queries?
4595bd8deadSopenharmony_ci
4605bd8deadSopenharmony_ci      DISCUSSION:
4615bd8deadSopenharmony_ci
4625bd8deadSopenharmony_ci      Single query: Returning 11 values in one query may be trouble if we want
4635bd8deadSopenharmony_ci      to extend the set of statistics in the future. It would probably require
4645bd8deadSopenharmony_ci      defining a whole new query. Also, if someone is only interested in one
4655bd8deadSopenharmony_ci      or two queries there may be overhead in querying all the statistics at
4665bd8deadSopenharmony_ci      once. Also, the interaction with GL_ARB_query_buffer_object is not
4675bd8deadSopenharmony_ci      clear. Would all 11 values be written to the buffer or would we define a
4685bd8deadSopenharmony_ci      set of 11 enumerants to specify which value is queried?
4695bd8deadSopenharmony_ci
4705bd8deadSopenharmony_ci      Multiple queries: Defining 11 separate queries is straight-forward.
4715bd8deadSopenharmony_ci      But if the underlying hardware is designed to collect the whole set of
4725bd8deadSopenharmony_ci      statistics, it may be inefficient to support separate queries.
4735bd8deadSopenharmony_ci
4745bd8deadSopenharmony_ci      RESOLVED: Define 11 separate queries to avoid problems with future
4755bd8deadSopenharmony_ci      statistic queries.
4765bd8deadSopenharmony_ci
4775bd8deadSopenharmony_ci    (3) Can the result of pipeline statistic queries be used for conditional
4785bd8deadSopenharmony_ci        rendering?
4795bd8deadSopenharmony_ci
4805bd8deadSopenharmony_ci      DISCUSSION: It doesn't make sense if one query of 11 values is used.
4815bd8deadSopenharmony_ci      It could make sense if there are 11 separate queries.  But is there
4825bd8deadSopenharmony_ci      a legitimate use case for this?  D3D10 doesn't allow this.
4835bd8deadSopenharmony_ci
4845bd8deadSopenharmony_ci      RESOLVED: No.
4855bd8deadSopenharmony_ci
4865bd8deadSopenharmony_ci    (4) Should pipeline statistics use the glBegin/EndQuery() interface or
4875bd8deadSopenharmony_ci        the glQueryCounter() interface?
4885bd8deadSopenharmony_ci
4895bd8deadSopenharmony_ci      DISCUSSION: The glBegin/EndQuery interface matches what D3D10 uses.
4905bd8deadSopenharmony_ci      To count the statistics between points A and B with glQueryCounter()
4915bd8deadSopenharmony_ci      one would query the statistic counter at point A and again at point B
4925bd8deadSopenharmony_ci      and compute the difference. A problem with this approach is that the
4935bd8deadSopenharmony_ci      statistic counters would always have to be running because we wouldn't
4945bd8deadSopenharmony_ci      know when they might be queried. That could be inefficient/inconvenient.
4955bd8deadSopenharmony_ci
4965bd8deadSopenharmony_ci      RESOLVED: Use the glBegin/EndQuery interface.
4975bd8deadSopenharmony_ci
4985bd8deadSopenharmony_ci    (5) How accurate should the statistics be?
4995bd8deadSopenharmony_ci
5005bd8deadSopenharmony_ci      RESOLVED: None of the statistics have to be exact, thus implementations
5015bd8deadSopenharmony_ci      might return slightly different results for any of them.
5025bd8deadSopenharmony_ci
5035bd8deadSopenharmony_ci    (6) What should this extension be called?
5045bd8deadSopenharmony_ci
5055bd8deadSopenharmony_ci      DISCUSSION: This extension provides similar functionality to that of
5065bd8deadSopenharmony_ci      D3D's pipeline statistics queries thus it makes sense to call this
5075bd8deadSopenharmony_ci      extension similarly (even though there is a separate classification of
5085bd8deadSopenharmony_ci      the individual queries in this specification).
5095bd8deadSopenharmony_ci
5105bd8deadSopenharmony_ci      RESOLVED: ARB_pipeline_statistics_query.
5115bd8deadSopenharmony_ci
5125bd8deadSopenharmony_ci    (7) Can multiple pipeline statistics queries be active at the same time?
5135bd8deadSopenharmony_ci
5145bd8deadSopenharmony_ci      RESOLVED: Yes, as long as they have different targets. Otherwise it is
5155bd8deadSopenharmony_ci      an error.
5165bd8deadSopenharmony_ci
5175bd8deadSopenharmony_ci    (8) What stage the VERTICES_SUBMITTED_ARB and PRIMITIVES_SUBMITTED_ARB
5185bd8deadSopenharmony_ci        belong to? What do they count?
5195bd8deadSopenharmony_ci
5205bd8deadSopenharmony_ci      DISCUSSION: There is no separate pipeline stage introduced in the
5215bd8deadSopenharmony_ci      specification that matches D3D's "input assembler" stage. While the
5225bd8deadSopenharmony_ci      latest version of the GL specification mentions a "vertex puller" stage
5235bd8deadSopenharmony_ci      in the pipeline diagram, this stage does not have a corresponding
5245bd8deadSopenharmony_ci      chapter in the specification that introduces it.
5255bd8deadSopenharmony_ci
5265bd8deadSopenharmony_ci      RESOLVED: Introduce VERTICES_SUBMITTED_ARB and PRIMITIVES_SUBMITTED_ARB
5275bd8deadSopenharmony_ci      in chapter 10, Vertex Specification and Drawing Command. They count the
5285bd8deadSopenharmony_ci      total number of vertices and primitives processed by the GL. Including
5295bd8deadSopenharmony_ci      multiple instances.
5305bd8deadSopenharmony_ci
5315bd8deadSopenharmony_ci    (9) What does 'number of primitives' mean in case of PRIMITIVES_SUBMITTED_-
5325bd8deadSopenharmony_ci        ARB, GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB, CLIPPING_INPUT_-
5335bd8deadSopenharmony_ci        PRIMITIVES_ARB, and CLIPPING_OUTPUT_PRIMITIVES_ARB queries?
5345bd8deadSopenharmony_ci
5355bd8deadSopenharmony_ci      DISCUSSION: The specification heavily overloaded the term primitive.
5365bd8deadSopenharmony_ci      E.g. a triangle strip is considered a primitive type and primitive index
5375bd8deadSopenharmony_ci      is meant to restart the 'primitive', however, on the other hand,
5385bd8deadSopenharmony_ci      gl_PrimitiveID is incremented for each individual triangle of a triangle
5395bd8deadSopenharmony_ci      strip and despite a geometry shader operates on primitives, it works
5405bd8deadSopenharmony_ci      also on the indivudal triangles of a triangle strip.
5415bd8deadSopenharmony_ci
5425bd8deadSopenharmony_ci      RESOLVED: The number of individual points, lines, triangles, or patches
5435bd8deadSopenharmony_ci      are counted (or polygons, in case of CLIPPING_OUTPUT_PRIMTIIVES_ARB).
5445bd8deadSopenharmony_ci
5455bd8deadSopenharmony_ci    (10) Why doesn't GEOMETRY_SHADER_INVOCATIONS have an ARB suffix?
5465bd8deadSopenharmony_ci
5475bd8deadSopenharmony_ci      RESOLVED: We reuse the existing token introduced by ARB_gpu_shader5 that
5485bd8deadSopenharmony_ci      was previously only accepted by GetProgramiv and meant to return the
5495bd8deadSopenharmony_ci      invocation count of instanced geometry shaders.
5505bd8deadSopenharmony_ci
5515bd8deadSopenharmony_ci    (11) What does GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB count? How is it
5525bd8deadSopenharmony_ci         different than PRIMITIVES_GENERATED?
5535bd8deadSopenharmony_ci
5545bd8deadSopenharmony_ci      RESOLVED: GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB counts primitives that
5555bd8deadSopenharmony_ci      were output by the geometry shader. All vertex streams are considered,
5565bd8deadSopenharmony_ci      but implementations are allowed to not count primitives that aren't
5575bd8deadSopenharmony_ci      further processed by the GL. If no goemetry shader is present then the
5585bd8deadSopenharmony_ci      counter may or may not be incremented.
5595bd8deadSopenharmony_ci
5605bd8deadSopenharmony_ci    (12) What does CLIPPING_INPUT_PRIMITIVES_ARB count?
5615bd8deadSopenharmony_ci
5625bd8deadSopenharmony_ci      RESOLVED: The number of primitives that reach the primitive clipping
5635bd8deadSopenharmony_ci      stage. However, see issue (13) for more details.
5645bd8deadSopenharmony_ci
5655bd8deadSopenharmony_ci    (13) What is the result of a CLIPPING_INPUT_PRIMITIVES_ARB query in case
5665bd8deadSopenharmony_ci         RASTERIZER_DISCARD is enabled?
5675bd8deadSopenharmony_ci
5685bd8deadSopenharmony_ci      DISCUSSION: Currently RASTERIZER_DISCARD is specified to be happening
5695bd8deadSopenharmony_ci      after primitive clipping, however, some implementations might discard
5705bd8deadSopenharmony_ci      primitives right after the transform feedback stage if RASTERIZER_DISCARD
5715bd8deadSopenharmony_ci      is enabled. This is perfectly legal from a spec point of view, as none
5725bd8deadSopenharmony_ci      of the vertex post-processing operations after transform feedback have
5735bd8deadSopenharmony_ci      any effect if RASTERIZER_DISCARD is enabled.
5745bd8deadSopenharmony_ci
5755bd8deadSopenharmony_ci      RESOLVED: Allow implementations to not count clipping input and output
5765bd8deadSopenharmony_ci      primitives if RASTERIZER_DISCARD is enabled.
5775bd8deadSopenharmony_ci
5785bd8deadSopenharmony_ci    (14) What does CLIPPING_OUTPUT_PRIMITIVES_ARB count?
5795bd8deadSopenharmony_ci
5805bd8deadSopenharmony_ci      DISCUSSION: The specification defines primitive clipping as an operation
5815bd8deadSopenharmony_ci      on points, lines, or polygons. Points and lines are of no interest as
5825bd8deadSopenharmony_ci      they always generate at most one output primitive even if clipped.
5835bd8deadSopenharmony_ci      On the other hand, according to the specification, triangles are handled
5845bd8deadSopenharmony_ci      as polygons and in case clipping happens new vertices are added to the
5855bd8deadSopenharmony_ci      polygon but it still remains a single polygon.
5865bd8deadSopenharmony_ci
5875bd8deadSopenharmony_ci      Actual hardware, on the other hand, is likely to support only triangle
5885bd8deadSopenharmony_ci      rasterization so in these cases each vertex added due to clipping
5895bd8deadSopenharmony_ci      implies the generation of another triangle.
5905bd8deadSopenharmony_ci
5915bd8deadSopenharmony_ci      Also, the specification defines primitive clipping to be water-tight,
5925bd8deadSopenharmony_ci      i.e. in theory hardware should always clip primitives that have one of
5935bd8deadSopenharmony_ci      their vertices fall out of any of the clip planes. In practice, however,
5945bd8deadSopenharmony_ci      this can be fairly sub-optimal as primitive clipping can be way more
5955bd8deadSopenharmony_ci      expensive than if the non-visible parts of the primitives would be
5965bd8deadSopenharmony_ci      discarded at e.g. the pixel ownership test, so hardware often uses
5975bd8deadSopenharmony_ci      guardbands that allow some primitives to pass through the clipper
5985bd8deadSopenharmony_ci      unchanged even though they partially fall outside of the clip volume.
5995bd8deadSopenharmony_ci
6005bd8deadSopenharmony_ci      All of these hardware optimizations are legal from the specification's
6015bd8deadSopenharmony_ci      point of view, but make it difficult to define the meaning of this new
6025bd8deadSopenharmony_ci      counter without introducing severe restrictions to how a GL
6035bd8deadSopenharmony_ci      implementation should handle certain cases.
6045bd8deadSopenharmony_ci
6055bd8deadSopenharmony_ci      RESOLVED: Define CLIPPING_OUTPUT_PRIMITIVES_ARB so that they count
6065bd8deadSopenharmony_ci      the actual number of primitives output by the primitive clipping stage
6075bd8deadSopenharmony_ci      by the implemenation, which might include primitives output for
6085bd8deadSopenharmony_ci      implementation dependent reasons. The only guarantees on the number
6095bd8deadSopenharmony_ci      of output primitives are the following:
6105bd8deadSopenharmony_ci
6115bd8deadSopenharmony_ci      * If at least one vertex of the primitive lies inside the clipping
6125bd8deadSopenharmony_ci        volume, the counter is incremented by one or more.
6135bd8deadSopenharmony_ci      * Otherwise, the counter is incremented by zero or more.
6145bd8deadSopenharmony_ci
6155bd8deadSopenharmony_ci    (15) Do we need to add any language to discuss why certain shader
6165bd8deadSopenharmony_ci         invocation counts might not match the "expected" values in practice?
6175bd8deadSopenharmony_ci
6185bd8deadSopenharmony_ci      DISCUSSION: Implementations might be able to do optimizations that
6195bd8deadSopenharmony_ci      allow avoiding the execution of certain invocations in some
6205bd8deadSopenharmony_ci      circumstances while also might need "helper" invocations in other cases.
6215bd8deadSopenharmony_ci
6225bd8deadSopenharmony_ci      RESOLVED: Add language to describe that such behavior is allowed as long
6235bd8deadSopenharmony_ci      as the results of the rendering otherwise remain unchanged.
6245bd8deadSopenharmony_ci
6255bd8deadSopenharmony_ci    (16) What should be the result of VERTEX_SHADER_INVOCATIONS_ARB,
6265bd8deadSopenharmony_ci         TESS_CONTROL_SHADER_PATCHES_ARB, TESS_EVALUATION_SHADER_-
6275bd8deadSopenharmony_ci         INVOCATIONS_ARB, GEOMETRY_SHADER_INVOCATIONS, FRAGMENT_SHADER_-
6285bd8deadSopenharmony_ci         INVOCATIONS_ARB and COMPUTE_SHADER_INVOCATIONS_ARB if the current
6295bd8deadSopenharmony_ci         program does not contain a shader of the appropriate type?
6305bd8deadSopenharmony_ci
6315bd8deadSopenharmony_ci      DISCUSSION: D3D is vague about the exact specification of this scenario,
6325bd8deadSopenharmony_ci      except that it explicitly allows geometry shader invocations count to
6335bd8deadSopenharmony_ci      increment also if there is no geometry shader.
6345bd8deadSopenharmony_ci
6355bd8deadSopenharmony_ci      In case of OpenGL, however, the programmable fragment processing stage
6365bd8deadSopenharmony_ci      is undefined if there is no fragment shader in the current program. This
6375bd8deadSopenharmony_ci      is because some implementations might require to run a fragment shader
6385bd8deadSopenharmony_ci      even if the application developer does not need one.
6395bd8deadSopenharmony_ci
6405bd8deadSopenharmony_ci      RESOLVED: Add language to describe that implementations are allowed to
6415bd8deadSopenharmony_ci      increment these counters even if there isn't a current program for the
6425bd8deadSopenharmony_ci      particular shader stage.
6435bd8deadSopenharmony_ci
6445bd8deadSopenharmony_ci    (17) Due to the introduction of a lot of new query types the error section
6455bd8deadSopenharmony_ci         of query object related commands like BeginQueryIndexed,
6465bd8deadSopenharmony_ci         EndQueryIndexed and GetQueryIndexediv became pretty bloated.
6475bd8deadSopenharmony_ci         Shouldn't we introduce some new tables for indexed and non-indexed
6485bd8deadSopenharmony_ci         query types and reference those in the error sections instead?
6495bd8deadSopenharmony_ci
6505bd8deadSopenharmony_ci      RESOLVED: Probably, but not as part of this extension.
6515bd8deadSopenharmony_ci
6525bd8deadSopenharmony_ci    (18) What are VERTEX_SHADER_INVOCATIONS_ARB queries useful for?
6535bd8deadSopenharmony_ci
6545bd8deadSopenharmony_ci      DISCUSSION: In most cases VERTEX_SHADER_INVOCATIONS_ARB queries are
6555bd8deadSopenharmony_ci      likely to return the same results as VERTICES_SUBMITTED_ARB queries.
6565bd8deadSopenharmony_ci      However, implementations are allowed to perform optimizations that
6575bd8deadSopenharmony_ci      enable avoiding the re-processing of the same vertex in case of an
6585bd8deadSopenharmony_ci      indexed draw command. This is often referred to as vertex reuse or
6595bd8deadSopenharmony_ci      post-transform vertex cache optimization. In case such optimizations
6605bd8deadSopenharmony_ci      are applied, the number of vertex shader invocations can be smaller
6615bd8deadSopenharmony_ci      than the number of vertices issued.
6625bd8deadSopenharmony_ci
6635bd8deadSopenharmony_ci      RESOLVED: They can be used together with VERTICES_SUBMITTED_ARB queries
6645bd8deadSopenharmony_ci      to analyze how efficiently the index ordering takes advantage of the
6655bd8deadSopenharmony_ci      post-transform vertex cache.
6665bd8deadSopenharmony_ci
6675bd8deadSopenharmony_ci    (19) Does GEOMETRY_SHADER_INVOCATIONS queries account for instanced
6685bd8deadSopenharmony_ci         geometry shaders?
6695bd8deadSopenharmony_ci
6705bd8deadSopenharmony_ci      RESOLVED: Yes, GEOMETRY_SHADER_INVOCATIONS queries count the total
6715bd8deadSopenharmony_ci      number of geometry shader executions, including individual invocations
6725bd8deadSopenharmony_ci      of an instanced geometry shader.
6735bd8deadSopenharmony_ci
6745bd8deadSopenharmony_ci    (20) What are CLIPPING_INPUT_PRIMITIVES_ARB and CLIPPING_OUTPUT_-
6755bd8deadSopenharmony_ci         PRIMITIVES_ARB queries useful for?
6765bd8deadSopenharmony_ci
6775bd8deadSopenharmony_ci      RESOLVED: These two types of queries can be used together to determine a
6785bd8deadSopenharmony_ci      conservative estimate on how efficiently the primitive clipping stage is
6795bd8deadSopenharmony_ci      used. If the rasterizer primitives count is substantially lower than the
6805bd8deadSopenharmony_ci      clipper primitives count, it may indicate that too many primitives were
6815bd8deadSopenharmony_ci      tried to be rendered that ended up outside of the viewport. On the other
6825bd8deadSopenharmony_ci      hand, if the rasterizer primitives count is substantially higher than
6835bd8deadSopenharmony_ci      the clipper primitives count, it may indicate that too many primitives
6845bd8deadSopenharmony_ci      were clipped and primitive clipping might have become the bottleneck of
6855bd8deadSopenharmony_ci      the rendering pipeline.
6865bd8deadSopenharmony_ci
6875bd8deadSopenharmony_ci    (21) What are FRAGMENT_SHADER_INVOCATIONS_ARB queries useful for?
6885bd8deadSopenharmony_ci
6895bd8deadSopenharmony_ci      DISCUSSION: In many cases the hardware can perform early per-fragment
6905bd8deadSopenharmony_ci      tests which might result in the fragment shader not being executed.
6915bd8deadSopenharmony_ci      These and similar optimizations might result in a lower fragment shader
6925bd8deadSopenharmony_ci      invocation count than expected.
6935bd8deadSopenharmony_ci
6945bd8deadSopenharmony_ci      RESOLVED: They can be used to analyze how efficiently the application
6955bd8deadSopenharmony_ci      takes advantage of early per-fragment tests and other fragment shader
6965bd8deadSopenharmony_ci      optimizations.
6975bd8deadSopenharmony_ci
6985bd8deadSopenharmony_ci    (22) What is the behavior of pipeline statistics queries returning
6995bd8deadSopenharmony_ci         information about primitive counts in case of legacy primitive types
7005bd8deadSopenharmony_ci         like quads or polygons?
7015bd8deadSopenharmony_ci
7025bd8deadSopenharmony_ci      DISCUSSION: This extension is intentionally written against the core
7035bd8deadSopenharmony_ci      profile of the specification as defining the behavior of these queries
7045bd8deadSopenharmony_ci      for legacy primitive types would be either non-portable or too relaxed
7055bd8deadSopenharmony_ci      to be useful for any reasonably accurate measurement.
7065bd8deadSopenharmony_ci
7075bd8deadSopenharmony_ci      RESOLVED: Undefined, as this is a core profile extension.
7085bd8deadSopenharmony_ci
7095bd8deadSopenharmony_ci    (23) How do operations like Clear, TexSubImage, etc. affect the results of
7105bd8deadSopenharmony_ci         the newly introduced queries?
7115bd8deadSopenharmony_ci
7125bd8deadSopenharmony_ci      DISCUSSION: Implementations might require "helper" rendering commands be
7135bd8deadSopenharmony_ci      issued to implement certain operations like Clear, TexSubImage, etc.
7145bd8deadSopenharmony_ci
7155bd8deadSopenharmony_ci      RESOLVED: They don't. Only application submitted rendering commands
7165bd8deadSopenharmony_ci      should have an effect on the results of the queries.
7175bd8deadSopenharmony_ci
7185bd8deadSopenharmony_ci    (24) Should partial primitives be counted by submission queries?
7195bd8deadSopenharmony_ci
7205bd8deadSopenharmony_ci      DISCUSSION: Consider the example of calling DrawArrays with <mode>
7215bd8deadSopenharmony_ci      TRIANGLES and <count> of 8.
7225bd8deadSopenharmony_ci      Should VERTICES_SUBMITTED_ARB return 6 or 8?
7235bd8deadSopenharmony_ci      Should PRIMITIVES_SUBMITTED_ARB return 2 or 3?
7245bd8deadSopenharmony_ci
7255bd8deadSopenharmony_ci      RESOLVED: Undefined, incomplete primitives and vertices of incomplete
7265bd8deadSopenharmony_ci      primitives may or may not be counted by PRIMITIVES_SUBMITTED_ARB and
7275bd8deadSopenharmony_ci      VERTICES_SUBMITTED_ARB queries, respectively.
7285bd8deadSopenharmony_ci
7295bd8deadSopenharmony_ci    (25) What should we count in case of tessellation control shaders?
7305bd8deadSopenharmony_ci
7315bd8deadSopenharmony_ci      DISCUSSION: While OpenGL tessellation control shaders are defined to
7325bd8deadSopenharmony_ci      be invoked once per vertex, D3D defines the same shader stage to be
7335bd8deadSopenharmony_ci      executed once per patch.
7345bd8deadSopenharmony_ci
7355bd8deadSopenharmony_ci      RESOLVED: The number of patches processed by the tessellation control
7365bd8deadSopenharmony_ci      shader stage is counted.
7375bd8deadSopenharmony_ci
7385bd8deadSopenharmony_ci    (26) Should VERTICES_SUBMITTED_ARB count adjacent vertices in case of
7395bd8deadSopenharmony_ci         primitives with adjacency?
7405bd8deadSopenharmony_ci
7415bd8deadSopenharmony_ci      DISCUSSION: Implementations have different answers for this.
7425bd8deadSopenharmony_ci
7435bd8deadSopenharmony_ci      RESOLVED: Allow both. It is up to the implementation whether adjacent
7445bd8deadSopenharmony_ci      vertices are counted.
7455bd8deadSopenharmony_ci
7465bd8deadSopenharmony_ci    (27) Should VERTICES_SUBMITTED_ARB count vertices multiple times in case
7475bd8deadSopenharmony_ci         of primitive types that reuse vertices (e.g. LINE_LOOP, LINE_STRIP,
7485bd8deadSopenharmony_ci         TRIANGLE_STRIP)?
7495bd8deadSopenharmony_ci
7505bd8deadSopenharmony_ci      RESOLVED: No for strip primitives, but allow (but not require) counting
7515bd8deadSopenharmony_ci      the first vertex twice for line loop primitives.
7525bd8deadSopenharmony_ci
7535bd8deadSopenharmony_ciRevision History
7545bd8deadSopenharmony_ci
7555bd8deadSopenharmony_ci    Revision 11, 2017/07/23 (Jon Leech)
7565bd8deadSopenharmony_ci      - Replace the long list of valid <target> parameters for
7575bd8deadSopenharmony_ci        BeginQueryIndexed, EndQueryIndexed, and GetQueryIndexediv with a
7585bd8deadSopenharmony_ci        reference to the list of query targets in section 4.2 (gitlab #18).
7595bd8deadSopenharmony_ci      - Add the new query targets to those for which the <index> parameter
7605bd8deadSopenharmony_ci        of BeginQueryIndexed and GetQueryIndexediv must be zero (gitlab
7615bd8deadSopenharmony_ci        #26).
7625bd8deadSopenharmony_ci
7635bd8deadSopenharmony_ci    Revision 10, 2014/10/30 (Daniel Rakos)
7645bd8deadSopenharmony_ci      - Relaxed the behavior of VERTICES_SUBMITTED_ARB queries for primitives
7655bd8deadSopenharmony_ci        with adjacency to allow counting of adjacent vertices.
7665bd8deadSopenharmony_ci      - Relaxed the behavior of GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB queries
7675bd8deadSopenharmony_ci        to also allow counting primitives emitted to all vertex streams.
7685bd8deadSopenharmony_ci
7695bd8deadSopenharmony_ci    Revision 9, 2014/10/08 (Daniel Rakos)
7705bd8deadSopenharmony_ci      - Specified that the vertices submitted count is only incremented for
7715bd8deadSopenharmony_ci        vertices belonging to the main primitive in case of primitives with
7725bd8deadSopenharmony_ci        adjacency.
7735bd8deadSopenharmony_ci      - Relaxed the definition of VERTICES_SUBMITTED_ARB queries to allow
7745bd8deadSopenharmony_ci        implementations to count the first vertex twice for line loop
7755bd8deadSopenharmony_ci        primitives.
7765bd8deadSopenharmony_ci      - Changed the definition of GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB
7775bd8deadSopenharmony_ci        queries to only count primitives emitted to vertex streams that are
7785bd8deadSopenharmony_ci        further processed by the GL.
7795bd8deadSopenharmony_ci      - Added interaction with AMD_transform_feedback4.
7805bd8deadSopenharmony_ci
7815bd8deadSopenharmony_ci    Revision 8, 2014/06/27 (Daniel Rakos)
7825bd8deadSopenharmony_ci      - Renamed tessellation control shader query to TESS_CONTROL_SHADER_-
7835bd8deadSopenharmony_ci        PATCHES_ARB and updated language respectively.
7845bd8deadSopenharmony_ci
7855bd8deadSopenharmony_ci    Revision 7, 2014/05/09 (Daniel Rakos)
7865bd8deadSopenharmony_ci      - Resolved issue (24), updated resolution of issue (5).
7875bd8deadSopenharmony_ci
7885bd8deadSopenharmony_ci    Revision 6, 2014/05/06 (Daniel Rakos)
7895bd8deadSopenharmony_ci      - Added issue (24).
7905bd8deadSopenharmony_ci
7915bd8deadSopenharmony_ci    Revision 5, 2014/04/25 (Daniel Rakos)
7925bd8deadSopenharmony_ci      - Renamed to ARB_pipeline_statistics_query.
7935bd8deadSopenharmony_ci      - Replaced EXT suffixes with ARB ones.
7945bd8deadSopenharmony_ci      - Resolved outstanding issues and added language to the spec to explain
7955bd8deadSopenharmony_ci        these resolutions.
7965bd8deadSopenharmony_ci
7975bd8deadSopenharmony_ci    Revision 4, 2014/04/23 (Daniel Rakos)
7985bd8deadSopenharmony_ci      - Fixed some typos.
7995bd8deadSopenharmony_ci      - Renamed primitive clipping queries to CLIPPING_INPUT_PRIMITIVES_EXT
8005bd8deadSopenharmony_ci        and CLIPPING_OUTPUT_PRIMITIVES_EXT.
8015bd8deadSopenharmony_ci      - Resolved issues (2), (9), (12), (18), and (20).
8025bd8deadSopenharmony_ci      - Updated suggestions for issues (11), (13), (14), (15), and (16).
8035bd8deadSopenharmony_ci      - Added issue (23).
8045bd8deadSopenharmony_ci
8055bd8deadSopenharmony_ci    Revision 3, 2014/04/16 (Daniel Rakos)
8065bd8deadSopenharmony_ci      - Major rewrite of the spec language that clarifies in what pipeline
8075bd8deadSopenharmony_ci        stage the various queries take place and what exactly is counted.
8085bd8deadSopenharmony_ci      - Added issues (6) through (22).
8095bd8deadSopenharmony_ci      - Removed conformance testing section (a separate conformance test spec
8105bd8deadSopenharmony_ci        will be created).
8115bd8deadSopenharmony_ci      - Added state table changes.
8125bd8deadSopenharmony_ci      - Clarified dependencies on other extensions.
8135bd8deadSopenharmony_ci
8145bd8deadSopenharmony_ci    Revision 2, 2014/04/09 (Brian Paul)
8155bd8deadSopenharmony_ci      - Break the original single 11-valued query into 11 individual queries.
8165bd8deadSopenharmony_ci      - Added issues (2), (3), (4), and (5).
8175bd8deadSopenharmony_ci      - Added conformance testing section.
8185bd8deadSopenharmony_ci
8195bd8deadSopenharmony_ci    Revision 1, 2014/02/03 (Brian Paul)
8205bd8deadSopenharmony_ci      - Initial revision.
821