15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    ARB_program_interface_query
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_ARB_program_interface_query
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Pat Brown, NVIDIA (pbrown 'at' nvidia.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciContributors
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    Members of the Khronos OpenGL ARB TSG
165bd8deadSopenharmony_ci
175bd8deadSopenharmony_ciNotice
185bd8deadSopenharmony_ci
195bd8deadSopenharmony_ci    Copyright (c) 2012-2013 The Khronos Group Inc. Copyright terms at
205bd8deadSopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
215bd8deadSopenharmony_ci
225bd8deadSopenharmony_ciSpecification Update Policy
235bd8deadSopenharmony_ci
245bd8deadSopenharmony_ci    Khronos-approved extension specifications are updated in response to
255bd8deadSopenharmony_ci    issues and bugs prioritized by the Khronos OpenGL Working Group. For
265bd8deadSopenharmony_ci    extensions which have been promoted to a core Specification, fixes will
275bd8deadSopenharmony_ci    first appear in the latest version of that core Specification, and will
285bd8deadSopenharmony_ci    eventually be backported to the extension document. This policy is
295bd8deadSopenharmony_ci    described in more detail at
305bd8deadSopenharmony_ci        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ciStatus
335bd8deadSopenharmony_ci
345bd8deadSopenharmony_ci    Complete.
355bd8deadSopenharmony_ci    Approved by the ARB on 2012/06/12.
365bd8deadSopenharmony_ci
375bd8deadSopenharmony_ciVersion
385bd8deadSopenharmony_ci
395bd8deadSopenharmony_ci    Last Modified Date: January 10, 2019
405bd8deadSopenharmony_ci    Revision:           21
415bd8deadSopenharmony_ci
425bd8deadSopenharmony_ciNumber
435bd8deadSopenharmony_ci
445bd8deadSopenharmony_ci    ARB Extension #134
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ciDependencies
475bd8deadSopenharmony_ci
485bd8deadSopenharmony_ci    OpenGL 2.0 is required.
495bd8deadSopenharmony_ci
505bd8deadSopenharmony_ci    This extension is written against the OpenGL 4.2 Compatibility Profile
515bd8deadSopenharmony_ci    Specification (January 19, 2012).
525bd8deadSopenharmony_ci
535bd8deadSopenharmony_ci    OpenGL 3.0, ARB_transform_feedback, and EXT_transform_feedback affect the
545bd8deadSopenharmony_ci    definition of this extension.
555bd8deadSopenharmony_ci
565bd8deadSopenharmony_ci    OpenGL 3.1 and ARB_uniform_buffer_object affect the definition of this
575bd8deadSopenharmony_ci    extension.
585bd8deadSopenharmony_ci
595bd8deadSopenharmony_ci    OpenGL 4.0 and ARB_shader_subroutine affect the definition of this
605bd8deadSopenharmony_ci    extension.
615bd8deadSopenharmony_ci
625bd8deadSopenharmony_ci    OpenGL 4.2 and ARB_shader_atomic_counters affect the definition of this
635bd8deadSopenharmony_ci    extension.
645bd8deadSopenharmony_ci
655bd8deadSopenharmony_ci    OpenGL 4.3 and ARB_shader_storage_buffer_object affect the definition of
665bd8deadSopenharmony_ci    this extension.
675bd8deadSopenharmony_ci
685bd8deadSopenharmony_ci    OpenGL 4.3 and ARB_arrays_of_arrays affect the definition of this
695bd8deadSopenharmony_ci    extension.
705bd8deadSopenharmony_ci
715bd8deadSopenharmony_ci    OpenGL 4.3 and ARB_compute_shader affect the definition of this extension.
725bd8deadSopenharmony_ci
735bd8deadSopenharmony_ci    OpenGL 4.3 and ARB_explicit_uniform_location affect the definition of this
745bd8deadSopenharmony_ci    extension.
755bd8deadSopenharmony_ci
765bd8deadSopenharmony_ciOverview
775bd8deadSopenharmony_ci
785bd8deadSopenharmony_ci    This extension provides a single unified set of query commands that can be
795bd8deadSopenharmony_ci    used by applications to determine properties of various interfaces and
805bd8deadSopenharmony_ci    resources used by program objects to communicate with application code,
815bd8deadSopenharmony_ci    fixed-function OpenGL pipeline stages, and other programs.  In unextended
825bd8deadSopenharmony_ci    OpenGL 4.2, there is a separate set of query commands for each different
835bd8deadSopenharmony_ci    type of interface or resource used by the program.  These different sets
845bd8deadSopenharmony_ci    of queries are structured nearly identically, but the queries for some
855bd8deadSopenharmony_ci    interfaces have limited capability (e.g., there is no ability to enumerate
865bd8deadSopenharmony_ci    fragment shader outputs).
875bd8deadSopenharmony_ci
885bd8deadSopenharmony_ci    With the single set of query commands provided by this extension, a
895bd8deadSopenharmony_ci    consistent set of queries is available for all interfaces, and a new
905bd8deadSopenharmony_ci    interface can be added without having to introduce a completely new set of
915bd8deadSopenharmony_ci    query commands.  These queries are intended to provide a superset of the
925bd8deadSopenharmony_ci    capabilities provided by similar queries in OpenGL 4.2, and should allow
935bd8deadSopenharmony_ci    for the deprecation of the existing queries.
945bd8deadSopenharmony_ci
955bd8deadSopenharmony_ci    This extension defines two terms:  interfaces and active resources.  Each
965bd8deadSopenharmony_ci    interface of a program object provides a way for the program to
975bd8deadSopenharmony_ci    communicate with application code, fixed-function OpenGL pipeline stages,
985bd8deadSopenharmony_ci    and other programs.  Examples of interfaces for a program object include
995bd8deadSopenharmony_ci    inputs (receiving values from vertex attributes or outputs of other
1005bd8deadSopenharmony_ci    programs), outputs (sending values to other programs or per-fragment
1015bd8deadSopenharmony_ci    operations), uniforms (receiving values from API calls), uniform blocks
1025bd8deadSopenharmony_ci    (receiving values from bound buffer objects), subroutines and subroutine
1035bd8deadSopenharmony_ci    uniforms (receiving API calls to indicate functions to call during program
1045bd8deadSopenharmony_ci    execution), and atomic counter buffers (holding values to be manipulated
1055bd8deadSopenharmony_ci    by atomic counter shader functions).  Each interface of a program has a
1065bd8deadSopenharmony_ci    set of active resources used by the program.  For example, the resources
1075bd8deadSopenharmony_ci    of a program's input interface includes all active input variables used by
1085bd8deadSopenharmony_ci    the first stage of the program.  The resources of a program's uniform
1095bd8deadSopenharmony_ci    block interface consists of the set of uniform blocks with at least one
1105bd8deadSopenharmony_ci    member used by any shader in the program.
1115bd8deadSopenharmony_ci
1125bd8deadSopenharmony_ciIP Status
1135bd8deadSopenharmony_ci
1145bd8deadSopenharmony_ci    No known IP claims.
1155bd8deadSopenharmony_ci
1165bd8deadSopenharmony_ciNew Procedures and Functions
1175bd8deadSopenharmony_ci
1185bd8deadSopenharmony_ci      void GetProgramInterfaceiv(uint program, enum programInterface,
1195bd8deadSopenharmony_ci                                 enum pname, int *params);
1205bd8deadSopenharmony_ci      uint GetProgramResourceIndex(uint program, enum programInterface,
1215bd8deadSopenharmony_ci                                   const char *name);
1225bd8deadSopenharmony_ci      void GetProgramResourceName(uint program, enum programInterface,
1235bd8deadSopenharmony_ci                                  uint index, sizei bufSize, sizei *length,
1245bd8deadSopenharmony_ci                                  char *name);
1255bd8deadSopenharmony_ci      void GetProgramResourceiv(uint program, enum programInterface,
1265bd8deadSopenharmony_ci                                uint index, sizei propCount,
1275bd8deadSopenharmony_ci                                const enum *props, sizei bufSize,
1285bd8deadSopenharmony_ci                                sizei *length, int *params);
1295bd8deadSopenharmony_ci      int GetProgramResourceLocation(uint program, enum programInterface,
1305bd8deadSopenharmony_ci                                     const char *name);
1315bd8deadSopenharmony_ci      int GetProgramResourceLocationIndex(uint program, enum programInterface,
1325bd8deadSopenharmony_ci                                          const char *name);
1335bd8deadSopenharmony_ci
1345bd8deadSopenharmony_ciNew Tokens
1355bd8deadSopenharmony_ci
1365bd8deadSopenharmony_ci    Accepted by the <programInterface> parameter of GetProgramInterfaceiv,
1375bd8deadSopenharmony_ci    GetProgramResourceIndex, GetProgramResourceName, GetProgramResourceiv,
1385bd8deadSopenharmony_ci    GetProgramResourceLocation, and GetProgramResourceLocationIndex:
1395bd8deadSopenharmony_ci
1405bd8deadSopenharmony_ci        UNIFORM                                         0x92E1
1415bd8deadSopenharmony_ci        UNIFORM_BLOCK                                   0x92E2
1425bd8deadSopenharmony_ci        PROGRAM_INPUT                                   0x92E3
1435bd8deadSopenharmony_ci        PROGRAM_OUTPUT                                  0x92E4
1445bd8deadSopenharmony_ci        BUFFER_VARIABLE                                 0x92E5
1455bd8deadSopenharmony_ci        SHADER_STORAGE_BLOCK                            0x92E6
1465bd8deadSopenharmony_ci        ATOMIC_COUNTER_BUFFER                           (already in 4.2)
1475bd8deadSopenharmony_ci        VERTEX_SUBROUTINE                               0x92E8
1485bd8deadSopenharmony_ci        TESS_CONTROL_SUBROUTINE                         0x92E9
1495bd8deadSopenharmony_ci        TESS_EVALUATION_SUBROUTINE                      0x92EA
1505bd8deadSopenharmony_ci        GEOMETRY_SUBROUTINE                             0x92EB
1515bd8deadSopenharmony_ci        FRAGMENT_SUBROUTINE                             0x92EC
1525bd8deadSopenharmony_ci        COMPUTE_SUBROUTINE                              0x92ED
1535bd8deadSopenharmony_ci        VERTEX_SUBROUTINE_UNIFORM                       0x92EE
1545bd8deadSopenharmony_ci        TESS_CONTROL_SUBROUTINE_UNIFORM                 0x92EF
1555bd8deadSopenharmony_ci        TESS_EVALUATION_SUBROUTINE_UNIFORM              0x92F0
1565bd8deadSopenharmony_ci        GEOMETRY_SUBROUTINE_UNIFORM                     0x92F1
1575bd8deadSopenharmony_ci        FRAGMENT_SUBROUTINE_UNIFORM                     0x92F2
1585bd8deadSopenharmony_ci        COMPUTE_SUBROUTINE_UNIFORM                      0x92F3
1595bd8deadSopenharmony_ci        TRANSFORM_FEEDBACK_VARYING                      0x92F4
1605bd8deadSopenharmony_ci
1615bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetProgramInterfaceiv:
1625bd8deadSopenharmony_ci
1635bd8deadSopenharmony_ci        ACTIVE_RESOURCES                                0x92F5
1645bd8deadSopenharmony_ci        MAX_NAME_LENGTH                                 0x92F6
1655bd8deadSopenharmony_ci        MAX_NUM_ACTIVE_VARIABLES                        0x92F7
1665bd8deadSopenharmony_ci        MAX_NUM_COMPATIBLE_SUBROUTINES                  0x92F8
1675bd8deadSopenharmony_ci
1685bd8deadSopenharmony_ci    Accepted in the <props> array of GetProgramResourceiv:
1695bd8deadSopenharmony_ci
1705bd8deadSopenharmony_ci        NAME_LENGTH                                     0x92F9
1715bd8deadSopenharmony_ci        TYPE                                            0x92FA
1725bd8deadSopenharmony_ci        ARRAY_SIZE                                      0x92FB
1735bd8deadSopenharmony_ci        OFFSET                                          0x92FC
1745bd8deadSopenharmony_ci        BLOCK_INDEX                                     0x92FD
1755bd8deadSopenharmony_ci        ARRAY_STRIDE                                    0x92FE
1765bd8deadSopenharmony_ci        MATRIX_STRIDE                                   0x92FF
1775bd8deadSopenharmony_ci        IS_ROW_MAJOR                                    0x9300
1785bd8deadSopenharmony_ci        ATOMIC_COUNTER_BUFFER_INDEX                     0x9301
1795bd8deadSopenharmony_ci        BUFFER_BINDING                                  0x9302
1805bd8deadSopenharmony_ci        BUFFER_DATA_SIZE                                0x9303
1815bd8deadSopenharmony_ci        NUM_ACTIVE_VARIABLES                            0x9304
1825bd8deadSopenharmony_ci        ACTIVE_VARIABLES                                0x9305
1835bd8deadSopenharmony_ci        REFERENCED_BY_VERTEX_SHADER                     0x9306
1845bd8deadSopenharmony_ci        REFERENCED_BY_TESS_CONTROL_SHADER               0x9307
1855bd8deadSopenharmony_ci        REFERENCED_BY_TESS_EVALUATION_SHADER            0x9308
1865bd8deadSopenharmony_ci        REFERENCED_BY_GEOMETRY_SHADER                   0x9309
1875bd8deadSopenharmony_ci        REFERENCED_BY_FRAGMENT_SHADER                   0x930A
1885bd8deadSopenharmony_ci        REFERENCED_BY_COMPUTE_SHADER                    0x930B
1895bd8deadSopenharmony_ci        TOP_LEVEL_ARRAY_SIZE                            0x930C
1905bd8deadSopenharmony_ci        TOP_LEVEL_ARRAY_STRIDE                          0x930D
1915bd8deadSopenharmony_ci        LOCATION                                        0x930E
1925bd8deadSopenharmony_ci        LOCATION_INDEX                                  0x930F
1935bd8deadSopenharmony_ci        IS_PER_PATCH                                    0x92E7
1945bd8deadSopenharmony_ci
1955bd8deadSopenharmony_ci        NUM_COMPATIBLE_SUBROUTINES                      (already in 4.2)
1965bd8deadSopenharmony_ci        COMPATIBLE_SUBROUTINES                          (already in 4.2)
1975bd8deadSopenharmony_ci
1985bd8deadSopenharmony_ci
1995bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 4.2 (Compatibility Profile) Specification
2005bd8deadSopenharmony_ci(OpenGL Operation)
2015bd8deadSopenharmony_ci
2025bd8deadSopenharmony_ci    Modify Section 2.14.3, Program Objects (p. 97)
2035bd8deadSopenharmony_ci
2045bd8deadSopenharmony_ci    (insert at the end of the section, p. 101)
2055bd8deadSopenharmony_ci
2065bd8deadSopenharmony_ci    Program Interfaces
2075bd8deadSopenharmony_ci
2085bd8deadSopenharmony_ci    When a program object is made part of the current rendering state, its
2095bd8deadSopenharmony_ci    executable code may communicate with other GL pipeline stages or
2105bd8deadSopenharmony_ci    application code through a variety of /interfaces/.  When a program is
2115bd8deadSopenharmony_ci    linked, the GL builds a list of /active resources/ for each interface.
2125bd8deadSopenharmony_ci    Examples of active resources include variables, interface blocks, and
2135bd8deadSopenharmony_ci    subroutines used by shader code.  Resources referenced in shader code are
2145bd8deadSopenharmony_ci    considered /active/ unless the compiler and linker can conclusively
2155bd8deadSopenharmony_ci    determine that they have no observable effect on the results produced by
2165bd8deadSopenharmony_ci    the executable code of the program.  For example, variables might be
2175bd8deadSopenharmony_ci    considered inactive if they are declared but not used in executable code,
2185bd8deadSopenharmony_ci    used only in a clause of an "if" statement that would never be executed,
2195bd8deadSopenharmony_ci    used only in functions that are never called, or used only in computations
2205bd8deadSopenharmony_ci    of temporary variables having no effect on any shader output.  In cases
2215bd8deadSopenharmony_ci    where the compiler or linker cannot make a conclusive determination, any
2225bd8deadSopenharmony_ci    resource referenced by shader code will be considered active.  The set of
2235bd8deadSopenharmony_ci    active resources on for any interface is implementation-dependent because
2245bd8deadSopenharmony_ci    it depends on various analysis and optimizations performed by the compiler
2255bd8deadSopenharmony_ci    and linker.
2265bd8deadSopenharmony_ci
2275bd8deadSopenharmony_ci    If a program is linked successfully, the GL will generate lists of active
2285bd8deadSopenharmony_ci    resources based on the executable code produced by the link.  If a program
2295bd8deadSopenharmony_ci    is linked unsuccessfully, the link may have failed for a number of
2305bd8deadSopenharmony_ci    reasons, including cases where the program required more resources than
2315bd8deadSopenharmony_ci    supported by the implementation.  Implementations are permitted, but not
2325bd8deadSopenharmony_ci    required, to record lists of resources that would have been considered
2335bd8deadSopenharmony_ci    active had the program linked successfully.  If an implementation does not
2345bd8deadSopenharmony_ci    record information for any given interface, the corresponding list of
2355bd8deadSopenharmony_ci    active resources is considered empty.  If a program has never been linked,
2365bd8deadSopenharmony_ci    all lists of active resources are considered empty.
2375bd8deadSopenharmony_ci
2385bd8deadSopenharmony_ci    The GL provides a number of commands to query properties of the interfaces
2395bd8deadSopenharmony_ci    of a program object.  Each such command accepts a <programInterface>
2405bd8deadSopenharmony_ci    token, identifying a specific interface.  The supported values for
2415bd8deadSopenharmony_ci    <programInterface> are as follows:
2425bd8deadSopenharmony_ci
2435bd8deadSopenharmony_ci      * UNIFORM corresponds to the set of active uniform variables (section
2445bd8deadSopenharmony_ci        2.14.7) used by <program>.
2455bd8deadSopenharmony_ci
2465bd8deadSopenharmony_ci      * UNIFORM_BLOCK corresponds to the set of active uniform blocks (section
2475bd8deadSopenharmony_ci        2.14.7) used by <program>.
2485bd8deadSopenharmony_ci
2495bd8deadSopenharmony_ci      * ATOMIC_COUNTER_BUFFER corresponds to the set of active atomic counter
2505bd8deadSopenharmony_ci        buffer binding points (section 2.14.7) used by <program>.
2515bd8deadSopenharmony_ci
2525bd8deadSopenharmony_ci      * PROGRAM_INPUT corresponds to the set of active input variables used by
2535bd8deadSopenharmony_ci        the first shader stage of <program>.  If <program> includes multiple
2545bd8deadSopenharmony_ci        shader stages, input variables from any shader stage other than the
2555bd8deadSopenharmony_ci        first will not be enumerated.
2565bd8deadSopenharmony_ci
2575bd8deadSopenharmony_ci      * PROGRAM_OUTPUT corresponds to the set of active output variables
2585bd8deadSopenharmony_ci        (section 2.14.11) used by the last shader stage of <program>.  If
2595bd8deadSopenharmony_ci        <program> includes multiple shader stages, output variables from any
2605bd8deadSopenharmony_ci        shader stage other than the last will not be enumerated.
2615bd8deadSopenharmony_ci
2625bd8deadSopenharmony_ci      * VERTEX_SUBROUTINE, TESS_CONTROL_SUBROUTINE,
2635bd8deadSopenharmony_ci        TESS_EVALUATION_SUBROUTINE, GEOMETRY_SUBROUTINE, FRAGMENT_SUBROUTINE,
2645bd8deadSopenharmony_ci        and COMPUTE_SUBROUTINE correspond to the set of active subroutines for
2655bd8deadSopenharmony_ci        the vertex, tessellation control, tessellation evaluation, geometry,
2665bd8deadSopenharmony_ci        fragment, and compute shader stages of <program>, respectively
2675bd8deadSopenharmony_ci        (section 2.14.8).
2685bd8deadSopenharmony_ci
2695bd8deadSopenharmony_ci      * VERTEX_SUBROUTINE_UNIFORM, TESS_CONTROL_SUBROUTINE_UNIFORM,
2705bd8deadSopenharmony_ci        TESS_EVALUATION_SUBROUTINE_UNIFORM, GEOMETRY_SUBROUTINE_UNIFORM,
2715bd8deadSopenharmony_ci        FRAGMENT_SUBROUTINE_UNIFORM, and COMPUTE_SUBROUTINE_UNIFORM correspond
2725bd8deadSopenharmony_ci        to the set of active subroutine uniform variables used by the vertex,
2735bd8deadSopenharmony_ci        tessellation control, tessellation evaluation, geometry, fragment, and
2745bd8deadSopenharmony_ci        compute shader stages of <program>, respectively (section 2.14.8).
2755bd8deadSopenharmony_ci
2765bd8deadSopenharmony_ci      * TRANSFORM_FEEDBACK_VARYING corresponds to the set of output variables
2775bd8deadSopenharmony_ci        in the last non-fragment stage of <program> that would be captured
2785bd8deadSopenharmony_ci        when transform feedback is active (section 2.20.2).
2795bd8deadSopenharmony_ci
2805bd8deadSopenharmony_ci      * BUFFER_VARIABLE corresponds to the set of active buffer variables (see
2815bd8deadSopenharmony_ci        the ARB_shader_storage_buffer_object extension) used by <program>.
2825bd8deadSopenharmony_ci
2835bd8deadSopenharmony_ci      * SHADER_STORAGE_BLOCK corresponds to the set of active shader storage
2845bd8deadSopenharmony_ci        blocks (see the ARB_shader_storage_buffer_object extension) used by
2855bd8deadSopenharmony_ci        <program>.
2865bd8deadSopenharmony_ci
2875bd8deadSopenharmony_ci    When building a list of active variable or interface blocks, resources
2885bd8deadSopenharmony_ci    with aggregate types (such as arrays or structures) may produce multiple
2895bd8deadSopenharmony_ci    entries in the active resource list for the corresponding interface.
2905bd8deadSopenharmony_ci    Additionally, each active variable, interface block, or subroutine in the
2915bd8deadSopenharmony_ci    list is assigned an associated name string that can be used by
2925bd8deadSopenharmony_ci    applications to refer to the resources.  For interfaces involving
2935bd8deadSopenharmony_ci    variables, interface blocks, or subroutines, the entries of active
2945bd8deadSopenharmony_ci    resource lists are generated as follows:
2955bd8deadSopenharmony_ci
2965bd8deadSopenharmony_ci      * For an active variable declared as a single instance of a basic type,
2975bd8deadSopenharmony_ci        a single entry will be generated, using the variable name from the
2985bd8deadSopenharmony_ci        shader source.
2995bd8deadSopenharmony_ci
3005bd8deadSopenharmony_ci      * For an active variable declared as an array of basic types, a single
3015bd8deadSopenharmony_ci        entry will be generated, with its name string formed by concatenating
3025bd8deadSopenharmony_ci        the name of the array and the string "[0]".
3035bd8deadSopenharmony_ci
3045bd8deadSopenharmony_ci      * For an active variable declared as a structure, a separate entry will
3055bd8deadSopenharmony_ci        be generated for each active structure member.  The name of each entry
3065bd8deadSopenharmony_ci        is formed by concatenating the name of the structure, the "."
3075bd8deadSopenharmony_ci        character, and the name of the structure member.  If a structure
3085bd8deadSopenharmony_ci        member to enumerate is itself a structure or array, these enumeration
3095bd8deadSopenharmony_ci        rules are applied recursively.
3105bd8deadSopenharmony_ci
3115bd8deadSopenharmony_ci      * For an active variable declared as an array of an aggregate data type
3125bd8deadSopenharmony_ci        (structures or arrays), a separate entry will be generated for each
3135bd8deadSopenharmony_ci        active array element, unless noted immediately below.  The name of
3145bd8deadSopenharmony_ci        each entry is formed by concatenating the name of the array, the "["
3155bd8deadSopenharmony_ci        character, an integer identifying the element number, and the "]"
3165bd8deadSopenharmony_ci        character.  These enumeration rules are applied recursively, treating
3175bd8deadSopenharmony_ci        each enumerated array element as a separate active variable.
3185bd8deadSopenharmony_ci
3195bd8deadSopenharmony_ci      * For an active shader storage block member declared as an array, an
3205bd8deadSopenharmony_ci        entry will be generated only for the first array element, regardless
3215bd8deadSopenharmony_ci        of its type.  For arrays of aggregate types, the enumeration rules are
3225bd8deadSopenharmony_ci        applied recursively for the single enumerated array element.
3235bd8deadSopenharmony_ci
3245bd8deadSopenharmony_ci      * For an active interface block not declared as an array of block
3255bd8deadSopenharmony_ci        instances, a single entry will be generated, using the block name from
3265bd8deadSopenharmony_ci        the shader source.
3275bd8deadSopenharmony_ci
3285bd8deadSopenharmony_ci      * For an active interface block declared as an array of instances,
3295bd8deadSopenharmony_ci        separate entries will be generated for each active instance.  The name
3305bd8deadSopenharmony_ci        of the instance is formed by concatenating the block name, the "["
3315bd8deadSopenharmony_ci        character, an integer identifying the instance number, and the "]"
3325bd8deadSopenharmony_ci        character.
3335bd8deadSopenharmony_ci
3345bd8deadSopenharmony_ci      * For an active subroutine, a single entry will be generated, using the
3355bd8deadSopenharmony_ci        subroutine name from the shader source.
3365bd8deadSopenharmony_ci
3375bd8deadSopenharmony_ci    When an integer array element or block instance number is part of the name
3385bd8deadSopenharmony_ci    string, it will be specified in decimal form without a "+" or "-" sign or
3395bd8deadSopenharmony_ci    any extra leading zeroes.  Additionally, the name string will not include
3405bd8deadSopenharmony_ci    white space anywhere in the string.
3415bd8deadSopenharmony_ci
3425bd8deadSopenharmony_ci    The order of the active resource list is implementation-dependent for all
3435bd8deadSopenharmony_ci    interfaces except for TRANSFORM_FEEDBACK_VARYING.  For
3445bd8deadSopenharmony_ci    TRANSFORM_FEEDBACK_VARYING, the active resource list will use the variable
3455bd8deadSopenharmony_ci    order specified in the the most recent call to TransformFeedbackVaryings
3465bd8deadSopenharmony_ci    before the last call to LinkProgram.
3475bd8deadSopenharmony_ci
3485bd8deadSopenharmony_ci    For the ATOMIC_COUNTER_BUFFER interface, the list of active buffer binding
3495bd8deadSopenharmony_ci    points is built by identifying each unique binding point associated with
3505bd8deadSopenharmony_ci    one or more active atomic counter uniform variables.  Active atomic
3515bd8deadSopenharmony_ci    counter buffers do not have an associated name string.
3525bd8deadSopenharmony_ci
3535bd8deadSopenharmony_ci    For the UNIFORM, PROGRAM_INPUT, PROGRAM_OUTPUT, and
3545bd8deadSopenharmony_ci    TRANSFORM_FEEDBACK_VARYING interfaces, the active resource list will
3555bd8deadSopenharmony_ci    include all active variables for the interface, including any active
3565bd8deadSopenharmony_ci    built-in variables.
3575bd8deadSopenharmony_ci
3585bd8deadSopenharmony_ci    For PROGRAM_INPUT and PROGRAM_OUTPUT interfaces for shaders that recieve
3595bd8deadSopenharmony_ci    or produce patch primitves, the active resource list will include both
3605bd8deadSopenharmony_ci    per-vertex and per-patch inputs and outputs.
3615bd8deadSopenharmony_ci
3625bd8deadSopenharmony_ci    For the TRANSFORM_FEEDBACK_VARYING interface, the active resource list
3635bd8deadSopenharmony_ci    will entries for the special varying names gl_NextBuffer,
3645bd8deadSopenharmony_ci    gl_SkipComponents1, gl_SkipComponents2, gl_SkipComponents3, and
3655bd8deadSopenharmony_ci    gl_SkipComponents4 (section 2.14.11).  These variables are used to control
3665bd8deadSopenharmony_ci    how varying values are written to transform feedback buffers.  When
3675bd8deadSopenharmony_ci    enumerating the properties of such resources, these variables are
3685bd8deadSopenharmony_ci    considered to have a TYPE of NONE and an ARRAY_SIZE of 0 (gl_NextBuffer),
3695bd8deadSopenharmony_ci    1, 2, 3, and 4, respectively.
3705bd8deadSopenharmony_ci
3715bd8deadSopenharmony_ci    When a program is linked successfully, active variables in the UNIFORM,
3725bd8deadSopenharmony_ci    PROGRAM_INPUT, PROGRAM_OUTPUT interface, or in any of the subroutine
3735bd8deadSopenharmony_ci    uniform interfaces, are assigned one or more signed integer /locations/.
3745bd8deadSopenharmony_ci    These locations can be used by commands to assign values to uniforms and
3755bd8deadSopenharmony_ci    subroutine uniforms, to identify generic vertex attributes associated with
3765bd8deadSopenharmony_ci    vertex shader inputs, or to identify fragment color output numbers and
3775bd8deadSopenharmony_ci    indices associated with fragment shader outputs.  For such variables
3785bd8deadSopenharmony_ci    declared as arrays, separate locations will be assigned to each active
3795bd8deadSopenharmony_ci    array element.  Not all active variables are assigned valid locations; the
3805bd8deadSopenharmony_ci    following variables will have an effective location of -1:
3815bd8deadSopenharmony_ci
3825bd8deadSopenharmony_ci      * uniforms declared as atomic counters;
3835bd8deadSopenharmony_ci
3845bd8deadSopenharmony_ci      * members of a uniform block;
3855bd8deadSopenharmony_ci
3865bd8deadSopenharmony_ci      * built-in inputs, outputs, and uniforms (starting with "gl_"); and
3875bd8deadSopenharmony_ci
3885bd8deadSopenharmony_ci      * inputs or outputs not declared with a "location" layout qualifier,
3895bd8deadSopenharmony_ci        except for vertex shader inputs and fragment shader outputs.
3905bd8deadSopenharmony_ci
3915bd8deadSopenharmony_ci    If a program has not been linked or has was last linked unsuccessfully, no
3925bd8deadSopenharmony_ci    locations will be assigned.
3935bd8deadSopenharmony_ci
3945bd8deadSopenharmony_ci    The command
3955bd8deadSopenharmony_ci
3965bd8deadSopenharmony_ci      void GetProgramInterfaceiv(uint program, enum programInterface,
3975bd8deadSopenharmony_ci                                 enum pname, int *params);
3985bd8deadSopenharmony_ci
3995bd8deadSopenharmony_ci    queries a property of the interface <programInterface> in program
4005bd8deadSopenharmony_ci    <program>, returning its value in <params>.  The property to return is
4015bd8deadSopenharmony_ci    specified by <pname>.
4025bd8deadSopenharmony_ci
4035bd8deadSopenharmony_ci    If <pname> is ACTIVE_RESOURCES, the value returned is the number of
4045bd8deadSopenharmony_ci    resources in the active resource list for <programInterface>.  If the list
4055bd8deadSopenharmony_ci    of active resources for <programInterface> is empty, zero is returned.
4065bd8deadSopenharmony_ci
4075bd8deadSopenharmony_ci    If <pname> is MAX_NAME_LENGTH, the value returned is the length of the
4085bd8deadSopenharmony_ci    longest active name string for an active resource in <programInterface>.
4095bd8deadSopenharmony_ci    This length includes an extra character for the null terminator.  If the
4105bd8deadSopenharmony_ci    list of active resources for <programInterface> is empty, zero is
4115bd8deadSopenharmony_ci    returned.  The error INVALID_OPERATION is generated if <programInterface>
4125bd8deadSopenharmony_ci    is ATOMIC_COUNTER_BUFFER, since active atomic counter buffer resources are
4135bd8deadSopenharmony_ci    not assigned name strings.
4145bd8deadSopenharmony_ci
4155bd8deadSopenharmony_ci    If <pname> is MAX_NUM_ACTIVE_VARIABLES, the value returned is the number
4165bd8deadSopenharmony_ci    of active variables belonging to the interface block or atomic counter
4175bd8deadSopenharmony_ci    buffer resource in <programInterface> with the most active variables.  If
4185bd8deadSopenharmony_ci    the list of active resources for <programInterface> is empty, zero is
4195bd8deadSopenharmony_ci    returned.  The error INVALID_OPERATION is generated if <programInterface>
4205bd8deadSopenharmony_ci    is not UNIFORM_BLOCK, ATOMIC_COUNTER_BUFFER, or SHADER_STORAGE_BLOCK.
4215bd8deadSopenharmony_ci
4225bd8deadSopenharmony_ci    If <pname> is MAX_NUM_COMPATIBLE_SUBROUTINES, the value returned is the
4235bd8deadSopenharmony_ci    number of compatible subroutines belonging to the active subroutine
4245bd8deadSopenharmony_ci    uniform in <programInterface> with the most compatible subroutines.  If
4255bd8deadSopenharmony_ci    the list of active resources for <programInterface> is empty, zero is
4265bd8deadSopenharmony_ci    returned.  The error INVALID_OPERATION is generated unless
4275bd8deadSopenharmony_ci    <programInterface> is VERTEX_SUBROUTINE_UNIFORM,
4285bd8deadSopenharmony_ci    TESS_CONTROL_SUBROUTINE_UNIFORM, TESS_EVALUATION_SUBROUTINE_UNIFORM,
4295bd8deadSopenharmony_ci    GEOMETRY_SUBROUTINE_UNIFORM, FRAGMENT_SUBROUTINE_UNIFORM, or
4305bd8deadSopenharmony_ci    COMPUTE_SUBROUTINE_UNIFORM.
4315bd8deadSopenharmony_ci
4325bd8deadSopenharmony_ci    Each entry in the active resource list for an interface is assigned a
4335bd8deadSopenharmony_ci    unique unsigned integer index in the range 0..<N>-1, where <N> is the
4345bd8deadSopenharmony_ci    number of entries in the active resource list.  The command
4355bd8deadSopenharmony_ci
4365bd8deadSopenharmony_ci      uint GetProgramResourceIndex(uint program, enum programInterface,
4375bd8deadSopenharmony_ci                                   const char *name);
4385bd8deadSopenharmony_ci
4395bd8deadSopenharmony_ci    returns the unsigned integer index assigned to a resource named <name> in
4405bd8deadSopenharmony_ci    the interface type <programInterface> of program object <program>.  The
4415bd8deadSopenharmony_ci    error INVALID_ENUM is generated if <programInterface> is
4425bd8deadSopenharmony_ci    ATOMIC_COUNTER_BUFFER, since active atomic counter buffer resources are
4435bd8deadSopenharmony_ci    not assigned name strings.
4445bd8deadSopenharmony_ci
4455bd8deadSopenharmony_ci    If <name> exactly matches the name string of one of the active resources
4465bd8deadSopenharmony_ci    for <programInterface>, the index of the matched resource is returned.
4475bd8deadSopenharmony_ci    Additionally, if <name> would exactly match the name string of an active
4485bd8deadSopenharmony_ci    resource if "[0]" were appended to <name>, the index of the matched
4495bd8deadSopenharmony_ci    resource is returned.  Otherwise, <name> is considered not to be the name
4505bd8deadSopenharmony_ci    of an active resource, and INVALID_INDEX is returned.  Note that if an
4515bd8deadSopenharmony_ci    interface enumerates a single active resource list entry for an array
4525bd8deadSopenharmony_ci    variable (e.g., "a[0]"), a <name> identifying any array element other than
4535bd8deadSopenharmony_ci    the first (e.g., "a[1]") is not considered to match.
4545bd8deadSopenharmony_ci
4555bd8deadSopenharmony_ci    For the interface TRANSFORM_FEEDBACK_VARYING, the value INVALID_INDEX
4565bd8deadSopenharmony_ci    should be returned when querying the index assigned to the special names
4575bd8deadSopenharmony_ci    "gl_NextBuffer", "gl_SkipComponents1", "gl_SkipComponents2",
4585bd8deadSopenharmony_ci    "gl_SkipComponents3", and "gl_SkipComponents4".
4595bd8deadSopenharmony_ci
4605bd8deadSopenharmony_ci    The command
4615bd8deadSopenharmony_ci
4625bd8deadSopenharmony_ci      void GetProgramResourceName(uint program, enum programInterface,
4635bd8deadSopenharmony_ci                                  uint index, sizei bufSize, sizei *length,
4645bd8deadSopenharmony_ci                                  char *name);
4655bd8deadSopenharmony_ci
4665bd8deadSopenharmony_ci    returns the name string assigned to the single active resource with an
4675bd8deadSopenharmony_ci    index of <index> in the interface <programInterface> of program object
4685bd8deadSopenharmony_ci    <program>.  The error INVALID_VALUE is generated if <index> is greater
4695bd8deadSopenharmony_ci    than or equal to the number of entries in the active resource list for
4705bd8deadSopenharmony_ci    <programInterface>.  The error INVALID_ENUM is generated if
4715bd8deadSopenharmony_ci    <programInterface> is ATOMIC_COUNTER_BUFFER, since active atomic counter
4725bd8deadSopenharmony_ci    buffer resources are not assigned name strings.
4735bd8deadSopenharmony_ci
4745bd8deadSopenharmony_ci    The name string assigned to the active resource identified by <index> is
4755bd8deadSopenharmony_ci    returned as a null-terminated string in <name>.  The actual number of
4765bd8deadSopenharmony_ci    characters written into <name>, excluding the null terminator, is returned
4775bd8deadSopenharmony_ci    in <length>.  If <length> is NULL, no length is returned.  The maximum
4785bd8deadSopenharmony_ci    number of characters that may be written into <name>, including the null
4795bd8deadSopenharmony_ci    terminator, is specified by <bufSize>.  If the length of the name string
4805bd8deadSopenharmony_ci    (including the null terminator) is greater than <bufSize>, the first
4815bd8deadSopenharmony_ci    <bufSize>-1 characters of the name string will be written to <name>,
4825bd8deadSopenharmony_ci    followed by a null terminator.  If <bufSize> is zero, no error will be
4835bd8deadSopenharmony_ci    generated but no characters will be written to <name>.  The length of the
4845bd8deadSopenharmony_ci    longest name string for <programInterface>, including a null terminator,
4855bd8deadSopenharmony_ci    can be queried by calling GetProgramInterfaceiv with a <pname> of
4865bd8deadSopenharmony_ci    MAX_NAME_LENGTH.
4875bd8deadSopenharmony_ci
4885bd8deadSopenharmony_ci    The command
4895bd8deadSopenharmony_ci
4905bd8deadSopenharmony_ci      void GetProgramResourceiv(uint program, enum programInterface,
4915bd8deadSopenharmony_ci                                uint index, sizei propCount,
4925bd8deadSopenharmony_ci                                const enum *props, sizei bufSize,
4935bd8deadSopenharmony_ci                                sizei *length, int *params);
4945bd8deadSopenharmony_ci
4955bd8deadSopenharmony_ci    returns values for multiple properties of a single active resource with an
4965bd8deadSopenharmony_ci    index of <index> in the interface <programInterface> of program object
4975bd8deadSopenharmony_ci    <program>.  For each resource, values for <propCount> properties specified
4985bd8deadSopenharmony_ci    by the array <props> are returned.  The error INVALID_VALUE is generated
4995bd8deadSopenharmony_ci    if <propCount> is zero.  The error INVALID_ENUM is generated if any value
5005bd8deadSopenharmony_ci    in <props> is not one of the properties described immediately below.  The
5015bd8deadSopenharmony_ci    error INVALID_OPERATION is generated if any value in <props> is not
5025bd8deadSopenharmony_ci    allowed for <programInterface>.  The set of allowed <programInterface>
5035bd8deadSopenharmony_ci    values for each property can be found in Table X.1.
5045bd8deadSopenharmony_ci
5055bd8deadSopenharmony_ci    The values associated with the properties of the active resource are
5065bd8deadSopenharmony_ci    written to consecutive entries in <params>, in increasing order according
5075bd8deadSopenharmony_ci    to position in <props>.  If no error is generated, only the first
5085bd8deadSopenharmony_ci    <bufSize> integer values will be written to <params>; any extra values
5095bd8deadSopenharmony_ci    will not be returned.  If <length> is not NULL, the actual number of
5105bd8deadSopenharmony_ci    integer values written to <params> will be written to <length>.
5115bd8deadSopenharmony_ci
5125bd8deadSopenharmony_ci      Property                     Supported Interfaces
5135bd8deadSopenharmony_ci      ---------------------------  ----------------------------------------
5145bd8deadSopenharmony_ci      NAME_LENGTH                  all but ATOMIC_COUNTER_BUFFER
5155bd8deadSopenharmony_ci
5165bd8deadSopenharmony_ci      TYPE                         UNIFORM, PROGRAM_INPUT, PROGRAM_OUTPUT,
5175bd8deadSopenharmony_ci                                     TRANSFORM_FEEDBACK_VARYING,
5185bd8deadSopenharmony_ci                                     BUFFER_VARIABLE
5195bd8deadSopenharmony_ci
5205bd8deadSopenharmony_ci      ARRAY_SIZE                   UNIFORM, BUFFER_VARIABLE, PROGRAM_INPUT,
5215bd8deadSopenharmony_ci                                     PROGRAM_OUTPUT, VERTEX_SUBROUTINE_
5225bd8deadSopenharmony_ci                                     UNIFORM, TESS_CONTROL_SUBROUTINE_UNIFORM,
5235bd8deadSopenharmony_ci                                     TESS_EVALUATION_SUBROUTINE_UNIFORM,
5245bd8deadSopenharmony_ci                                     GEOMETRY_SUBROUTINE_UNIFORM, FRAGMENT_
5255bd8deadSopenharmony_ci                                     SUBROUTINE_UNIFORM, COMPUTE_SUBROUTINE_
5265bd8deadSopenharmony_ci                                     UNIFORM, TRANSFORM_FEEDBACK_VARYING
5275bd8deadSopenharmony_ci
5285bd8deadSopenharmony_ci      OFFSET                       UNIFORM, BUFFER_VARIABLE
5295bd8deadSopenharmony_ci      BLOCK_INDEX                  UNIFORM, BUFFER_VARIABLE
5305bd8deadSopenharmony_ci      ARRAY_STRIDE                 UNIFORM, BUFFER_VARIABLE
5315bd8deadSopenharmony_ci      MATRIX_STRIDE                UNIFORM, BUFFER_VARIABLE
5325bd8deadSopenharmony_ci      IS_ROW_MAJOR                 UNIFORM, BUFFER_VARIABLE
5335bd8deadSopenharmony_ci
5345bd8deadSopenharmony_ci      ATOMIC_COUNTER_BUFFER_INDEX  UNIFORM
5355bd8deadSopenharmony_ci
5365bd8deadSopenharmony_ci      BUFFER_BINDING               UNIFORM_BLOCK, ATOMIC_COUNTER_BUFFER,
5375bd8deadSopenharmony_ci                                     SHADER_STORAGE_BLOCK
5385bd8deadSopenharmony_ci      BUFFER_DATA_SIZE             UNIFORM_BLOCK, ATOMIC_COUNTER_BUFFER
5395bd8deadSopenharmony_ci                                     SHADER_STORAGE_BLOCK
5405bd8deadSopenharmony_ci      NUM_ACTIVE_VARIABLES         UNIFORM_BLOCK, ATOMIC_COUNTER_BUFFER
5415bd8deadSopenharmony_ci                                     SHADER_STORAGE_BLOCK
5425bd8deadSopenharmony_ci      ACTIVE_VARIABLES             UNIFORM_BLOCK, ATOMIC_COUNTER_BUFFER
5435bd8deadSopenharmony_ci                                     SHADER_STORAGE_BLOCK
5445bd8deadSopenharmony_ci
5455bd8deadSopenharmony_ci      REFERENCED_BY_VERTEX_        UNIFORM, UNIFORM_BLOCK, ATOMIC_COUNTER_
5465bd8deadSopenharmony_ci        SHADER                       BUFFER, SHADER_STORAGE_BLOCK,
5475bd8deadSopenharmony_ci                                     BUFFER_VARIABLE, PROGRAM_INPUT,
5485bd8deadSopenharmony_ci                                     PROGRAM_OUTPUT
5495bd8deadSopenharmony_ci
5505bd8deadSopenharmony_ci      REFERENCED_BY_TESS_          UNIFORM, UNIFORM_BLOCK, ATOMIC_COUNTER_
5515bd8deadSopenharmony_ci        CONTROL_SHADER               BUFFER, SHADER_STORAGE_BLOCK,
5525bd8deadSopenharmony_ci                                     BUFFER_VARIABLE, PROGRAM_INPUT,
5535bd8deadSopenharmony_ci                                     PROGRAM_OUTPUT
5545bd8deadSopenharmony_ci
5555bd8deadSopenharmony_ci      REFERENCED_BY_TESS_          UNIFORM, UNIFORM_BLOCK, ATOMIC_COUNTER_
5565bd8deadSopenharmony_ci        EVALUATION_SHADER            BUFFER, SHADER_STORAGE_BLOCK,
5575bd8deadSopenharmony_ci                                     BUFFER_VARIABLE, PROGRAM_INPUT,
5585bd8deadSopenharmony_ci                                     PROGRAM_OUTPUT
5595bd8deadSopenharmony_ci
5605bd8deadSopenharmony_ci      REFERENCED_BY_GEOMETRY_      UNIFORM, UNIFORM_BLOCK, ATOMIC_COUNTER_
5615bd8deadSopenharmony_ci        SHADER                       BUFFER, SHADER_STORAGE_BLOCK,
5625bd8deadSopenharmony_ci                                     BUFFER_VARIABLE, PROGRAM_INPUT,
5635bd8deadSopenharmony_ci                                     PROGRAM_OUTPUT
5645bd8deadSopenharmony_ci
5655bd8deadSopenharmony_ci      REFERENCED_BY_FRAGMENT_      UNIFORM, UNIFORM_BLOCK, ATOMIC_COUNTER_
5665bd8deadSopenharmony_ci        SHADER                       BUFFER, SHADER_STORAGE_BLOCK,
5675bd8deadSopenharmony_ci                                     BUFFER_VARIABLE, PROGRAM_INPUT,
5685bd8deadSopenharmony_ci                                     PROGRAM_OUTPUT
5695bd8deadSopenharmony_ci
5705bd8deadSopenharmony_ci      REFERENCED_BY_COMPUTE_       UNIFORM, UNIFORM_BLOCK, ATOMIC_COUNTER_
5715bd8deadSopenharmony_ci        SHADER                       BUFFER, SHADER_STORAGE_BLOCK,
5725bd8deadSopenharmony_ci                                     BUFFER_VARIABLE, PROGRAM_INPUT,
5735bd8deadSopenharmony_ci                                     PROGRAM_OUTPUT
5745bd8deadSopenharmony_ci
5755bd8deadSopenharmony_ci      NUM_COMPATIBLE_SUBROUTINES   VERTEX_SUBROUTINE_UNIFORM, TESS_CONTROL_
5765bd8deadSopenharmony_ci                                     SUBROUTINE_UNIFORM, TESS_EVALUATION_
5775bd8deadSopenharmony_ci                                     SUBROUTINE_UNIFORM, GEOMETRY_SUBROUTINE_
5785bd8deadSopenharmony_ci                                     UNIFORM, FRAGMENT_SUBROUTINE_UNIFORM,
5795bd8deadSopenharmony_ci                                     COMPUTE_SUBROUTINE_UNIFORM
5805bd8deadSopenharmony_ci
5815bd8deadSopenharmony_ci      COMPATIBLE_SUBROUTINES       VERTEX_SUBROUTINE_UNIFORM, TESS_CONTROL_
5825bd8deadSopenharmony_ci                                     SUBROUTINE_UNIFORM, TESS_EVALUATION_
5835bd8deadSopenharmony_ci                                     SUBROUTINE_UNIFORM, GEOMETRY_SUBROUTINE_
5845bd8deadSopenharmony_ci                                     UNIFORM, FRAGMENT_SUBROUTINE_UNIFORM,
5855bd8deadSopenharmony_ci                                     COMPUTE_SUBROUTINE_UNIFORM
5865bd8deadSopenharmony_ci
5875bd8deadSopenharmony_ci      TOP_LEVEL_ARRAY_SIZE         BUFFER_VARIABLE
5885bd8deadSopenharmony_ci
5895bd8deadSopenharmony_ci      TOP_LEVEL_ARRAY_STRIDE       BUFFER_VARIABLE
5905bd8deadSopenharmony_ci
5915bd8deadSopenharmony_ci      LOCATION                     UNIFORM, PROGRAM_INPUT, PROGRAM_OUTPUT,
5925bd8deadSopenharmony_ci                                     VERTEX_SUBROUTINE_UNIFORM, TESS_CONTROL_
5935bd8deadSopenharmony_ci                                     SUBROUTINE_UNIFORM, TESS_EVALUATION_
5945bd8deadSopenharmony_ci                                     SUBROUTINE_UNIFORM, GEOMETRY_SUBROUTINE_
5955bd8deadSopenharmony_ci                                     UNIFORM, FRAGMENT_SUBROUTINE_UNIFORM,
5965bd8deadSopenharmony_ci                                     COMPUTE_SUBROUTINE_UNIFORM
5975bd8deadSopenharmony_ci
5985bd8deadSopenharmony_ci      LOCATION_INDEX               PROGRAM_OUTPUT
5995bd8deadSopenharmony_ci
6005bd8deadSopenharmony_ci      IS_PER_PATCH                 PROGRAM_INPUT, PROGRAM_OUTPUT
6015bd8deadSopenharmony_ci
6025bd8deadSopenharmony_ci      Table X.1, GetProgramResourceiv properties and supported interfaces
6035bd8deadSopenharmony_ci
6045bd8deadSopenharmony_ci    For the property NAME_LENGTH, a single integer identifying the length of
6055bd8deadSopenharmony_ci    the name string associated with an active variable, interface block, or
6065bd8deadSopenharmony_ci    subroutine is written to <params>.  The name length includes a terminating
6075bd8deadSopenharmony_ci    null character.
6085bd8deadSopenharmony_ci
6095bd8deadSopenharmony_ci    For the property TYPE, a single integer identifying the type of an active
6105bd8deadSopenharmony_ci    variable is written to <params>.  The integer returned is one of the
6115bd8deadSopenharmony_ci    values found in table 2.16.
6125bd8deadSopenharmony_ci
6135bd8deadSopenharmony_ci    For the property COMPATIBLE_SUBROUTINES, an array of integers is written
6145bd8deadSopenharmony_ci    to <params>, with each integer specifying the index of an active
6155bd8deadSopenharmony_ci    subroutine that can be assigned to the selected subroutine uniform. The
6165bd8deadSopenharmony_ci    number of values written to <params> for an active subroutine is given
6175bd8deadSopenharmony_ci    by the value of the property NUM_COMPATIBLE_SUBROUTINES for the
6185bd8deadSopenharmony_ci    resource.
6195bd8deadSopenharmony_ci
6205bd8deadSopenharmony_ci    For the property ARRAY_SIZE, a single integer identifying the number of
6215bd8deadSopenharmony_ci    active array elements of an active variable is written to <params>. The
6225bd8deadSopenharmony_ci    array size returned is in units of the type associated with the property
6235bd8deadSopenharmony_ci    TYPE. For active variables not corresponding to an array of basic types,
6245bd8deadSopenharmony_ci    the value one is written to <params>. If the variable is a shader
6255bd8deadSopenharmony_ci    storage block member in an array with no declared size, the value zero
6265bd8deadSopenharmony_ci    is written to <params>.
6275bd8deadSopenharmony_ci
6285bd8deadSopenharmony_ci    For the property BLOCK_INDEX, a single integer identifying the index of
6295bd8deadSopenharmony_ci    the active interface block containing an active variable is written to
6305bd8deadSopenharmony_ci    <params>.  If the variable is not the member of an interface block, the
6315bd8deadSopenharmony_ci    value -1 is written to <params>.
6325bd8deadSopenharmony_ci
6335bd8deadSopenharmony_ci    For the property OFFSET, a single integer identifying the offset of an
6345bd8deadSopenharmony_ci    active variable is written to <params>.  For active variables backed by a
6355bd8deadSopenharmony_ci    buffer object, the value written is the offset, in basic machine units,
6365bd8deadSopenharmony_ci    relative to the base of buffer range holding the values of the variable.
6375bd8deadSopenharmony_ci    For active variables not backed by a buffer object, an offset of -1 is
6385bd8deadSopenharmony_ci    written to <params>.
6395bd8deadSopenharmony_ci
6405bd8deadSopenharmony_ci    For the property ARRAY_STRIDE, a single integer identifying the stride
6415bd8deadSopenharmony_ci    between array elements in an active variable is written to <params>.  For
6425bd8deadSopenharmony_ci    active variables declared as an array of basic types, the value written is
6435bd8deadSopenharmony_ci    the difference, in basic machine units, between the offsets of consecutive
6445bd8deadSopenharmony_ci    elements in an array.  For active variables not declared as an array of
6455bd8deadSopenharmony_ci    basic types, zero is written to <params>.  For active variables not backed
6465bd8deadSopenharmony_ci    by a buffer object, -1 is written to <params>, regardless of the variable
6475bd8deadSopenharmony_ci    type.
6485bd8deadSopenharmony_ci
6495bd8deadSopenharmony_ci    For the property MATRIX_STRIDE, a single integer identifying the stride
6505bd8deadSopenharmony_ci    between columns of a column-major matrix or rows of a row-major matrix is
6515bd8deadSopenharmony_ci    written to <params>.  For active variables declared a single matrix or
6525bd8deadSopenharmony_ci    array of matrices, the value written is the difference, in basic machine
6535bd8deadSopenharmony_ci    units, between the offsets of consecutive columns or rows in each matrix.
6545bd8deadSopenharmony_ci    For active variables not declared as a matrix or array of matrices, zero
6555bd8deadSopenharmony_ci    is written to <params>.  For active variables not backed by a buffer
6565bd8deadSopenharmony_ci    object, -1 is written to <params>, regardless of the variable type.
6575bd8deadSopenharmony_ci
6585bd8deadSopenharmony_ci    For the property IS_ROW_MAJOR, a single integer identifying whether an
6595bd8deadSopenharmony_ci    active variable is a row-major matrix is written to <params>.  For active
6605bd8deadSopenharmony_ci    variables backed by a buffer object, declared as a single matrix or array
6615bd8deadSopenharmony_ci    of matrices, and stored in row-major order, one is written to <params>.
6625bd8deadSopenharmony_ci    For all other active variables, zero is written to <params>.
6635bd8deadSopenharmony_ci
6645bd8deadSopenharmony_ci    For the property ATOMIC_COUNTER_BUFFER_INDEX, a single integer identifying
6655bd8deadSopenharmony_ci    the index of the active atomic counter buffer containing an active
6665bd8deadSopenharmony_ci    variable is written to <params>.  If the variable is not an atomic counter
6675bd8deadSopenharmony_ci    uniform, the value -1 is written to <params>.
6685bd8deadSopenharmony_ci
6695bd8deadSopenharmony_ci    For the property of BUFFER_BINDING, to index of the buffer binding point
6705bd8deadSopenharmony_ci    associated with the active uniform block, shader storage block, or atomic
6715bd8deadSopenharmony_ci    counter buffer is written to <params>.
6725bd8deadSopenharmony_ci
6735bd8deadSopenharmony_ci    For the property of BUFFER_DATA_SIZE, then the implementation-dependent
6745bd8deadSopenharmony_ci    minimum total buffer object size, in basic machine units, required to hold
6755bd8deadSopenharmony_ci    all active variables associated with an active uniform block, shader
6765bd8deadSopenharmony_ci    storage block, or atomic counter buffer is written to <params>.  If the
6775bd8deadSopenharmony_ci    final member of an active shader storage block is array with no declared
6785bd8deadSopenharmony_ci    size, the minimum buffer size is computed assuming the array was declared
6795bd8deadSopenharmony_ci    as an array with one element.
6805bd8deadSopenharmony_ci
6815bd8deadSopenharmony_ci    For the property of NUM_ACTIVE_VARIABLES, the number of active variables
6825bd8deadSopenharmony_ci    associated with an active uniform block, shader storage block, or atomic
6835bd8deadSopenharmony_ci    counter buffer is written to <params>.
6845bd8deadSopenharmony_ci
6855bd8deadSopenharmony_ci    For the property of ACTIVE_VARIABLES, an array of active variable indices
6865bd8deadSopenharmony_ci    associated with an active uniform block, shader storage block, or atomic
6875bd8deadSopenharmony_ci    counter buffer is written to <params>.  The number of values written to
6885bd8deadSopenharmony_ci    <params> for an active resource is given by the value of the property
6895bd8deadSopenharmony_ci    NUM_ACTIVE_VARIABLES for the resource.
6905bd8deadSopenharmony_ci
6915bd8deadSopenharmony_ci    For the properties REFERENCED_BY_VERTEX_SHADER,
6925bd8deadSopenharmony_ci    REFERENCED_BY_TESS_CONTROL_SHADER, REFERENCED_BY_TESS_EVALUATION_SHADER,
6935bd8deadSopenharmony_ci    REFERENCED_BY_GEOMETRY_SHADER, REFERENCED_BY_FRAGMENT_SHADER, and
6945bd8deadSopenharmony_ci    REFERENCED_BY_COMPUTE_SHADER, a single integer is written to <params>,
6955bd8deadSopenharmony_ci    identifying whether the active resource is referenced by the vertex,
6965bd8deadSopenharmony_ci    tessellation control, tessellation evaluation, geometry, or fragment
6975bd8deadSopenharmony_ci    shaders, respectively, in the program object.  The value one is written to
6985bd8deadSopenharmony_ci    <params> if an active variable is referenced by the corresponding shader,
6995bd8deadSopenharmony_ci    or if an active uniform block, shader storage block, or atomic counter
7005bd8deadSopenharmony_ci    buffer contains at least one variable referenced by the corresponding
7015bd8deadSopenharmony_ci    shader.  Otherwise, the value zero is written to <params>.
7025bd8deadSopenharmony_ci
7035bd8deadSopenharmony_ci    For the property TOP_LEVEL_ARRAY_SIZE, a single integer identifying the
7045bd8deadSopenharmony_ci    number of active array elements of the top-level shader storage block
7055bd8deadSopenharmony_ci    member containing to the active variable is written to <params>.  If the
7065bd8deadSopenharmony_ci    top-level block member is not declared as an array, the value one is
7075bd8deadSopenharmony_ci    written to <params>.  If the top-level block member is an array with no
7085bd8deadSopenharmony_ci    declared size, the value zero is written to <params>.
7095bd8deadSopenharmony_ci
7105bd8deadSopenharmony_ci    For the property TOP_LEVEL_ARRAY_STRIDE, a single integer identifying the
7115bd8deadSopenharmony_ci    stride between array elements of the top-level shader storage block member
7125bd8deadSopenharmony_ci    containing the active variable is written to <params>.  For top-level
7135bd8deadSopenharmony_ci    block members declared as arrays, the value written is the difference, in
7145bd8deadSopenharmony_ci    basic machine units, between the offsets of the active variable for
7155bd8deadSopenharmony_ci    consecutive elements in the top-level array.  For top-level block members
7165bd8deadSopenharmony_ci    not declared as an array, zero is written to <params>.
7175bd8deadSopenharmony_ci
7185bd8deadSopenharmony_ci    For the property LOCATION, a single integer identifying the assigned
7195bd8deadSopenharmony_ci    location for an active uniform, input, output, or subroutine uniform
7205bd8deadSopenharmony_ci    variable is written to <params>.  For input, output, or uniform variables
7215bd8deadSopenharmony_ci    with locations specified by a layout qualifier, the specified location is
7225bd8deadSopenharmony_ci    used.  For vertex shader input or fragment shader output variables without
7235bd8deadSopenharmony_ci    a layout qualifier, the location assigned when a program is linked is
7245bd8deadSopenharmony_ci    written to <params>.  For all other input and output variables, the value
7255bd8deadSopenharmony_ci    -1 is written to <params>.  For uniforms in uniform blocks, the value -1
7265bd8deadSopenharmony_ci    is written to <params>.
7275bd8deadSopenharmony_ci
7285bd8deadSopenharmony_ci    For the property LOCATION_INDEX, a single integer identifying the fragment
7295bd8deadSopenharmony_ci    color index of an active fragment shader output variable is written to
7305bd8deadSopenharmony_ci    <params>.  If the active variable is an output for a non-fragment shader,
7315bd8deadSopenharmony_ci    the value -1 will be written to <params>.
7325bd8deadSopenharmony_ci
7335bd8deadSopenharmony_ci    For the property IS_PER_PATCH, a single integer identifying whether the
7345bd8deadSopenharmony_ci    input or output is a per-patch attribute.  If the active variable is a
7355bd8deadSopenharmony_ci    per-patch attribute (declared with the "patch" qualifier), the value one
7365bd8deadSopenharmony_ci    is written to <params>; otherwise, the value zero is written to <params>.
7375bd8deadSopenharmony_ci
7385bd8deadSopenharmony_ci    The commands
7395bd8deadSopenharmony_ci
7405bd8deadSopenharmony_ci      int GetProgramResourceLocation(uint program, enum programInterface,
7415bd8deadSopenharmony_ci                                     const char *name);
7425bd8deadSopenharmony_ci      int GetProgramResourceLocationIndex(uint program, enum programInterface,
7435bd8deadSopenharmony_ci                                          const char *name);
7445bd8deadSopenharmony_ci
7455bd8deadSopenharmony_ci    returns the location or the fragment color index, respectively, assigned
7465bd8deadSopenharmony_ci    to the variable named <name> in interface <programInterface> of program
7475bd8deadSopenharmony_ci    object <program>.  For both commands, the error INVALID_OPERATION is
7485bd8deadSopenharmony_ci    generated if <program> has not been linked or was last linked
7495bd8deadSopenharmony_ci    unsuccessfully.  For GetProgramResourceLocation, <programInterface> must
7505bd8deadSopenharmony_ci    be one of UNIFORM, PROGRAM_INPUT, PROGRAM_OUTPUT,
7515bd8deadSopenharmony_ci    VERTEX_SUBROUTINE_UNIFORM, TESS_CONTROL_SUBROUTINE_UNIFORM,
7525bd8deadSopenharmony_ci    TESS_EVALUATION_SUBROUTINE_UNIFORM, GEOMETRY_SUBROUTINE_UNIFORM,
7535bd8deadSopenharmony_ci    FRAGMENT_SUBROUTINE_UNIFORM, or COMPUTE_SUBROUTINE_UNIFORM.  For
7545bd8deadSopenharmony_ci    GetProgramResourceLocationIndex, <programInterface> must be
7555bd8deadSopenharmony_ci    PROGRAM_OUTPUT.  The value -1 will be returned by either command if an
7565bd8deadSopenharmony_ci    error occurs, if <name> does not identify an active variable on
7575bd8deadSopenharmony_ci    <programInterface>, or if <name> identifies an active variable that does
7585bd8deadSopenharmony_ci    not have a valid location assigned, as described above.  The locations
7595bd8deadSopenharmony_ci    returned by these commands are the same locations returned when querying
7605bd8deadSopenharmony_ci    the LOCATION and LOCATION_INDEX resource properties.
7615bd8deadSopenharmony_ci
7625bd8deadSopenharmony_ci    A string provided to GetProgramResourceLocation or
7635bd8deadSopenharmony_ci    GetProgramResourceLocationIndex is considered to match an active variable
7645bd8deadSopenharmony_ci    if:
7655bd8deadSopenharmony_ci
7665bd8deadSopenharmony_ci      * the string exactly matches the name of the active variable;
7675bd8deadSopenharmony_ci
7685bd8deadSopenharmony_ci      * if the string identifies the base name of an active array, where the
7695bd8deadSopenharmony_ci        string would exactly match the name of the variable if the suffix
7705bd8deadSopenharmony_ci        "[0]" were appended to the string; or
7715bd8deadSopenharmony_ci
7725bd8deadSopenharmony_ci      * if the string identifies an active element of the array, where the
7735bd8deadSopenharmony_ci        string ends with the concatenation of the "[" character, an integer
7745bd8deadSopenharmony_ci        (with no "+" sign, extra leading zeroes, or whitespace) identifying an
7755bd8deadSopenharmony_ci        array element, and the "]" character, the integer is less than the
7765bd8deadSopenharmony_ci        number of active elements of the array variable, and where the string
7775bd8deadSopenharmony_ci        would exactly match the enumerated name of the array if the decimal
7785bd8deadSopenharmony_ci        integer were replaced with zero.
7795bd8deadSopenharmony_ci
7805bd8deadSopenharmony_ci    Any other string is considered not to identify an active variable.  If the
7815bd8deadSopenharmony_ci    string specifies an element of an array variable,
7825bd8deadSopenharmony_ci    GetProgramResourceLocation and GetProgramResourceLocationIndex return the
7835bd8deadSopenharmony_ci    location or fragment color index assigned to that element.  If it
7845bd8deadSopenharmony_ci    specifies the base name of an array, it identifies the resources
7855bd8deadSopenharmony_ci    associated with the first element of the array.
7865bd8deadSopenharmony_ci
7875bd8deadSopenharmony_ci
7885bd8deadSopenharmony_ci    Modify Section 2.14.6, Vertex Attributes, p. 109
7895bd8deadSopenharmony_ci
7905bd8deadSopenharmony_ci    (delete text beginning with the second paragraph of p. 110, through the
7915bd8deadSopenharmony_ci     second paragraph of p. 112)
7925bd8deadSopenharmony_ci
7935bd8deadSopenharmony_ci    (modify the third paragraph, p. 112, removing the first sentence)  The
7945bd8deadSopenharmony_ci    command
7955bd8deadSopenharmony_ci
7965bd8deadSopenharmony_ci      void BindAttribLocation(uint program, uint index, const char *name);
7975bd8deadSopenharmony_ci
7985bd8deadSopenharmony_ci    ...
7995bd8deadSopenharmony_ci
8005bd8deadSopenharmony_ci    (insert after second paragraph, p. 113)
8015bd8deadSopenharmony_ci
8025bd8deadSopenharmony_ci    To determine the set of active vertex attribute variables used by a
8035bd8deadSopenharmony_ci    program, applications can query the properties and active resources of the
8045bd8deadSopenharmony_ci    PROGRAM_INPUT interface of a program including a vertex shader.
8055bd8deadSopenharmony_ci
8065bd8deadSopenharmony_ci    Additionally, the command
8075bd8deadSopenharmony_ci
8085bd8deadSopenharmony_ci      void GetActiveAttrib(uint program, uint index,
8095bd8deadSopenharmony_ci                           sizei bufSize, sizei *length, int *size,
8105bd8deadSopenharmony_ci                           enum *type, char *name);
8115bd8deadSopenharmony_ci
8125bd8deadSopenharmony_ci    can be used to determine properties of the active input variable assigned
8135bd8deadSopenharmony_ci    the index <index> in program object <program>.  If no error occurs, the
8145bd8deadSopenharmony_ci    command is equivalent to calling:
8155bd8deadSopenharmony_ci
8165bd8deadSopenharmony_ci      const enum props[] = { ARRAY_SIZE, TYPE };
8175bd8deadSopenharmony_ci      GetProgramResourceName(program, PROGRAM_INPUT, index, bufSize, length,
8185bd8deadSopenharmony_ci                             name);
8195bd8deadSopenharmony_ci      GetProgramResourceiv(program, PROGRAM_INPUT, index, 1, &props[0],
8205bd8deadSopenharmony_ci                           1, NULL, size);
8215bd8deadSopenharmony_ci      GetProgramResourceiv(program, PROGRAM_INPUT, index, 1, &props[1],
8225bd8deadSopenharmony_ci                           1, NULL, (int *) type);
8235bd8deadSopenharmony_ci
8245bd8deadSopenharmony_ci    If <index> is not the index of an active input variable in <program>, the
8255bd8deadSopenharmony_ci    error INVALID_VALUE is generated.  If <program> does not include a vertex
8265bd8deadSopenharmony_ci    shader, it has no active vertex attributes and the error INVALID_VALUE is
8275bd8deadSopenharmony_ci    generated for all values of <index>.  For GetActiveAttrib, all active
8285bd8deadSopenharmony_ci    vertex shader input variables are enumerated, including the special
8295bd8deadSopenharmony_ci    built-in inputs gl_VertexID and gl_InstanceID.
8305bd8deadSopenharmony_ci
8315bd8deadSopenharmony_ci    The command
8325bd8deadSopenharmony_ci
8335bd8deadSopenharmony_ci      int GetAttribLocation(uint program, const char *name);
8345bd8deadSopenharmony_ci
8355bd8deadSopenharmony_ci    can be used to determine the location assigned to the active input
8365bd8deadSopenharmony_ci    variable named <name> in program object <program>.  The error
8375bd8deadSopenharmony_ci    INVALID_OPERATION is generated and -1 is returned if <program> has not
8385bd8deadSopenharmony_ci    been linked or was last linked unsuccessfully.  If <program> has been
8395bd8deadSopenharmony_ci    successfully linked but contains no vertex shader, no error will be
8405bd8deadSopenharmony_ci    generated but -1 will be returned.  Otherwise, the command is equivalent
8415bd8deadSopenharmony_ci    to calling:
8425bd8deadSopenharmony_ci
8435bd8deadSopenharmony_ci      GetProgramResourceLocation(program, PROGRAM_INPUT, name);
8445bd8deadSopenharmony_ci
8455bd8deadSopenharmony_ci    There is an implementation-dependent limit on the number of active
8465bd8deadSopenharmony_ci    attribute variables [[compatibility profile only:  (either conventional or
8475bd8deadSopenharmony_ci    generic)]] in a vertex shader.  A program with more than
8485bd8deadSopenharmony_ci    MAX_VERTEX_ATTRIBS active attribute variables may fail to link, unless
8495bd8deadSopenharmony_ci    device-dependent optimizations are able to make the program fit within
8505bd8deadSopenharmony_ci    available hardware resources.  For the purposes of this test, attribute
8515bd8deadSopenharmony_ci    variables of the type dvec3, dvec4, dmat2x3, dmat2x4, dmat3, dmat3x4,
8525bd8deadSopenharmony_ci    dmat4x3, and dmat4 may count as consuming twice as many attributes as
8535bd8deadSopenharmony_ci    equivalent single-precision types.  While these types use the same number
8545bd8deadSopenharmony_ci    of generic attributes as their single-precision equivalents,
8555bd8deadSopenharmony_ci    implementations are permitted to consume two single-precision vectors of
8565bd8deadSopenharmony_ci    internal storage for each three- or four-component double-precision
8575bd8deadSopenharmony_ci    vector.
8585bd8deadSopenharmony_ci
8595bd8deadSopenharmony_ci
8605bd8deadSopenharmony_ci    Modify Section 2.14.7, Uniform Variables, p. 113
8615bd8deadSopenharmony_ci
8625bd8deadSopenharmony_ci    (replace text starting with the 3rd paragraph on p. 115 through the 3rd
8635bd8deadSopenharmony_ci    paragraph on p. 127)
8645bd8deadSopenharmony_ci
8655bd8deadSopenharmony_ci    To determine the set of active uniform variables used by a program,
8665bd8deadSopenharmony_ci    applications can query the properties and active resources of the UNIFORM
8675bd8deadSopenharmony_ci    interface of a program.
8685bd8deadSopenharmony_ci
8695bd8deadSopenharmony_ci    Additionally, several dedicated commands are provided to query properties
8705bd8deadSopenharmony_ci    of active uniforms.  The commands
8715bd8deadSopenharmony_ci
8725bd8deadSopenharmony_ci      int GetUniformLocation(uint program, const char *name)
8735bd8deadSopenharmony_ci
8745bd8deadSopenharmony_ci      void GetActiveUniformName(uint program, uint uniformIndex,
8755bd8deadSopenharmony_ci                                sizei bufSize, sizei *length,
8765bd8deadSopenharmony_ci                                char *uniformName);
8775bd8deadSopenharmony_ci
8785bd8deadSopenharmony_ci    are equivalent to calling
8795bd8deadSopenharmony_ci
8805bd8deadSopenharmony_ci      GetProgramResourceLocation(program, UNIFORM, name);
8815bd8deadSopenharmony_ci
8825bd8deadSopenharmony_ci      GetProgramResourceName(program, UNIFORM, uniformIndex, bufSize, length,
8835bd8deadSopenharmony_ci                             uniformName);
8845bd8deadSopenharmony_ci
8855bd8deadSopenharmony_ci    The command
8865bd8deadSopenharmony_ci
8875bd8deadSopenharmony_ci      void GetUniformIndices(uint program, sizei uniformCount,
8885bd8deadSopenharmony_ci                             const char * const *uniformNames,
8895bd8deadSopenharmony_ci                             uint *uniformIndices);
8905bd8deadSopenharmony_ci
8915bd8deadSopenharmony_ci    is equivalent to
8925bd8deadSopenharmony_ci
8935bd8deadSopenharmony_ci      for (int i = 0; i < uniformCount; i++) {
8945bd8deadSopenharmony_ci        uniformIndices[i] =
8955bd8deadSopenharmony_ci          GetProgramResourceIndex(program, UNIFORM, uniformNames[i];
8965bd8deadSopenharmony_ci      }
8975bd8deadSopenharmony_ci
8985bd8deadSopenharmony_ci    The command
8995bd8deadSopenharmony_ci
9005bd8deadSopenharmony_ci      void GetActiveUniform(uint program, uint index, sizei bufSize,
9015bd8deadSopenharmony_ci                            sizei *length, int *size, enum *type,
9025bd8deadSopenharmony_ci                            char *name);
9035bd8deadSopenharmony_ci
9045bd8deadSopenharmony_ci    is equivalent to
9055bd8deadSopenharmony_ci
9065bd8deadSopenharmony_ci      const enum props[] = { ARRAY_SIZE, TYPE };
9075bd8deadSopenharmony_ci      GetProgramResourceName(program, UNIFORM, index, bufSize, length, name);
9085bd8deadSopenharmony_ci      GetProgramResourceiv(program, UNIFORM, index,
9095bd8deadSopenharmony_ci                           1, &props[0], 1, NULL, size);
9105bd8deadSopenharmony_ci      GetProgramResourceiv(program, UNIFORM, index,
9115bd8deadSopenharmony_ci                           1, &props[1], 1, NULL, (int *) type);
9125bd8deadSopenharmony_ci
9135bd8deadSopenharmony_ci    The command
9145bd8deadSopenharmony_ci
9155bd8deadSopenharmony_ci      void GetActiveUniformsiv(uint program, sizei uniformCount,
9165bd8deadSopenharmony_ci                               const uint *uniformIndices, enum pname,
9175bd8deadSopenharmony_ci                               int *params);
9185bd8deadSopenharmony_ci
9195bd8deadSopenharmony_ci    is equivalent to
9205bd8deadSopenharmony_ci
9215bd8deadSopenharmony_ci      GLenum prop;
9225bd8deadSopenharmony_ci      for (int i = 0; i < uniformCount; i++) {
9235bd8deadSopenharmony_ci        GetProgramResourceiv(program, UNIFORM, uniformIndices[i], 1, &prop,
9245bd8deadSopenharmony_ci                             1, NULL, &params[i]);
9255bd8deadSopenharmony_ci      }
9265bd8deadSopenharmony_ci
9275bd8deadSopenharmony_ci    where the value of <prop> is taken from Table X.2, based on the value of
9285bd8deadSopenharmony_ci    <pname>.
9295bd8deadSopenharmony_ci
9305bd8deadSopenharmony_ci        <pname>                         <prop>
9315bd8deadSopenharmony_ci        ------------------------------  ------------------------------
9325bd8deadSopenharmony_ci        UNIFORM_TYPE                    TYPE
9335bd8deadSopenharmony_ci        UNIFORM_SIZE                    ARRAY_SIZE
9345bd8deadSopenharmony_ci        UNIFORM_NAME_LENGTH             NAME_LENGTH
9355bd8deadSopenharmony_ci        UNIFORM_BLOCK_INDEX             BLOCK_INDEX
9365bd8deadSopenharmony_ci        UNIFORM_OFFSET                  OFFSET
9375bd8deadSopenharmony_ci        UNIFORM_ARRAY_STRIDE            ARRAY_STRIDE
9385bd8deadSopenharmony_ci        UNIFORM_MATRIX_STRIDE           MATRIX_STRIDE
9395bd8deadSopenharmony_ci        UNIFORM_IS_ROW_MAJOR            IS_ROW_MAJOR
9405bd8deadSopenharmony_ci        UNIFORM_ATOMIC_COUNTER_         ATOMIC_COUNTER_BUFFER_INDEX
9415bd8deadSopenharmony_ci          BUFFER_INDEX
9425bd8deadSopenharmony_ci
9435bd8deadSopenharmony_ci        Table X.2, GetProgramResourceiv properties used by
9445bd8deadSopenharmony_ci        GetActiveUniformsiv.
9455bd8deadSopenharmony_ci
9465bd8deadSopenharmony_ci    To determine the set of active uniform blocks used by a program,
9475bd8deadSopenharmony_ci    applications can query the properties and active resources of the
9485bd8deadSopenharmony_ci    UNIFORM_BLOCK interface of a program.
9495bd8deadSopenharmony_ci
9505bd8deadSopenharmony_ci    Additionally, several dedicated commands are provided to query properties
9515bd8deadSopenharmony_ci    of active uniform blocks.  The commands
9525bd8deadSopenharmony_ci
9535bd8deadSopenharmony_ci      uint GetUniformBlockIndex(uint program, const char *uniformBlockName);
9545bd8deadSopenharmony_ci
9555bd8deadSopenharmony_ci      void GetActiveUniformBlockName(uint program, uint uniformBlockIndex,
9565bd8deadSopenharmony_ci                                     sizei bufSize, sizei length,
9575bd8deadSopenharmony_ci                                     char *uniformBlockName);
9585bd8deadSopenharmony_ci
9595bd8deadSopenharmony_ci    are equivalent to calling
9605bd8deadSopenharmony_ci
9615bd8deadSopenharmony_ci      GetProgramResourceIndex(program, UNIFORM_BLOCK, uniformBlockName);
9625bd8deadSopenharmony_ci
9635bd8deadSopenharmony_ci    and
9645bd8deadSopenharmony_ci
9655bd8deadSopenharmony_ci      GetProgramResourceName(program, UNIFORM_BLOCK, uniformBlockIndex,
9665bd8deadSopenharmony_ci                             bufSize, length, uniformBlockName);
9675bd8deadSopenharmony_ci
9685bd8deadSopenharmony_ci    The command
9695bd8deadSopenharmony_ci
9705bd8deadSopenharmony_ci      void GetActiveUniformBlockiv(uint program, uint uniformBlockIndex,
9715bd8deadSopenharmony_ci                                   enum pname, int *params);
9725bd8deadSopenharmony_ci
9735bd8deadSopenharmony_ci    is equivalent to calling
9745bd8deadSopenharmony_ci
9755bd8deadSopenharmony_ci      GLenum prop;
9765bd8deadSopenharmony_ci      GetProgramResourceiv(program, UNIFORM_BLOCK, uniformBlockIndex,
9775bd8deadSopenharmony_ci                           1, &prop, maxSize, NULL, params);
9785bd8deadSopenharmony_ci
9795bd8deadSopenharmony_ci    where the value of <prop> is taken from Table X.3, based on the value of
9805bd8deadSopenharmony_ci    <pname>, and <maxSize> is taken to specify a sufficiently large buffer to
9815bd8deadSopenharmony_ci    receive all values that would be written to <params>.
9825bd8deadSopenharmony_ci
9835bd8deadSopenharmony_ci        <pname>                         <prop>
9845bd8deadSopenharmony_ci        ------------------------------  ------------------------------
9855bd8deadSopenharmony_ci        UNIFORM_BLOCK_BINDING           BUFFER_BINDING
9865bd8deadSopenharmony_ci        UNIFORM_BLOCK_DATA_SIZE         BUFFER_DATA_SIZE
9875bd8deadSopenharmony_ci        UNIFORM_BLOCK_NAME_LENGTH       NAME_LENGTH
9885bd8deadSopenharmony_ci        UNIFORM_BLOCK_ACTIVE_UNIFORMS   NUM_ACTIVE_VARIABLES
9895bd8deadSopenharmony_ci        UNIFORM_BLOCK_ACTIVE_           ACTIVE_VARIABLES
9905bd8deadSopenharmony_ci          UNIFORM_INDICES
9915bd8deadSopenharmony_ci        UNIFORM_BLOCK_REFERENCED_BY_    REFERENCED_BY_VERTEX_SHADER
9925bd8deadSopenharmony_ci          VERTEX_SHADER
9935bd8deadSopenharmony_ci        UNIFORM_BLOCK_REFERENCED_BY_    REFERENCED_BY_TESS_CONTROL_SHADER
9945bd8deadSopenharmony_ci          TESS_CONTROL_SHADER
9955bd8deadSopenharmony_ci        UNIFORM_BLOCK_REFERENCED_BY_    REFERENCED_BY_TESS_EVALUATION_SHADER
9965bd8deadSopenharmony_ci          TESS_EVALUATION_SHADER
9975bd8deadSopenharmony_ci        UNIFORM_BLOCK_REFERENCED_BY_    REFERENCED_BY_GEOMETRY_SHADER
9985bd8deadSopenharmony_ci          GEOMETRY_SHADER
9995bd8deadSopenharmony_ci        UNIFORM_BLOCK_REFERENCED_BY_    REFERENCED_BY_FRAGMENT_SHADER
10005bd8deadSopenharmony_ci          FRAGMENT_SHADER
10015bd8deadSopenharmony_ci        UNIFORM_BLOCK_REFERENCED_BY_    REFERENCED_BY_COMPUTE_SHADER
10025bd8deadSopenharmony_ci          COMPUTE_SHADER
10035bd8deadSopenharmony_ci
10045bd8deadSopenharmony_ci        Table X.3, GetProgramResourceiv properties used by
10055bd8deadSopenharmony_ci        GetActiveUniformBlockiv.
10065bd8deadSopenharmony_ci
10075bd8deadSopenharmony_ci    To determine the set of active atomic counter buffer binding points used
10085bd8deadSopenharmony_ci    by a program, applications can query the properties and active resources
10095bd8deadSopenharmony_ci    of the ATOMIC_COUNTER_BUFFER interface of a program.
10105bd8deadSopenharmony_ci
10115bd8deadSopenharmony_ci    Additionally, the command
10125bd8deadSopenharmony_ci
10135bd8deadSopenharmony_ci      void GetActiveAtomicCounterBufferiv(uint program, uint bufferIndex,
10145bd8deadSopenharmony_ci                                          enum pname, int *params);
10155bd8deadSopenharmony_ci
10165bd8deadSopenharmony_ci    can be used to determine properties of active atomic counter buffer
10175bd8deadSopenharmony_ci    bindings used by <program> and is equivalent to calling
10185bd8deadSopenharmony_ci
10195bd8deadSopenharmony_ci      GLenum prop;
10205bd8deadSopenharmony_ci      GetProgramResourceiv(program, ATOMIC_COUNTER_BUFFER, bufferIndex,
10215bd8deadSopenharmony_ci                           1, &prop, maxSize, NULL, params);
10225bd8deadSopenharmony_ci
10235bd8deadSopenharmony_ci    where the value of <prop> is taken from Table X.4, based on the value of
10245bd8deadSopenharmony_ci    <pname>, and <maxSize> is taken to specify a sufficiently large buffer to
10255bd8deadSopenharmony_ci    receive all values that would be written to <params>.
10265bd8deadSopenharmony_ci
10275bd8deadSopenharmony_ci        <pname>                         <prop>
10285bd8deadSopenharmony_ci        ------------------------------  ------------------------------
10295bd8deadSopenharmony_ci        ATOMIC_COUNTER_BUFFER_BINDING   BUFFER_BINDING
10305bd8deadSopenharmony_ci        ATOMIC_COUNTER_BUFFER_          BUFFER_DATA_SIZE
10315bd8deadSopenharmony_ci          DATA_SIZE
10325bd8deadSopenharmony_ci        ATOMIC_COUNTER_BUFFER_ACTIVE_   NUM_ACTIVE_VARIABLES
10335bd8deadSopenharmony_ci          ATOMIC_COUNTERS
10345bd8deadSopenharmony_ci        ATOMIC_COUNTER_BUFFER_ACTIVE_   ACTIVE_VARIABLES
10355bd8deadSopenharmony_ci          ATOMIC_COUNTER_INDICES
10365bd8deadSopenharmony_ci        ATOMIC_COUNTER_BUFFER_          REFERENCED_BY_VERTEX_SHADER
10375bd8deadSopenharmony_ci          REFERENCED_BY_VERTEX_SHADER
10385bd8deadSopenharmony_ci        ATOMIC_COUNTER_BUFFER_          REFERENCED_BY_TESS_CONTROL_SHADER
10395bd8deadSopenharmony_ci          REFERENCED_BY_TESS_
10405bd8deadSopenharmony_ci          CONTROL_SHADER
10415bd8deadSopenharmony_ci        ATOMIC_COUNTER_BUFFER_          REFERENCED_BY_TESS_EVALUATION_SHADER
10425bd8deadSopenharmony_ci          REFERENCED_BY_TESS_
10435bd8deadSopenharmony_ci          EVALUATION_SHADER
10445bd8deadSopenharmony_ci        ATOMIC_COUNTER_BUFFER_          REFERENCED_BY_GEOMETRY_SHADER
10455bd8deadSopenharmony_ci          REFERENCED_BY_GEOMETRY_SHADER
10465bd8deadSopenharmony_ci        ATOMIC_COUNTER_BUFFER_          REFERENCED_BY_FRAGMENT_SHADER
10475bd8deadSopenharmony_ci          REFERENCED_BY_FRAGMENT_SHADER
10485bd8deadSopenharmony_ci        ATOMIC_COUNTER_BUFFER_          REFERENCED_BY_COMPUTE_SHADER
10495bd8deadSopenharmony_ci          REFERENCED_BY_COMPUTE_SHADER
10505bd8deadSopenharmony_ci
10515bd8deadSopenharmony_ci        Table X.4, GetProgramResourceiv properties used by
10525bd8deadSopenharmony_ci        GetActiveAtomicCounterBufferiv.
10535bd8deadSopenharmony_ci
10545bd8deadSopenharmony_ci
10555bd8deadSopenharmony_ci    Modify Section 2.14.8, Subroutine Uniform Variables, p. 136
10565bd8deadSopenharmony_ci
10575bd8deadSopenharmony_ci    (This section could probably use some reorganization and a high-level
10585bd8deadSopenharmony_ci     introduction to how subroutines and subroutine variables work.  As
10595bd8deadSopenharmony_ci     written now, it mostly talks about the GL APIs operating on these without
10605bd8deadSopenharmony_ci     a lot of conceptual discussion.  These edits makes this section smaller
10615bd8deadSopenharmony_ci     by redefining the old APIs in terms of the new ones.)
10625bd8deadSopenharmony_ci
10635bd8deadSopenharmony_ci    (replace language in the section describing the active subroutine and
10645bd8deadSopenharmony_ci    subroutine uniform enumeration with the following)
10655bd8deadSopenharmony_ci
10665bd8deadSopenharmony_ci    To determine the set of active subroutines and subroutines used by a
10675bd8deadSopenharmony_ci    particular shader stage of a program, applications can query the
10685bd8deadSopenharmony_ci    properties and active resources of the interfaces for the shader type, as
10695bd8deadSopenharmony_ci    listed in Tables X.5 and X.6.
10705bd8deadSopenharmony_ci
10715bd8deadSopenharmony_ci        Interface                       Shader Type
10725bd8deadSopenharmony_ci        ------------------------------  ------------------------------
10735bd8deadSopenharmony_ci        VERTEX_SUBROUTINE               VERTEX_SHADER
10745bd8deadSopenharmony_ci        TESS_CONTROL_SUBROUTINE         TESS_CONTROL_SHADER
10755bd8deadSopenharmony_ci        TESS_EVALUATION_SUBROUTINE      TESS_EVALUATION_SHADER
10765bd8deadSopenharmony_ci        GEOMETRY_SUBROUTINE             GEOMETRY_SHADER
10775bd8deadSopenharmony_ci        FRAGMENT_SUBROUTINE             FRAGMENT_SHADER
10785bd8deadSopenharmony_ci        COMPUTE_SUBROUTINE              COMPUTE_SHADER
10795bd8deadSopenharmony_ci
10805bd8deadSopenharmony_ci        Table X.5, Interfaces for active subroutines for a particular shader
10815bd8deadSopenharmony_ci        type in a program.
10825bd8deadSopenharmony_ci
10835bd8deadSopenharmony_ci        Interface                       Shader Type
10845bd8deadSopenharmony_ci        ------------------------------  ------------------------------
10855bd8deadSopenharmony_ci        VERTEX_SUBROUTINE_UNIFORM       VERTEX_SHADER
10865bd8deadSopenharmony_ci        TESS_CONTROL_SUBROUTINE_        TESS_CONTROL_SHADER
10875bd8deadSopenharmony_ci          UNIFORM
10885bd8deadSopenharmony_ci        TESS_EVALUATION_SUBROUTINE      TESS_EVALUATION_SHADER
10895bd8deadSopenharmony_ci          UNIFORM
10905bd8deadSopenharmony_ci        GEOMETRY_SUBROUTINE_UNIFORM     GEOMETRY_SHADER
10915bd8deadSopenharmony_ci        FRAGMENT_SUBROUTINE_UNIFORM     FRAGMENT_SHADER
10925bd8deadSopenharmony_ci        COMPUTE_SUBROUTINE_UNIFORM      COMPUTE_SHADER
10935bd8deadSopenharmony_ci
10945bd8deadSopenharmony_ci        Table X.6, Interfaces for active subroutine uniforms for a particular
10955bd8deadSopenharmony_ci        shader type in a program.
10965bd8deadSopenharmony_ci
10975bd8deadSopenharmony_ci    Dedicated commands are provided to determine properties of active
10985bd8deadSopenharmony_ci    subroutines and active subroutine uniforms.  The commands
10995bd8deadSopenharmony_ci
11005bd8deadSopenharmony_ci      uint GetSubroutineIndex(uint program, enum shadertype,
11015bd8deadSopenharmony_ci                              const char *name);
11025bd8deadSopenharmony_ci
11035bd8deadSopenharmony_ci      void GetActiveSubroutineName(uint program, enum shadertype, uint index,
11045bd8deadSopenharmony_ci                                   sizei bufsize, sizei *length, char *name);
11055bd8deadSopenharmony_ci
11065bd8deadSopenharmony_ci    are equivalent to
11075bd8deadSopenharmony_ci
11085bd8deadSopenharmony_ci      GetProgramResourceIndex(program, programInterface, name);
11095bd8deadSopenharmony_ci
11105bd8deadSopenharmony_ci      GetProgramResourceName(program, programInterface, index, bufsize,
11115bd8deadSopenharmony_ci                             length, name);
11125bd8deadSopenharmony_ci
11135bd8deadSopenharmony_ci    where <programInterface> is taken from Table X.5 according to the value of
11145bd8deadSopenharmony_ci    <shadertype>.
11155bd8deadSopenharmony_ci
11165bd8deadSopenharmony_ci    The commands
11175bd8deadSopenharmony_ci
11185bd8deadSopenharmony_ci      void GetSubroutineUniformLocation(uint program, enum shadertype,
11195bd8deadSopenharmony_ci                                        const char *name);
11205bd8deadSopenharmony_ci
11215bd8deadSopenharmony_ci      void GetActiveSubroutineUniformName(uint program, enum shadertype,
11225bd8deadSopenharmony_ci                                          uint index, sizei bufsize,
11235bd8deadSopenharmony_ci                                          sizei *length, char *name);
11245bd8deadSopenharmony_ci
11255bd8deadSopenharmony_ci      void GetActiveSubroutineUniformiv(uint program, enum shadertype,
11265bd8deadSopenharmony_ci                                        uint index, enum pname, int *values);
11275bd8deadSopenharmony_ci
11285bd8deadSopenharmony_ci    are equivalent to
11295bd8deadSopenharmony_ci
11305bd8deadSopenharmony_ci      GetProgramResourceLocation(program, programInterface, name);
11315bd8deadSopenharmony_ci
11325bd8deadSopenharmony_ci      GetProgramResourceName(program, programInterface, index, bufsize, length,
11335bd8deadSopenharmony_ci                             name);
11345bd8deadSopenharmony_ci
11355bd8deadSopenharmony_ci      GetProgramResourceiv(program, programInterface, index, 1, &pname,
11365bd8deadSopenharmony_ci                           maxSize, NULL, values);
11375bd8deadSopenharmony_ci
11385bd8deadSopenharmony_ci    where <programInterface> is taken from Table X.6 according to the value of
11395bd8deadSopenharmony_ci    <shadertype>.  For GetActiveSubroutineUniformiv, <pname> must be one of
11405bd8deadSopenharmony_ci    NUM_COMPATIBLE_SUBROUTINES or COMPATIBLE_SUBROUTINES, and <maxSize> is
11415bd8deadSopenharmony_ci    taken to specify a sufficiently large buffer to receive all values that
11425bd8deadSopenharmony_ci    would be written to <params>.
11435bd8deadSopenharmony_ci
11445bd8deadSopenharmony_ci
11455bd8deadSopenharmony_ci    Modify Section 2.14.11, Output Variables, p. 140
11465bd8deadSopenharmony_ci
11475bd8deadSopenharmony_ci    (replace last paragraph, p. 143 through next-to-last paragraph, p. 144
11485bd8deadSopenharmony_ci    with the following)
11495bd8deadSopenharmony_ci
11505bd8deadSopenharmony_ci    To determine the set of output variables in a linked program object that
11515bd8deadSopenharmony_ci    will be captured in transform feedback mode, applications can query the
11525bd8deadSopenharmony_ci    properties and active resources of the TRANSFORM_FEEDBACK_VARYING
11535bd8deadSopenharmony_ci    interface.
11545bd8deadSopenharmony_ci
11555bd8deadSopenharmony_ci    Additionally, the dedicated command
11565bd8deadSopenharmony_ci
11575bd8deadSopenharmony_ci      void GetTransformFeedbackVarying(uint program, uint index,
11585bd8deadSopenharmony_ci                                       sizei bufSize, sizei *length,
11595bd8deadSopenharmony_ci                                       sizei *size, enum *type, char *name);
11605bd8deadSopenharmony_ci
11615bd8deadSopenharmony_ci    can be used to enumerate properties of a single output variable captured
11625bd8deadSopenharmony_ci    in transform feedback mode, and is equivalent to
11635bd8deadSopenharmony_ci
11645bd8deadSopenharmony_ci      const enum props[] = { ARRAY_SIZE, TYPE };
11655bd8deadSopenharmony_ci      GetProgramResourceName(program, TRANSFORM_FEEDBACK_VARYING, index,
11665bd8deadSopenharmony_ci                             bufSize, length, name);
11675bd8deadSopenharmony_ci      GetProgramResourceiv(program, TRANSFORM_FEEDBACK_VARYING, index,
11685bd8deadSopenharmony_ci                           1, &props[0], 1, NULL, size);
11695bd8deadSopenharmony_ci      GetProgramResourceiv(program, TRANSFORM_FEEDBACK_VARYING, index,
11705bd8deadSopenharmony_ci                           1, &props[1], 1, NULL, (int *) type);
11715bd8deadSopenharmony_ci
11725bd8deadSopenharmony_ci
11735bd8deadSopenharmony_ci    GetTransformFeedbackVarying may be used to query any transform
11745bd8deadSopenharmony_ci    feedback varying variable, not just those specified with
11755bd8deadSopenharmony_ci    TransformFeedbackVarying.
11765bd8deadSopenharmony_ci
11775bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 4.2 (Compatibility Profile) Specification
11785bd8deadSopenharmony_ci(Rasterization)
11795bd8deadSopenharmony_ci
11805bd8deadSopenharmony_ci    Modify Section 3.13.2, Shader Execution, p. 371
11815bd8deadSopenharmony_ci
11825bd8deadSopenharmony_ci    (replace next-to-last paragraph, p. 378 through the first paragraph,
11835bd8deadSopenharmony_ci    p. 379 with the following)
11845bd8deadSopenharmony_ci
11855bd8deadSopenharmony_ci    To determine the set of fragment shader output attribute variables used by
11865bd8deadSopenharmony_ci    a program, applications can query the properties and active resources of
11875bd8deadSopenharmony_ci    the PROGRAM_OUTPUT interface of a program including a fragment shader.
11885bd8deadSopenharmony_ci
11895bd8deadSopenharmony_ci    Additionally, dedicated commands are provided to query the location and
11905bd8deadSopenharmony_ci    fragment color index assigned to a fragment shader output variable.  For
11915bd8deadSopenharmony_ci    the commands
11925bd8deadSopenharmony_ci
11935bd8deadSopenharmony_ci      int GetFragDataLocation(uint program, const char *name);
11945bd8deadSopenharmony_ci
11955bd8deadSopenharmony_ci      int GetFragDataIndex(uint program, const char *name);
11965bd8deadSopenharmony_ci
11975bd8deadSopenharmony_ci    the error INVALID_OPERATION is generated and -1 is returned if <program>
11985bd8deadSopenharmony_ci    has not been linked or was last linked unsuccessfully.  If <program> has
11995bd8deadSopenharmony_ci    been successfully linked but contains no fragment shader, no error will be
12005bd8deadSopenharmony_ci    generated but -1 will be returned.  Otherwise, the commands are equivalent
12015bd8deadSopenharmony_ci    to calling:
12025bd8deadSopenharmony_ci
12035bd8deadSopenharmony_ci      GetProgramResourceLocation(program, PROGRAM_OUTPUT, name);
12045bd8deadSopenharmony_ci
12055bd8deadSopenharmony_ci    or
12065bd8deadSopenharmony_ci
12075bd8deadSopenharmony_ci      GetProgramResourceLocationIndex(program, PROGRAM_OUTPUT, name);
12085bd8deadSopenharmony_ci
12095bd8deadSopenharmony_ci
12105bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 4.2 (Compatibility Profile) Specification
12115bd8deadSopenharmony_ci(Per-Fragment Operations and the Frame Buffer)
12125bd8deadSopenharmony_ci
12135bd8deadSopenharmony_ci    None.
12145bd8deadSopenharmony_ci
12155bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 4.2 (Compatibility Profile) Specification
12165bd8deadSopenharmony_ci(Special Functions)
12175bd8deadSopenharmony_ci
12185bd8deadSopenharmony_ci    None.  Note that all the commands added here are not included in display
12195bd8deadSopenharmony_ci    lists, but no specification edits are required since existing blanket
12205bd8deadSopenharmony_ci    language covers all Get* commands.
12215bd8deadSopenharmony_ci
12225bd8deadSopenharmony_ci
12235bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 4.2 (Compatibility Profile) Specification
12245bd8deadSopenharmony_ci(State and State Requests)
12255bd8deadSopenharmony_ci
12265bd8deadSopenharmony_ci    None.
12275bd8deadSopenharmony_ci
12285bd8deadSopenharmony_ciAdditions to Appendix A of the OpenGL 4.2 (Compatibility Profile)
12295bd8deadSopenharmony_ciSpecification (Invariance)
12305bd8deadSopenharmony_ci
12315bd8deadSopenharmony_ci    None.
12325bd8deadSopenharmony_ci
12335bd8deadSopenharmony_ciAdditions to Appendix D of the OpenGL 4.2 (Compatibility Profile)
12345bd8deadSopenharmony_ciSpecification (Shared Objects and Multiple Contexts)
12355bd8deadSopenharmony_ci
12365bd8deadSopenharmony_ci    None.
12375bd8deadSopenharmony_ci
12385bd8deadSopenharmony_ciAdditions to the AGL/EGL/GLX/WGL Specifications
12395bd8deadSopenharmony_ci
12405bd8deadSopenharmony_ci    None
12415bd8deadSopenharmony_ci
12425bd8deadSopenharmony_ciGLX Protocol
12435bd8deadSopenharmony_ci
12445bd8deadSopenharmony_ci    TBD
12455bd8deadSopenharmony_ci
12465bd8deadSopenharmony_ciDependencies on OpenGL 3.0, ARB_transform_feedback, and EXT_transform_feedback
12475bd8deadSopenharmony_ci
12485bd8deadSopenharmony_ci    If OpenGL 3.0, ARB_transform_feedback, and EXT_transform_feedback are not
12495bd8deadSopenharmony_ci    supported, references to the TRANSFORM_FEEDBACK_VARYING interface should
12505bd8deadSopenharmony_ci    be removed.
12515bd8deadSopenharmony_ci
12525bd8deadSopenharmony_ciDependencies on OpenGL 3.1 and ARB_uniform_buffer_object
12535bd8deadSopenharmony_ci
12545bd8deadSopenharmony_ci    If OpenGL 3.1 and ARB_uniform_buffer_object are not supported, references
12555bd8deadSopenharmony_ci    to the UNIFORM_BLOCK interface should be removed.
12565bd8deadSopenharmony_ci
12575bd8deadSopenharmony_ciDependencies on OpenGL 4.0 and ARB_shader_subroutine
12585bd8deadSopenharmony_ci
12595bd8deadSopenharmony_ci    If OpenGL 4.0 and ARB_shader_subroutine are not supported, references to
12605bd8deadSopenharmony_ci    the VERTEX_SUBROUTINE, TESS_CONTROL_SUBROUTINE,
12615bd8deadSopenharmony_ci    TESS_EVALUATION_SUBROUTINE, GEOMETRY_SUBROUTINE, FRAGMENT_SUBROUTINE,
12625bd8deadSopenharmony_ci    COMPUTE_SUBROUTINE, VERTEX_SUBROUTINE_UNIFORM,
12635bd8deadSopenharmony_ci    TESS_CONTROL_SUBROUTINE_UNIFORM, TESS_EVALUATION_SUBROUTINE_UNIFORM,
12645bd8deadSopenharmony_ci    GEOMETRY_SUBROUTINE_UNIFORM, FRAGMENT_SUBROUTINE_UNIFORM, and
12655bd8deadSopenharmony_ci    COMPUTE_SUBROUTINE_UNIFORM interfaces should be removed.
12665bd8deadSopenharmony_ci
12675bd8deadSopenharmony_ciDependencies on OpenGL 4.2 and ARB_shader_atomic_counters
12685bd8deadSopenharmony_ci
12695bd8deadSopenharmony_ci    If OpenGL 4.2 and ARB_shader_atomic_counters are not supported, references
12705bd8deadSopenharmony_ci    to the ATOMIC_COUNTER_BUFFER interfaces should be removed.
12715bd8deadSopenharmony_ci
12725bd8deadSopenharmony_ciDependencies on OpenGL 4.3 and ARB_shader_storage_buffer_object
12735bd8deadSopenharmony_ci
12745bd8deadSopenharmony_ci    If OpenGL 4.3 and ARB_shader_storage_buffer_object are not supported,
12755bd8deadSopenharmony_ci    references to the BUFFER_VARIABLE and SHADER_STORAGE_BLOCK interfaces
12765bd8deadSopenharmony_ci    should be removed.
12775bd8deadSopenharmony_ci
12785bd8deadSopenharmony_ciDependencies on OpenGL 4.3 and ARB_arrays_of_arrays
12795bd8deadSopenharmony_ci
12805bd8deadSopenharmony_ci    If OpenGL 4.3 and ARB_arrays_of_arrays are not supported, language
12815bd8deadSopenharmony_ci    describing the enumeration of multi-dimensional arrays (i.e., arrays of
12825bd8deadSopenharmony_ci    arrays) should be removed.
12835bd8deadSopenharmony_ci
12845bd8deadSopenharmony_ciDependencies on OpenGL 4.3 and ARB_compute_shader
12855bd8deadSopenharmony_ci
12865bd8deadSopenharmony_ci    If OpenGL 4.3 and ARB_compute_shader are not supported, references to the
12875bd8deadSopenharmony_ci    COMPUTE_SUBROUTINE and COMPUTE_SUBROUTINE_UNIFORM interfaces should be
12885bd8deadSopenharmony_ci    removed.
12895bd8deadSopenharmony_ci
12905bd8deadSopenharmony_ciDependencies on OpenGL 4.3 and ARB_explicit_uniform_location
12915bd8deadSopenharmony_ci
12925bd8deadSopenharmony_ci    If OpenGL 4.3 and ARB_explicit_uniform_location are not supported,
12935bd8deadSopenharmony_ci    references to uniform variables being declared with a layout qualifier
12945bd8deadSopenharmony_ci    should be removed.
12955bd8deadSopenharmony_ci
12965bd8deadSopenharmony_ciErrors
12975bd8deadSopenharmony_ci
12985bd8deadSopenharmony_ci    An INVALID_VALUE error is generated by GetProgramInterfaceiv,
12995bd8deadSopenharmony_ci    GetProgramResourceIndex, GetProgramResourceName, GetProgramResourceiv,
13005bd8deadSopenharmony_ci    GetProgramResourceLocation, and GetProgramResourceLocationIndex if
13015bd8deadSopenharmony_ci    <program> is not the name of either a shader or program object.
13025bd8deadSopenharmony_ci
13035bd8deadSopenharmony_ci    An INVALID_OPERATION error is generated by GetProgramInterfaceiv,
13045bd8deadSopenharmony_ci    GetProgramResourceIndex, GetProgramResourceName, GetProgramResourceiv,
13055bd8deadSopenharmony_ci    GetProgramResourceLocation, and GetProgramResourceLocationIndex if
13065bd8deadSopenharmony_ci    <program> is the name of a shader object.
13075bd8deadSopenharmony_ci
13085bd8deadSopenharmony_ci    INVALID_OPERATION is generated by GetProgramInterfaceiv if the parameter
13095bd8deadSopenharmony_ci    <pname> is not supported for the interface <programInterface>.
13105bd8deadSopenharmony_ci
13115bd8deadSopenharmony_ci    INVALID_ENUM is generated by GetProgramResourceIndex if <programInterface>
13125bd8deadSopenharmony_ci    is ATOMIC_COUNTER_BUFFER.
13135bd8deadSopenharmony_ci
13145bd8deadSopenharmony_ci    INVALID_VALUE is generated by GetProgramResourceName if <index> is greater
13155bd8deadSopenharmony_ci    than or equal to the number of entries in the active resource list for
13165bd8deadSopenharmony_ci    <programInterface>.
13175bd8deadSopenharmony_ci
13185bd8deadSopenharmony_ci    INVALID_ENUM is generated by GetProgramResourceName if <programInterface>
13195bd8deadSopenharmony_ci    is ATOMIC_COUNTER_BUFFER.
13205bd8deadSopenharmony_ci
13215bd8deadSopenharmony_ci    INVALID_VALUE is generated by GetProgramResourceiv if <propCount> is zero.
13225bd8deadSopenharmony_ci
13235bd8deadSopenharmony_ci    INVALID_ENUM is generated by GetProgramResourceiv if any value in <props>
13245bd8deadSopenharmony_ci    is not a property name supported by the command.
13255bd8deadSopenharmony_ci
13265bd8deadSopenharmony_ci    INVALID_OPERATION is generated by GetProgramResourceiv if any value in
13275bd8deadSopenharmony_ci    <props> is not supported for the interface <programInterface>.
13285bd8deadSopenharmony_ci
13295bd8deadSopenharmony_ci    INVALID_OPERATION is generated by GetProgramResourceLocation and
13305bd8deadSopenharmony_ci    GetProgramResourceLocationIndex if <program> has not been linked or was
13315bd8deadSopenharmony_ci    last linked unsuccessfully.
13325bd8deadSopenharmony_ci
13335bd8deadSopenharmony_ciNew State
13345bd8deadSopenharmony_ci
13355bd8deadSopenharmony_ci    Insert new tables after Table 6.53, Program Object State (cont.), p. 557:
13365bd8deadSopenharmony_ci
13375bd8deadSopenharmony_ci    Add table, labeled "Program Interface State"
13385bd8deadSopenharmony_ci
13395bd8deadSopenharmony_ci                                                                   Initial
13405bd8deadSopenharmony_ci    Get Value                         Type  Get Command            Value    Description                 Sec.
13415bd8deadSopenharmony_ci    -----------------------           ----  -----------            -------  ------------------------    -----
13425bd8deadSopenharmony_ci    ACTIVE_RESOURCES                  nxZ+  GetProgramInterfaceiv     0     number of active resources  2.14.3
13435bd8deadSopenharmony_ci                                                                            on an interface
13445bd8deadSopenharmony_ci    MAX_NAME_LENGTH                   nxZ+  GetProgramInterfaceiv     0     maximum name length for     2.14.3
13455bd8deadSopenharmony_ci                                                                            active resources
13465bd8deadSopenharmony_ci    MAX_NUM_ACTIVE_VARIABLES          nxZ+  GetProgramInterfaceiv     0     maximum number of active    2.14.3
13475bd8deadSopenharmony_ci                                                                            variables for active
13485bd8deadSopenharmony_ci                                                                            resources
13495bd8deadSopenharmony_ci    MAX_NUM_COMPATIBLE_SUBROUTINES    nxZ+  GetProgramInterfaceiv     0     maximum number of compat-   2.14.3
13505bd8deadSopenharmony_ci                                                                            ible subroutines for
13515bd8deadSopenharmony_ci                                                                            subroutine uniforms
13525bd8deadSopenharmony_ci
13535bd8deadSopenharmony_ci    Add table, labeled "Program Object Resource State"
13545bd8deadSopenharmony_ci
13555bd8deadSopenharmony_ci                                                             Initial
13565bd8deadSopenharmony_ci    Get Value                         Type  Get Command      Value    Description                Sec.
13575bd8deadSopenharmony_ci    -----------------------           ----  -----------      -------  ------------------------   -----
13585bd8deadSopenharmony_ci    NAME_LENGTH                       Z+    GetProgram-         -     length of active resource  2.14.3
13595bd8deadSopenharmony_ci                                              Resourceiv              name
13605bd8deadSopenharmony_ci    TYPE                              Z+    GetProgram-         -     active resource data type  2.14.3
13615bd8deadSopenharmony_ci                                              Resourceiv
13625bd8deadSopenharmony_ci    ARRAY_SIZE                        Z+    GetProgram-         -     active resource array size 2.14.3
13635bd8deadSopenharmony_ci                                              Resourceiv
13645bd8deadSopenharmony_ci    OFFSET                            Z+    GetProgram-         -     active resource offset in  2.14.3
13655bd8deadSopenharmony_ci                                              Resourceiv              memory
13665bd8deadSopenharmony_ci    BLOCK_INDEX                       Z+    GetProgram-         -     index of interface block   2.14.3
13675bd8deadSopenharmony_ci                                              Resourceiv              owning resource
13685bd8deadSopenharmony_ci    ARRAY_STRIDE                      Z+    GetProgram-         -     active resource array      2.14.3
13695bd8deadSopenharmony_ci                                              Resourceiv              stride in memory
13705bd8deadSopenharmony_ci    MATRIX_STRIDE                     Z+    GetProgram-         -     active resource matrix     2.14.3
13715bd8deadSopenharmony_ci                                              Resourceiv              stride in memory
13725bd8deadSopenharmony_ci    IS_ROW_MAJOR                      Z+    GetProgram-         -     active resource stored as  2.14.3
13735bd8deadSopenharmony_ci                                              Resourceiv              a row major matrix?
13745bd8deadSopenharmony_ci    ATOMIC_COUNTER_BUFFER_INDEX       Z+    GetProgram-         -     index of atomic counter    2.14.3
13755bd8deadSopenharmony_ci                                              Resourceiv              buffer owning resource
13765bd8deadSopenharmony_ci    BUFFER_BINDING                    Z+    GetProgram-         -     buffer binding assigned    2.14.3
13775bd8deadSopenharmony_ci                                              Resourceiv              to active resource
13785bd8deadSopenharmony_ci    BUFFER_DATA_SIZE                  Z+    GetProgram-         -     minimum buffer data size   2.14.3
13795bd8deadSopenharmony_ci                                              Resourceiv              required for resource
13805bd8deadSopenharmony_ci    NUM_ACTIVE_VARIABLES              Z+    GetProgram-         -     number of active variables 2.14.3
13815bd8deadSopenharmony_ci                                              Resourceiv              owned by active resource
13825bd8deadSopenharmony_ci    ACTIVE_VARIABLES                  Z+    GetProgram-         -     list of active variables   2.14.3
13835bd8deadSopenharmony_ci                                              Resourceiv              owned by active resource
13845bd8deadSopenharmony_ci    REFERENCED_BY_VERTEX_SHADER       Z+    GetProgram-         -     active resource used by    2.14.3
13855bd8deadSopenharmony_ci                                              Resourceiv              vertex shader?
13865bd8deadSopenharmony_ci    REFERENCED_BY_TESS_CONTROL_       Z+    GetProgram-         -     active resource used by    2.14.3
13875bd8deadSopenharmony_ci      SHADER                                  Resourceiv              tess. control shader?
13885bd8deadSopenharmony_ci    REFERENCED_BY_TESS_EVALUATION_    Z+    GetProgram-         -     active resource used by    2.14.3
13895bd8deadSopenharmony_ci      SHADER                                  Resourceiv              tess evaluation shader?
13905bd8deadSopenharmony_ci    REFERENCED_BY_GEOMETRY_SHADER     Z+    GetProgram-         -     active resource used by    2.14.3
13915bd8deadSopenharmony_ci                                              Resourceiv              geometry shader?
13925bd8deadSopenharmony_ci    REFERENCED_BY_FRAGMENT_SHADER     Z+    GetProgram-         -     active resource used by    2.14.3
13935bd8deadSopenharmony_ci                                              Resourceiv              fragment shader?
13945bd8deadSopenharmony_ci    REFERENCED_BY_COMPUTE_SHADER      Z+    GetProgram-         -     active resource used by    2.14.3
13955bd8deadSopenharmony_ci                                              Resourceiv              compute shader?
13965bd8deadSopenharmony_ci    TOP_LEVEL_ARRAY_SIZE              Z+    GetProgram-         -     array size of top level    2.14.3
13975bd8deadSopenharmony_ci                                              Resourceiv              shd. storage block member
13985bd8deadSopenharmony_ci    TOP_LEVEL_ARRAY_STRIDE            Z+    GetProgram-         -     array stride of top level  2.14.3
13995bd8deadSopenharmony_ci                                              Resourceiv              shd. storage block member
14005bd8deadSopenharmony_ci    LOCATION                          Z+    GetProgram-         -     location assigned to       2.14.3
14015bd8deadSopenharmony_ci                                              Resourceiv              active resource
14025bd8deadSopenharmony_ci    LOCATION_INDEX                    Z+    GetProgram-         -     location index assigned    2.14.3
14035bd8deadSopenharmony_ci                                              Resourceiv              to active resource
14045bd8deadSopenharmony_ci    IS_PER_PATCH                      Z+    GetProgram-         -     is active input/output     2.14.3
14055bd8deadSopenharmony_ci                                              Resourceiv              a per-patch attribute?
14065bd8deadSopenharmony_ci    NUM_COMPATIBLE_SUBROUTINES        Z+    GetProgram-         -     number of compatible       2.14.3
14075bd8deadSopenharmony_ci                                              Resourceiv              subroutines for active
14085bd8deadSopenharmony_ci                                                                      subroutine uniform
14095bd8deadSopenharmony_ci    COMPATIBLE_SUBROUTINES            Z+    GetProgram-         -     list of compatible         2.14.3
14105bd8deadSopenharmony_ci                                              Resourceiv              subroutines for active
14115bd8deadSopenharmony_ci                                                                      subroutine uniform
14125bd8deadSopenharmony_ci
14135bd8deadSopenharmony_ciNew Implementation Dependent State
14145bd8deadSopenharmony_ci
14155bd8deadSopenharmony_ci    None.
14165bd8deadSopenharmony_ci
14175bd8deadSopenharmony_ciSample Code
14185bd8deadSopenharmony_ci
14195bd8deadSopenharmony_ci    !!! TBD !!!
14205bd8deadSopenharmony_ci
14215bd8deadSopenharmony_ciConformance Tests
14225bd8deadSopenharmony_ci
14235bd8deadSopenharmony_ci    !!! TBD !!!
14245bd8deadSopenharmony_ci
14255bd8deadSopenharmony_ciIssues
14265bd8deadSopenharmony_ci
14275bd8deadSopenharmony_ci    (1) Does the list of active resources in a program include built-ins where
14285bd8deadSopenharmony_ci        applicable?
14295bd8deadSopenharmony_ci
14305bd8deadSopenharmony_ci      RESOLVED:  Yes; built-ins should be enumerated when present.
14315bd8deadSopenharmony_ci
14325bd8deadSopenharmony_ci    (2) Should this extension fully support all program interfaces and
14335bd8deadSopenharmony_ci        resources, even those that have limited or no query capabilities
14345bd8deadSopenharmony_ci        today?  In particular, there is very little enumeration support for
14355bd8deadSopenharmony_ci        fragment outputs and transform feedback varyings.  OpenGL 4.1 added
14365bd8deadSopenharmony_ci        ARB_separate_shader_objects that allowed two independent programs to
14375bd8deadSopenharmony_ci        form an interface, but provided no mechanism for querying the active
14385bd8deadSopenharmony_ci        variables on either side of that interface.
14395bd8deadSopenharmony_ci
14405bd8deadSopenharmony_ci      RESOLVED:  Let's support as much as we can with a single set of
14415bd8deadSopenharmony_ci      functions.
14425bd8deadSopenharmony_ci
14435bd8deadSopenharmony_ci    (3) How should we support enumeration of variables and interface blocks
14445bd8deadSopenharmony_ci        provided by the ARB_shader_storage_buffer_object extension?
14455bd8deadSopenharmony_ci
14465bd8deadSopenharmony_ci      RESOLVED:  The enumeration mechanisms provided by this extension will be
14475bd8deadSopenharmony_ci      the only way to enumerate buffer variables and shader storage blocks.
14485bd8deadSopenharmony_ci      ARB_shader_storage_buffer_object will require this extension.
14495bd8deadSopenharmony_ci
14505bd8deadSopenharmony_ci    (4) The commands provided this extension are intended to supersede
14515bd8deadSopenharmony_ci        existing enumeration APIs (e.g., GetActiveUniform, GetActiveAttrib).
14525bd8deadSopenharmony_ci        The old APIs can eventually be deprecated.  Both new and old APIs
14535bd8deadSopenharmony_ci        generate a list of active resources and assign indices to each entry
14545bd8deadSopenharmony_ci        in the list.  Should assigned indices match between the new and old
14555bd8deadSopenharmony_ci        APIs?
14565bd8deadSopenharmony_ci
14575bd8deadSopenharmony_ci      RESOLVED:  Yes.  While there is no strong reason why the new APIs
14585bd8deadSopenharmony_ci      couldn't adopt new enumeration rules for existing resource types, it's
14595bd8deadSopenharmony_ci      easier to enumerate the same way that we've done for the older API
14605bd8deadSopenharmony_ci      calls, for several reasons:
14615bd8deadSopenharmony_ci
14625bd8deadSopenharmony_ci        * Minimizes changes for existing applications using the old
14635bd8deadSopenharmony_ci          enumeration APIs or for applications needing to support both the new
14645bd8deadSopenharmony_ci          and old APIs.  All they need to do is map their existing API usage
14655bd8deadSopenharmony_ci          to the new APIs without having to reconsider whether any other
14665bd8deadSopenharmony_ci          assumption of their old logic is still valid.
14675bd8deadSopenharmony_ci
14685bd8deadSopenharmony_ci        * Minimizes complexity for implementations needing to support both new
14695bd8deadSopenharmony_ci          and old APIs, at least until the old APIs are deprecated/removed.
14705bd8deadSopenharmony_ci
14715bd8deadSopenharmony_ci        * Makes it easier to redefine the existing functions in terms of the
14725bd8deadSopenharmony_ci          new ones.
14735bd8deadSopenharmony_ci
14745bd8deadSopenharmony_ci    (5) Existing enumeration APIs handle entities like arrays of structures by
14755bd8deadSopenharmony_ci        unrolling them.  For example, a uniform array of structures with 8
14765bd8deadSopenharmony_ci        elements and 3 structure members will result in 24 entries enumerated
14775bd8deadSopenharmony_ci        by GetActiveUniform.  Should we re-work the API to enumerate fewer
14785bd8deadSopenharmony_ci        entries?
14795bd8deadSopenharmony_ci
14805bd8deadSopenharmony_ci      RESOLVED:  For existing resources, no, for the reasons discussed above.
14815bd8deadSopenharmony_ci      The main problem with that approach is if a shader uses a uniform block
14825bd8deadSopenharmony_ci      with a large array of structures.  For newer resource types, we can and
14835bd8deadSopenharmony_ci      will adopt new rules.
14845bd8deadSopenharmony_ci
14855bd8deadSopenharmony_ci    (6) How should enumeration rules work for complex arrays/structures in
14865bd8deadSopenharmony_ci        shader storage blocks (ARB_shader_storage_buffer_object)?
14875bd8deadSopenharmony_ci
14885bd8deadSopenharmony_ci      RESOLVED:  One of the intended use cases is to allow for shader storage
14895bd8deadSopenharmony_ci      blocks consisting of little more than a large (or unsized) array of
14905bd8deadSopenharmony_ci      structures.  For example, we might have shader code like:
14915bd8deadSopenharmony_ci
14925bd8deadSopenharmony_ci        struct VertexInfo {
14935bd8deadSopenharmony_ci          float position[3];
14945bd8deadSopenharmony_ci          float normal[3];
14955bd8deadSopenharmony_ci        };
14965bd8deadSopenharmony_ci        buffer VertexCollection {
14975bd8deadSopenharmony_ci          VertexInfo v[10000];
14985bd8deadSopenharmony_ci        };
14995bd8deadSopenharmony_ci
15005bd8deadSopenharmony_ci      If existing uniform enumeration API rules were applied, this would
15015bd8deadSopenharmony_ci      enumerate 20000 separate active resources (10000 array elements with two
15025bd8deadSopenharmony_ci      members each).  That seems crazy.  This specification optimizes for this
15035bd8deadSopenharmony_ci      case by flattening arrays at the top of the block.  For that shader, we
15045bd8deadSopenharmony_ci      would enumerate only the first element of each array ("v[0].position[0]"
15055bd8deadSopenharmony_ci      and "v[0].normal[0]").  The properties TOP_LEVEL_ARRAY_SIZE and
15065bd8deadSopenharmony_ci      TOP_LEVEL_ARRAY_STRIDE allow applications to determine the size (if
15075bd8deadSopenharmony_ci      declared) and stride in buffer object memory.
15085bd8deadSopenharmony_ci
15095bd8deadSopenharmony_ci      For more complex hierarchies, we chose to continue unrolling arrays in
15105bd8deadSopenharmony_ci      the middle of the hierarchy to avoid the need to specify a more complex
15115bd8deadSopenharmony_ci      API.  For example, in this code
15125bd8deadSopenharmony_ci
15135bd8deadSopenharmony_ci        struct VertexInfo {
15145bd8deadSopenharmony_ci          float position[3];
15155bd8deadSopenharmony_ci          float normal[3];
15165bd8deadSopenharmony_ci        };
15175bd8deadSopenharmony_ci        struct TriangleInfo {
15185bd8deadSopenharmony_ci          VertexInfo v[3];
15195bd8deadSopenharmony_ci        };
15205bd8deadSopenharmony_ci        buffer VertexCollection {
15215bd8deadSopenharmony_ci          TriangleInfo t[10000];
15225bd8deadSopenharmony_ci        };
15235bd8deadSopenharmony_ci
15245bd8deadSopenharmony_ci      we would unroll "TriangleInfo" and enumerate six resources:
15255bd8deadSopenharmony_ci
15265bd8deadSopenharmony_ci        t[0].v[0].position[0]
15275bd8deadSopenharmony_ci        t[0].v[0].normal[0]
15285bd8deadSopenharmony_ci        t[0].v[1].position[0]
15295bd8deadSopenharmony_ci        t[0].v[1].normal[0]
15305bd8deadSopenharmony_ci        t[0].v[2].position[0]
15315bd8deadSopenharmony_ci        t[0].v[2].normal[0]
15325bd8deadSopenharmony_ci
15335bd8deadSopenharmony_ci      Flattening "v[]" to a single entry would require either some sort of
15345bd8deadSopenharmony_ci      recursive enumeration (e.g., enumerate "t" as a structure and provide
15355bd8deadSopenharmony_ci      "pointers" to a collection of members), or some sort of new property
15365bd8deadSopenharmony_ci      that returns a variable-length array of strides.
15375bd8deadSopenharmony_ci
15385bd8deadSopenharmony_ci    (7) The ARB_array_of_arrays extension allows shaders to declare
15395bd8deadSopenharmony_ci        multi-dimensional arrays that could be enumerated by this API?  How
15405bd8deadSopenharmony_ci        should arrays of arrays be enumerated?
15415bd8deadSopenharmony_ci
15425bd8deadSopenharmony_ci      RESOLVED:  We define rules consistent with our enumeration rules for
15435bd8deadSopenharmony_ci      other complex types.  For existing one-dimensional arrays, we enumerate
15445bd8deadSopenharmony_ci      a single entry if the array is an array of basic types, or separate
15455bd8deadSopenharmony_ci      entries for each array element if the array is an array of structures.
15465bd8deadSopenharmony_ci      We follow similar rules here.  For a uniform array such as:
15475bd8deadSopenharmony_ci
15485bd8deadSopenharmony_ci        uniform vec4 a[5][4][3];
15495bd8deadSopenharmony_ci
15505bd8deadSopenharmony_ci     we enumerate twenty different entries ("a[0][0][0]" through
15515bd8deadSopenharmony_ci     "a[4][3][0]"), each of which is treated as an array with three elements.
15525bd8deadSopenharmony_ci     This is morally equivalent to what you'd get if you worked around the
15535bd8deadSopenharmony_ci     limitation in current GLSL via:
15545bd8deadSopenharmony_ci
15555bd8deadSopenharmony_ci        struct ArrayBottom { vec4 c[3]; };
15565bd8deadSopenharmony_ci        struct ArrayMid    { ArrayBottom b[3]; };
15575bd8deadSopenharmony_ci        uniform ArrayMid   a[5];
15585bd8deadSopenharmony_ci
15595bd8deadSopenharmony_ci     which would enumerate "a[0].b[0].c[0]" through "a[4].b[3].c[0]".
15605bd8deadSopenharmony_ci
15615bd8deadSopenharmony_ci     We also apply the top-level array flattening for shader storage block
15625bd8deadSopenharmony_ci     members.  For example:
15635bd8deadSopenharmony_ci
15645bd8deadSopenharmony_ci       buffer Block {
15655bd8deadSopenharmony_ci         vec4 a[5][4][3];
15665bd8deadSopenharmony_ci       };
15675bd8deadSopenharmony_ci
15685bd8deadSopenharmony_ci     would enumerate only four entries -- "a[0][0][0]" through "a[0][3][0]",
15695bd8deadSopenharmony_ci     where each enumerated entry corresponds to an array of size 3, has a
15705bd8deadSopenharmony_ci     top-level size of 5, and has a top-level stride appropriate for its
15715bd8deadSopenharmony_ci     layout in memory.
15725bd8deadSopenharmony_ci
15735bd8deadSopenharmony_ci    (8) For GetProgramResourceIndex, what sort of strings can be used to match
15745bd8deadSopenharmony_ci        the resource names for arrays of arrays?  For example, let's say a
15755bd8deadSopenharmony_ci        shader declares a uniform such as:
15765bd8deadSopenharmony_ci
15775bd8deadSopenharmony_ci          uniform vec4 a[3][4][5];
15785bd8deadSopenharmony_ci
15795bd8deadSopenharmony_ci       Which one of the following names are accepted?  "a[2][1][0]" to
15805bd8deadSopenharmony_ci       identify the base of the bottom-level array?  "a[2][1]", to identify
15815bd8deadSopenharmony_ci       the same without the final "[0]"?  "a[2]", equivalent to "a[2][0][0]"?
15825bd8deadSopenharmony_ci       Just "a", equivalent to "a[0][0][0]"?
15835bd8deadSopenharmony_ci
15845bd8deadSopenharmony_ci       RESOLVED:  We only accept entries of the form "a[2][1][0]" or
15855bd8deadSopenharmony_ci       "a[2][1]", which is consistent with the existing rules that only allow
15865bd8deadSopenharmony_ci       applications to omit the last index of a bottom-level array that has
15875bd8deadSopenharmony_ci       been rolled up.
15885bd8deadSopenharmony_ci
15895bd8deadSopenharmony_ci    (9) Should be consolidate the commands GetAttribLocation,
15905bd8deadSopenharmony_ci        GetUniformLocation, GetSubroutineUniformLocation, GetFragDataLocation
15915bd8deadSopenharmony_ci        (and GetFragDataIndex) into a single generic API?
15925bd8deadSopenharmony_ci
15935bd8deadSopenharmony_ci        RESOLVED:  Yes.  This spec provides GetProgramResourceLocation and
15945bd8deadSopenharmony_ci        GetProgramResourceLocationIndex commands to consolidate the existing
15955bd8deadSopenharmony_ci        set of commands.  Additionally, GetProgramResourceiv can be used to
15965bd8deadSopenharmony_ci        query locations via the LOCATION and LOCATION_INDEX properties.
15975bd8deadSopenharmony_ci
15985bd8deadSopenharmony_ci        There are a number of irregularities in the assignment of locations as
15995bd8deadSopenharmony_ci        compared to other uniform types:
16005bd8deadSopenharmony_ci
16015bd8deadSopenharmony_ci          * Atomic counter uniforms, uniforms in blocks are not assigned
16025bd8deadSopenharmony_ci            locations.
16035bd8deadSopenharmony_ci
16045bd8deadSopenharmony_ci          * Built in inputs and outputs are not assigned locations.
16055bd8deadSopenharmony_ci
16065bd8deadSopenharmony_ci          * The locations of inputs other than vertex shader inputs and
16075bd8deadSopenharmony_ci            fragment shader outputs don't interact with any other GL state;
16085bd8deadSopenharmony_ci            they are used only for interfacing with other programs.  For such
16095bd8deadSopenharmony_ci            variables, we choose the return the specified location number if a
16105bd8deadSopenharmony_ci            variable is declared with a layout qualifier, and -1 (no valid
16115bd8deadSopenharmony_ci            location) otherwise.  Variables declared without location layout
16125bd8deadSopenharmony_ci            qualifiers will be assigned an internal location by the
16135bd8deadSopenharmony_ci            compiler/linker, but those locations do not necessarily correspond
16145bd8deadSopenharmony_ci            to the canonical integer locations supported in layout qualifiers.
16155bd8deadSopenharmony_ci
16165bd8deadSopenharmony_ci          * For fragment shader outputs, not only do we have a location, but
16175bd8deadSopenharmony_ci            we also have an associated index that can be queried with
16185bd8deadSopenharmony_ci            GetFragDataIndex.
16195bd8deadSopenharmony_ci
16205bd8deadSopenharmony_ci    (10) What should we do about tokens like ACTIVE_UNIFORMS and
16215bd8deadSopenharmony_ci         ACTIVE_UNIFORM_MAX_LENGTH that are specific to an interface, but are
16225bd8deadSopenharmony_ci         queried today by GetProgramiv?
16235bd8deadSopenharmony_ci
16245bd8deadSopenharmony_ci      RESOLVED:  We provide a new GetProgramInterfaceiv query to return
16255bd8deadSopenharmony_ci      properties of an interface.  The value returned today by ACTIVE_UNIFORMS
16265bd8deadSopenharmony_ci      can be determined by calling GetProgramInterfaceiv with a
16275bd8deadSopenharmony_ci      <programInterface> of UNIFORM and a <pname> of ACTIVE_RESOURCES.
16285bd8deadSopenharmony_ci      ACTIVE_RESOURCES can also be used for other interfaces to get values
16295bd8deadSopenharmony_ci      returned today with other query tokens (e.g., ACTIVE_ATTRIBUTES).
16305bd8deadSopenharmony_ci
16315bd8deadSopenharmony_ci    (11) What sort of interface should we use for querying properties of
16325bd8deadSopenharmony_ci         active resources?  We have two different styles of query today.
16335bd8deadSopenharmony_ci         Functions like GetActiveUniform() allow applications to query
16345bd8deadSopenharmony_ci         multiple (fixed) properties of a single active uniform.  Functions
16355bd8deadSopenharmony_ci         like GetActiveUniforms() allow applications to query a single
16365bd8deadSopenharmony_ci         property of multiple active uniforms?
16375bd8deadSopenharmony_ci
16385bd8deadSopenharmony_ci      RESOLVED:  GetProgramResourceiv allows applications to query multiple
16395bd8deadSopenharmony_ci      properties of a single resource in a single call; applications pass in
16405bd8deadSopenharmony_ci      an array of properties to query.
16415bd8deadSopenharmony_ci
16425bd8deadSopenharmony_ci      We considered providing a command GetProgramResourcesiv that would have
16435bd8deadSopenharmony_ci      allowed an application to query multiple properties of multiple
16445bd8deadSopenharmony_ci      resources in a single call, by passing in an array of resource indices.
16455bd8deadSopenharmony_ci      We decided not to include this for simplicity.  Also note that the most
16465bd8deadSopenharmony_ci      common use case we envisioned would be to query all properties of all
16475bd8deadSopenharmony_ci      active resources, with code like the following:
16485bd8deadSopenharmony_ci
16495bd8deadSopenharmony_ci        struct VariableInfo {
16505bd8deadSopenharmony_ci          GLenum type;
16515bd8deadSopenharmony_ci          GLint location;
16525bd8deadSopenharmony_ci        };
16535bd8deadSopenharmony_ci        GLenum inputProps[] = { GL_TYPE, GL_LOCATION };
16545bd8deadSopenharmony_ci        GLuint nInputProps = sizeof(inputProps) / sizeof(GLenum);
16555bd8deadSopenharmony_ci        GLint nActive;
16565bd8deadSopenharmony_ci        glGetProgramInterface(program, GL_PROGRAM_INPUT, GL_ACTIVE_RESOURCES,
16575bd8deadSopenharmony_ci                              &nActive);
16585bd8deadSopenharmony_ci        VariableInfo *varInfo = malloc(nActive*sizeof(VariableInfo));
16595bd8deadSopenharmony_ci        GLuint *indices = malloc(nActive*sizeof(GLuint));
16605bd8deadSopenharmony_ci        for (GLuint i = 0; i < nActive; i++) { indices[i] = i; }
16615bd8deadSopenharmony_ci        glGetProgramResourcesiv(program, GL_PROGRAM_INPUT,
16625bd8deadSopenharmony_ci                                nActive, indices, nInputProps, inputProps,
16635bd8deadSopenharmony_ci                                nActive*nInputProps, NULL, (GLint*)varInfo);
16645bd8deadSopenharmony_ci
16655bd8deadSopenharmony_ci      Such an API would require applications to fill in a dummy array of
16665bd8deadSopenharmony_ci      indices to express "all indices".  With the simplified API, more GL
16675bd8deadSopenharmony_ci      calls are required, but the code is overall simpler:
16685bd8deadSopenharmony_ci
16695bd8deadSopenharmony_ci        glGetProgramInterface(program, GL_PROGRAM_INPUT, GL_ACTIVE_RESOURCES,
16705bd8deadSopenharmony_ci                              &nActive);
16715bd8deadSopenharmony_ci        VariableInfo *varInfo = malloc(nActive*sizeof(VariableInfo));
16725bd8deadSopenharmony_ci        for (GLuint i = 0; i < nActive; i++) {
16735bd8deadSopenharmony_ci          glGetProgramResourceiv(program, GL_PROGRAM_INPUT, i,
16745bd8deadSopenharmony_ci                                 nInputProps, inputProps,
16755bd8deadSopenharmony_ci                                 nActive*nInputProps, NULL,
16765bd8deadSopenharmony_ci                                 (GLint*) (&varInfo[i]));
16775bd8deadSopenharmony_ci        }
16785bd8deadSopenharmony_ci
16795bd8deadSopenharmony_ci    (12) For GetProgramResourceiv, how should we handle queries of properties
16805bd8deadSopenharmony_ci         that return a variable number of values (e.g.,
16815bd8deadSopenharmony_ci         COMPATIBLE_SUBROUTINES)?  Should we support these queries in the
16825bd8deadSopenharmony_ci         general "multiple properties of multiple resources" query, or provide
16835bd8deadSopenharmony_ci         a separate "single property of single resource query"?  Should we
16845bd8deadSopenharmony_ci         just write out a variable number of values to <params>?  If we allow
16855bd8deadSopenharmony_ci         for a variable number of values to be written to <params>, should we
16865bd8deadSopenharmony_ci         provide some sort of <bufSize> parameter to guard against overflows?
16875bd8deadSopenharmony_ci
16885bd8deadSopenharmony_ci      RESOLVED:  We will support these properties in the general "multiple
16895bd8deadSopenharmony_ci      properties of a single resource" query and write out the variable number
16905bd8deadSopenharmony_ci      of values to consecutive locations in the array.  If an application
16915bd8deadSopenharmony_ci      wants to query such properties for multiple resources at once, it can
16925bd8deadSopenharmony_ci      parse the values returned by the GL.  If NUM_COMPATIBLE_SUBROUTINES is
16935bd8deadSopenharmony_ci      immediately before COMPATIBLE_SUBROUTINES in the property list, the
16945bd8deadSopenharmony_ci      number of compatible subroutines written to the buffer (N) will be found
16955bd8deadSopenharmony_ci      immediately immediately prior to the N compatible subroutine numbers.
16965bd8deadSopenharmony_ci      We will provide a <bufSize> parameter to guard against overflow.
16975bd8deadSopenharmony_ci      Applications can ensure they have an adequately-sized buffer by calling
16985bd8deadSopenharmony_ci      GetProgramInterfaceiv with a <pname> of MAX_NUM_COMPATIBLE_SUBROUTINES
16995bd8deadSopenharmony_ci      to determine the maximum number of subroutines that will be written to
17005bd8deadSopenharmony_ci      any one buffer.
17015bd8deadSopenharmony_ci
17025bd8deadSopenharmony_ci      It's not clear how valuable the variable-length enumeration queries
17035bd8deadSopenharmony_ci      actually are.  Unextended OpenGL 4.2 has two such queries today:
17045bd8deadSopenharmony_ci      COMPATIBLE_SUBROUTINES and UNIFORM_BLOCK_ACTIVE_UNIFORMS.
17055bd8deadSopenharmony_ci      UNIFORM_BLOCK_ACTIVE_UNIFORMS isn't strictly needed; an application can
17065bd8deadSopenharmony_ci      determine this list themselves by querying the UNIFORM_BLOCK_INDEX
17075bd8deadSopenharmony_ci      property of each active uniform.  We could do something similar for
17085bd8deadSopenharmony_ci      compatible subroutines.
17095bd8deadSopenharmony_ci
17105bd8deadSopenharmony_ci    (13) Should we add a mechanism for enumerating subroutine types supported
17115bd8deadSopenharmony_ci         by a program and querying the subroutine type for subroutines and
17125bd8deadSopenharmony_ci         subroutine uniforms?
17135bd8deadSopenharmony_ci
17145bd8deadSopenharmony_ci      RESOLVED:  No.  Such a mechanism could have been used to reduce the need
17155bd8deadSopenharmony_ci      for variable-length return values for GetProgramResourcesiv in some
17165bd8deadSopenharmony_ci      cases.  Instead of supporting COMPATIBLE_SUBROUTINES (list all
17175bd8deadSopenharmony_ci      subroutines compatible with a uniform type), we could have allowed
17185bd8deadSopenharmony_ci      applications to query the subroutine type for both subroutines and
17195bd8deadSopenharmony_ci      subroutine uniforms and match them in application code.  The problem
17205bd8deadSopenharmony_ci      with that approach is that subroutines can have multiple associated
17215bd8deadSopenharmony_ci      subroutine types, so a variable-length return value would still be
17225bd8deadSopenharmony_ci      needed to query subroutine types.
17235bd8deadSopenharmony_ci
17245bd8deadSopenharmony_ci    (14) Should we support "REFERENCED_BY_*" for uniforms and buffer
17255bd8deadSopenharmony_ci         variables?
17265bd8deadSopenharmony_ci
17275bd8deadSopenharmony_ci      RESOLVED:  Yes.  It isn't supported in unextended OpenGL 4.2, but the
17285bd8deadSopenharmony_ci      functionality seems to make sense.
17295bd8deadSopenharmony_ci
17305bd8deadSopenharmony_ci    (15) Since this extension is being developed at the same time as compute
17315bd8deadSopenharmony_ci         shaders, should we add compute shader-specific enums for the old
17325bd8deadSopenharmony_ci         queries that would be superseded by the the queries added here?  Or
17335bd8deadSopenharmony_ci         should we rely solely on the new queries?  For example, should we add
17345bd8deadSopenharmony_ci         a new token "UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER"?
17355bd8deadSopenharmony_ci
17365bd8deadSopenharmony_ci      RESOLVED:  Yes, we will add old-style enums for the compute shader stage
17375bd8deadSopenharmony_ci      for all previously existing APIs.
17385bd8deadSopenharmony_ci
17395bd8deadSopenharmony_ci    (16) How are inputs and outputs in the built-in interface block
17405bd8deadSopenharmony_ci         "gl_PerVertex" enumerated?
17415bd8deadSopenharmony_ci
17425bd8deadSopenharmony_ci      RESOLVED:  We will follow the default rule for enumerating block members
17435bd8deadSopenharmony_ci      in the OpenGL API, which is:
17445bd8deadSopenharmony_ci
17455bd8deadSopenharmony_ci        * If a variable is a member of an interface block without an instance
17465bd8deadSopenharmony_ci          name, it is enumerated using just the variable name.
17475bd8deadSopenharmony_ci
17485bd8deadSopenharmony_ci        * If a variable is a member of an interface block with an instance
17495bd8deadSopenharmony_ci          name, it is enumerated as "BlockName.Member", where "BlockName" is
17505bd8deadSopenharmony_ci          the name of the interface block (not the instance name) and "Member"
17515bd8deadSopenharmony_ci          is the name of the variable.
17525bd8deadSopenharmony_ci
17535bd8deadSopenharmony_ci      For example, in the following code:
17545bd8deadSopenharmony_ci
17555bd8deadSopenharmony_ci        uniform Block1 {
17565bd8deadSopenharmony_ci          int member1;
17575bd8deadSopenharmony_ci        };
17585bd8deadSopenharmony_ci        uniform Block2 {
17595bd8deadSopenharmony_ci          int member2;
17605bd8deadSopenharmony_ci        } instance2;
17615bd8deadSopenharmony_ci        uniform Block3 {
17625bd8deadSopenharmony_ci          int member3;
17635bd8deadSopenharmony_ci        } instance3[2];  // uses two separate buffer bindings
17645bd8deadSopenharmony_ci
17655bd8deadSopenharmony_ci      the three uniforms (if active) are enumerated as "member1",
17665bd8deadSopenharmony_ci      "Block2.member2", and "Block3.member3".
17675bd8deadSopenharmony_ci
17685bd8deadSopenharmony_ci      For tessellation control, tessellation evaluation, and geometry shaders,
17695bd8deadSopenharmony_ci      per-vertex built-in inputs like gl_Position are in a block with an
17705bd8deadSopenharmony_ci      instance name of "gl_in[]".  Additionally, for tessellation control
17715bd8deadSopenharmony_ci      shaders, per-vertex built-in outputs like gl_Position are in a block
17725bd8deadSopenharmony_ci      with an instance name of "gl_out[]".  In these cases, applying the
17735bd8deadSopenharmony_ci      standard rules would result in an enumerated name of
17745bd8deadSopenharmony_ci      "gl_PerVertex.gl_Position".
17755bd8deadSopenharmony_ci
17765bd8deadSopenharmony_ci    (17) Should we add support for enumerating per-patch shader
17775bd8deadSopenharmony_ci         inputs/outputs?  If so, how to distinguish between per-vertex and
17785bd8deadSopenharmony_ci         per-patch?
17795bd8deadSopenharmony_ci
17805bd8deadSopenharmony_ci      RESOLVED:  Yes.  When program inputs or outputs include per-patch
17815bd8deadSopenharmony_ci      attributes, those variables will be enumerated along with per-vertex
17825bd8deadSopenharmony_ci      attributes.  To determine if an input or output is per-patch, use the
17835bd8deadSopenharmony_ci      resource property IS_PER_PATCH.
17845bd8deadSopenharmony_ci
17855bd8deadSopenharmony_ci    (18) Do we enumerate the special "marker" variables for transform feedback
17865bd8deadSopenharmony_ci         varyings (gl_NextBuffer, gl_SkipComponents[1234])?  If so, what are
17875bd8deadSopenharmony_ci         their properties?
17885bd8deadSopenharmony_ci
17895bd8deadSopenharmony_ci      RESOLVED:  Yes, we should definitely enumerate them so applications can
17905bd8deadSopenharmony_ci      determine programmatically what would be written to transform feedback
17915bd8deadSopenharmony_ci      buffers.  This capability is already supported by the existing
17925bd8deadSopenharmony_ci      GetTransformFeedback query.  We follow the existing behavior -- all of
17935bd8deadSopenharmony_ci      these entries are enumerated with a type of NONE.  gl_NextBuffer returns
17945bd8deadSopenharmony_ci      an array size of 0; gl_SkipComponents[1234] returns an array size equal
17955bd8deadSopenharmony_ci      to the specified number of components.
17965bd8deadSopenharmony_ci
17975bd8deadSopenharmony_ci    (19) Should we support a <bufsize> arguments to prevent buffer overflows
17985bd8deadSopenharmony_ci         on the GetProgramInterfaceiv query?
17995bd8deadSopenharmony_ci
18005bd8deadSopenharmony_ci      RESOLVED:  Yes, to provide a "safe" mechanism since the query might
18015bd8deadSopenharmony_ci      return an unpredictable and program-dependent amount of data.  We also
18025bd8deadSopenharmony_ci      provide a <length> parameter that can be used to return the number of
18035bd8deadSopenharmony_ci      words written by the query to be consistent with other similar APIs.
18045bd8deadSopenharmony_ci
18055bd8deadSopenharmony_ci    (20) Are "old" token names (e.g., UNIFORM_TYPE) accepted by "new"
18065bd8deadSopenharmony_ci         commmands (GetProgramResourceiv)?  Are "new" token names (TYPE)
18075bd8deadSopenharmony_ci         accepted by "old" commands (GetActiveUniforms)?
18085bd8deadSopenharmony_ci
18095bd8deadSopenharmony_ci      RESOLVED:  No.  New queries support only the new enums; old queries
18105bd8deadSopenharmony_ci      support only the old ones.
18115bd8deadSopenharmony_ci
18125bd8deadSopenharmony_ci    (21) While programs may include shader code for multiple stages, shader
18135bd8deadSopenharmony_ci         subroutines and subroutine uniforms are specific to a single stage in
18145bd8deadSopenharmony_ci         the program.  This means that there is a separate interface for each
18155bd8deadSopenharmony_ci         program stage.  Should we specify <programInterface> tokens for a
18165bd8deadSopenharmony_ci         cross-product of interfaces and stages (e.g., VERTEX_SUBROUTINE,
18175bd8deadSopenharmony_ci         FRAGMENT_SUBROUTINE_UNIFORM)?  Or should we provide generic
18185bd8deadSopenharmony_ci         <programInterface> tokens (SUBROUTINE, SUBROUTINE_UNIFORM) and accept
18195bd8deadSopenharmony_ci         a second <stage> parameter?
18205bd8deadSopenharmony_ci
18215bd8deadSopenharmony_ci      RESOLVED:  Use concatenated tokens to avoid creating adding a separate
18225bd8deadSopenharmony_ci      set of per-stage APIs.  With this solution, we have means 12
18235bd8deadSopenharmony_ci      concatenated tokens (6 stages crossed with SUBROUTINE and
18245bd8deadSopenharmony_ci      SUBROUTINE_UNIFORM); we don't expect a massive number of new tokens in
18255bd8deadSopenharmony_ci      the future.
18265bd8deadSopenharmony_ci
18275bd8deadSopenharmony_ci    (22) What data type should be used for the <params> (return data) argument
18285bd8deadSopenharmony_ci         to GetProgramResourceiv()?
18295bd8deadSopenharmony_ci
18305bd8deadSopenharmony_ci      RESOLVED:  Use an "int *" to be consistent with all the other
18315bd8deadSopenharmony_ci      "*iv"-style queries.
18325bd8deadSopenharmony_ci
18335bd8deadSopenharmony_ci      We considered using a "void *" so applications could avoid manual casts
18345bd8deadSopenharmony_ci      for cases where the API would be used to fill a structure with
18355bd8deadSopenharmony_ci      properties of a resource, as in code like the following:
18365bd8deadSopenharmony_ci
18375bd8deadSopenharmony_ci        struct VariableInfo {
18385bd8deadSopenharmony_ci          GLenum type;
18395bd8deadSopenharmony_ci          GLint location;
18405bd8deadSopenharmony_ci        } varInfo;
18415bd8deadSopenharmony_ci        GLenum inputProps[] = { GL_TYPE, GL_LOCATION };
18425bd8deadSopenharmony_ci        GLuint nInputProps = sizeof(inputProps) / sizeof(GLenum);
18435bd8deadSopenharmony_ci        ...
18445bd8deadSopenharmony_ci        glGetProgramResourceiv(program, GL_PROGRAM_INPUT, index,
18455bd8deadSopenharmony_ci                               nInputProps, inputProps, nInputProps, NULL,
18465bd8deadSopenharmony_ci                               (GLint*)varInfo);
18475bd8deadSopenharmony_ci
18485bd8deadSopenharmony_ci    (23) The special "marker" names "gl_NextBuffer" and "gl_SkipComponents*"
18495bd8deadSopenharmony_ci         may appear multiple times in the array of strings passed to
18505bd8deadSopenharmony_ci         TransformFeedbackVaryings.  How is this condition handled in the new
18515bd8deadSopenharmony_ci         enumeration APIs?
18525bd8deadSopenharmony_ci
18535bd8deadSopenharmony_ci      RESOLVED:  For the purposes of enumerating active resources in the
18545bd8deadSopenharmony_ci      TRANSFORM_FEEDBACK_VARYINGS interface, each instance of the marker is
18555bd8deadSopenharmony_ci      assigned its own index, and the name and properties associated with that
18565bd8deadSopenharmony_ci      index can be queried.  [See also issue (18).]  This is consistent with
18575bd8deadSopenharmony_ci      how GetTransformFeedbackVaryings works in unextended OpenGL 4.2.
18585bd8deadSopenharmony_ci
18595bd8deadSopenharmony_ci      The problem is that since a marker name can have multiple associated
18605bd8deadSopenharmony_ci      indices, it's not clear what value should be returned when passing such
18615bd8deadSopenharmony_ci      a string to GetProgramResourceIndex().  We specify that passing any of
18625bd8deadSopenharmony_ci      these marker strings should return the value INVALID_INDEX, regardless
18635bd8deadSopenharmony_ci      of the number of times the marker appears in the inputs to
18645bd8deadSopenharmony_ci      TransformFeedbackVaryings.  Unextended OpenGL 4.2 does not provide the
18655bd8deadSopenharmony_ci      ability to query the index associated with an active transform feedback
18665bd8deadSopenharmony_ci      varying name, so this is a new issue in this extension.
18675bd8deadSopenharmony_ci
18685bd8deadSopenharmony_ci    (24) The PROGRAM_INPUT and PROGRAM_OUTPUT interfaces are provided to allow
18695bd8deadSopenharmony_ci         applications to query active inputs and outputs in a program.  Do we
18705bd8deadSopenharmony_ci         enumerate all variables qualified with "in" and "out", or should
18715bd8deadSopenharmony_ci         special "system" built-ins such as gl_VertexID, gl_InstanceID, and
18725bd8deadSopenharmony_ci         gl_FrontFacing be excluded?
18735bd8deadSopenharmony_ci
18745bd8deadSopenharmony_ci      RESOLVED:  We enumerate all active variables qualified with "in" or
18755bd8deadSopenharmony_ci      "out" in the PROGRAM_INPUT and PROGRAM_OUTPUT interfaces, including
18765bd8deadSopenharmony_ci      special variables.  Additionally, because we redefine the function
18775bd8deadSopenharmony_ci      glGetActiveAttrib in terms of this in terms of the PROGRAM_INPUT
18785bd8deadSopenharmony_ci      interface, we should enumerate the specials gl_VertexID and
18795bd8deadSopenharmony_ci      gl_InstanceID there as well.  Previously, there was no explicit spec
18805bd8deadSopenharmony_ci      language whether these variables should be enumerated by
18815bd8deadSopenharmony_ci      GetActiveAttrib, and various OpenGL implementations behaved differently.
18825bd8deadSopenharmony_ci      This approach allows applications to enumerate all inputs used by a
18835bd8deadSopenharmony_ci      vertex shader, whether or not they correspond to attributes in
18845bd8deadSopenharmony_ci      conventional or generic vertex attribute arrays.
18855bd8deadSopenharmony_ci
18865bd8deadSopenharmony_ci    (25) What should the value of ARRAY_SIZE be for non-array and unsized
18875bd8deadSopenharmony_ci         array variables?
18885bd8deadSopenharmony_ci
18895bd8deadSopenharmony_ci      RESOLVED: For compatibility with GetActiveUniform, ARRAY_SIZE of a
18905bd8deadSopenharmony_ci      non-array variable is one (initially this was specified as zero, an
18915bd8deadSopenharmony_ci      unintentional incompatibility). For unsized array variables, the size
18925bd8deadSopenharmony_ci      is zero.
18935bd8deadSopenharmony_ci
18945bd8deadSopenharmony_ciRevision History
18955bd8deadSopenharmony_ci
18965bd8deadSopenharmony_ci    Revision 21, January 10, 2019 (Jon Leech)
18975bd8deadSopenharmony_ci      - Add the property COMPATIBLE_SUBROUTINES to those queriable by
18985bd8deadSopenharmony_ci        GetProgramResourceiv (github OpenGL-Registry issue #11)
18995bd8deadSopenharmony_ci    Revision 20, August 19, 2013 (Jon Leech)
19005bd8deadSopenharmony_ci      - Change ARRAY_SIZE query to return one for active variables not
19015bd8deadSopenharmony_ci        corresponding to an array of basic types, rather than zero, for
19025bd8deadSopenharmony_ci        compatibility with GetActiveUniform (Bug 10647). Return zero for
19035bd8deadSopenharmony_ci        explicitly unsized arrays (Bug 10641). Add extra 'const' qualifier
19045bd8deadSopenharmony_ci        for GetUniformIndices <uniformNames> argument (Bug 10703).
19055bd8deadSopenharmony_ci    Revision 19, July 11, 2013 (Jon Leech)
19065bd8deadSopenharmony_ci      - Clarify that GetTransformFeedbackVarying can be used to query
19075bd8deadSopenharmony_ci        any transform feedback varying variable (Bug 10472).
19085bd8deadSopenharmony_ci    Revision 18, July 10, 2012 (pbrown)
19095bd8deadSopenharmony_ci      - Specify an INVALID_ENUM error when ATOMIC_COUNTER_BUFFER is passed
19105bd8deadSopenharmony_ci        to GetProgramResourceIndex or GetProgramResourceName.  Clarify that
19115bd8deadSopenharmony_ci        the array element portion of a string passed to
19125bd8deadSopenharmony_ci        GetProgramResourceLocation or GetProgramResourceLocationIndex
19135bd8deadSopenharmony_ci        must not have, a "+" sign, extra leading zeroes, or whitespace (bug
19145bd8deadSopenharmony_ci        9254).
19155bd8deadSopenharmony_ci    Revision 17, July 7, 2012 (pbrown)
19165bd8deadSopenharmony_ci      - Specify that "special" built-ins inputs and outputs such as
19175bd8deadSopenharmony_ci        "gl_VertexID" should be enumerated in the PROGRAM_INPUT and
19185bd8deadSopenharmony_ci        PROGRAM_OUTPUT interfaces, as well as the legacy function
19195bd8deadSopenharmony_ci        GetActiveAttrib.  Add spec language counting the built-ins gl_VertexID
19205bd8deadSopenharmony_ci        and gl_InstanceID against the active attribute limit (bug 9201).
19215bd8deadSopenharmony_ci    Revision 16, July 2, 2012 (pbrown)
19225bd8deadSopenharmony_ci      - Fix typos in the language mapping OpenGL 4.2 active subroutine and
19235bd8deadSopenharmony_ci        subroutine uniform enumeration functions to the new interfaces.
19245bd8deadSopenharmony_ci    Revision 15, June 21, 2012 (Jon Leech)
19255bd8deadSopenharmony_ci      - Update errors to match the generic errors for all commands taking
19265bd8deadSopenharmony_ci        <program> names (INVALID_VALUE if neither a shader nor program
19275bd8deadSopenharmony_ci        object name, and INVALID_OPERATION if a shader object name) (Bug
19285bd8deadSopenharmony_ci        9145).
19295bd8deadSopenharmony_ci    Revision 14, June 14, 2012 (Jon Leech)
19305bd8deadSopenharmony_ci      - Add INVALID_VALUE error if <program> is not the name of a valid
19315bd8deadSopenharmony_ci        program object (Bug 9145).
19325bd8deadSopenharmony_ci    Revision 13, May 31, 2012 (pbrown)
19335bd8deadSopenharmony_ci      - Specify that passing the special "marker" strings "gl_NextBuffer"
19345bd8deadSopenharmony_ci        and "gl_SkipComponents*" to GetProgramResourceIndex() will always
19355bd8deadSopenharmony_ci        return INVALID_INDEX (bug 9071).
19365bd8deadSopenharmony_ci    Revision 12, May 31, 2012 (pbrown)
19375bd8deadSopenharmony_ci      - Allow the BUFFER_VARIABLE, PROGRAM_INPUT, and PROGRAM_OUTPUT
19385bd8deadSopenharmony_ci        interfaces to be used by the REFERENCED_BY_*_SHADER property in
19395bd8deadSopenharmony_ci        GetProgramResourceiv (bug 9007).
19405bd8deadSopenharmony_ci      - Remove duplicate reference to BUFFER_VARIABLE in the list of
19415bd8deadSopenharmony_ci        interfaces supported by the ARRAY_SIZE property in
19425bd8deadSopenharmony_ci        GetProgramResourceiv.
19435bd8deadSopenharmony_ci    Revision 11, May 18, 2012 (pbrown)
19445bd8deadSopenharmony_ci      - Clarify that the LOCATION_INDEX property is only supported for the
19455bd8deadSopenharmony_ci        PROGRAM_OUTPUT interface and not for PROGRAM_INPUT.
19465bd8deadSopenharmony_ci    Revision 10, May 10, 2012 (pbrown)
19475bd8deadSopenharmony_ci      - Rename the formal parameter <interface> used by the functions in this
19485bd8deadSopenharmony_ci        extension to <programInterface>.  Certain versions of the Microsoft
19495bd8deadSopenharmony_ci        C/C++ compiler and/or its headers cause "interface" to be treated as a
19505bd8deadSopenharmony_ci        reserved keyword.
19515bd8deadSopenharmony_ci    Revision 9, May 10, 2012 (pbrown)
19525bd8deadSopenharmony_ci      - Fix incorrect enumerant assignments.  ATOMIC_COUNTER_BUFFER has
19535bd8deadSopenharmony_ci        already been assigned for ARB_shader_atomic_counters.  Fix
19545bd8deadSopenharmony_ci        cut-and-paste error assigning a duplicate value to
19555bd8deadSopenharmony_ci        TESS_CONTROL_SUBROUTINE.  Reassign value for IS_PER_PATCH to fill
19565bd8deadSopenharmony_ci        the ATOMIC_COUNTER_BUFFER hole.
19575bd8deadSopenharmony_ci    Revision 8, May 2, 2012 (pbrown)
19585bd8deadSopenharmony_ci      - Reserve enumerants.
19595bd8deadSopenharmony_ci      - Add state table entries.
19605bd8deadSopenharmony_ci      - Mark issues as resolved per the Khronos F2F.
19615bd8deadSopenharmony_ci      - Add issue (22), where we decided to keep the "int *" argument to
19625bd8deadSopenharmony_ci        GetProgramResourceiv().
19635bd8deadSopenharmony_ci    Revision 7, April 25, 2012
19645bd8deadSopenharmony_ci      - Rename IS_PATCH_ATTRIB to IS_PER_PATCH (bug 8752).
19655bd8deadSopenharmony_ci    Revision 6, April 12, 2012
19665bd8deadSopenharmony_ci      - Add explicit language indicating that per-patch attributes can be
19675bd8deadSopenharmony_ci        enumerated in the PROGRAM_INPUT and PROGRAM_OUTPUT interfaces, plus
19685bd8deadSopenharmony_ci        the IS_PATCH_ATTRIB property.
19695bd8deadSopenharmony_ci      - Take a first cut at redefining all the existing enumeration APIs in
19705bd8deadSopenharmony_ci        terms of the new APIs.
19715bd8deadSopenharmony_ci      - Add missing OFFSET token to new token list.
19725bd8deadSopenharmony_ci      - Rename BUFFER_SIZE to BUFFER_DATA_SIZE to be consistent with older
19735bd8deadSopenharmony_ci        token names.
19745bd8deadSopenharmony_ci      - Mark various issues as resolved.
19755bd8deadSopenharmony_ci    Revision 5, April 12, 2012
19765bd8deadSopenharmony_ci      - Remove support for querying properties of multiple resources in a
19775bd8deadSopenharmony_ci        single call; rename GetProgramResourcesiv to GetProgramResourceiv
19785bd8deadSopenharmony_ci        since only a single resource is queried at a time.
19795bd8deadSopenharmony_ci      - Fold issue (22) into issue (11).
19805bd8deadSopenharmony_ci    Revision 4, April 5, 2012
19815bd8deadSopenharmony_ci      - Add issue (22) about the need to allocate/fill an array of indices even
19825bd8deadSopenharmony_ci        if you want to query properties of all active resources at once.
19835bd8deadSopenharmony_ci    Revision 3, April 5, 2012
19845bd8deadSopenharmony_ci      - Checkpoint with various edits/cleanups.  Add an introduction; clean up
19855bd8deadSopenharmony_ci        new procedures, tokens, errors, and issues sections.
19865bd8deadSopenharmony_ci      - Rename APIs to GetProgramInterface and GetProgramResource*.
19875bd8deadSopenharmony_ci      - Add GetProgramResourceLocation API as a generic location query.
19885bd8deadSopenharmony_ci      - Add interactions with ARB_compute_shader.
19895bd8deadSopenharmony_ci      - Add interactions with ARB_explicit_uniform_location.
19905bd8deadSopenharmony_ci      - Add discussion of enumeration of built-in variables and special
19915bd8deadSopenharmony_ci        transform feedback markers.
19925bd8deadSopenharmony_ci      - Add general discussion of locations assigned to active variables.
19935bd8deadSopenharmony_ci      - Add interface properties MAX_NUM_ACTIVE_VARIABLES and
19945bd8deadSopenharmony_ci        MAX_NUM_COMPATIBLE_SUBROUTINES.
19955bd8deadSopenharmony_ci      - Add resource properties LOCATION and LOCATION_INDEX.
19965bd8deadSopenharmony_ci      - Add <bufSize> and <length> parameters to GetProgramResourcesiv.
19975bd8deadSopenharmony_ci    Revision 2, March 22, 2012
19985bd8deadSopenharmony_ci      - Added new function prototypes for review purposes.
19995bd8deadSopenharmony_ci    Revision 1, March 14, 2012
20005bd8deadSopenharmony_ci      - Initial revision.
20015bd8deadSopenharmony_ci
2002