15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    ARB_spirv_extensions
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName String
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_ARB_spirv_extensions
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Daniel Koch, NVIDIA Corporation (dkoch at nvidia.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciContributors
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    Daniel Rakos, AMD
165bd8deadSopenharmony_ci    John Kessenich, Google
175bd8deadSopenharmony_ci    Members of the OpenGL Working Group
185bd8deadSopenharmony_ci
195bd8deadSopenharmony_ciNotice
205bd8deadSopenharmony_ci
215bd8deadSopenharmony_ci    Copyright (c) 2017-2018 The Khronos Group Inc. Copyright terms at
225bd8deadSopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
235bd8deadSopenharmony_ci
245bd8deadSopenharmony_ciSpecification Update Policy
255bd8deadSopenharmony_ci
265bd8deadSopenharmony_ci    Khronos-approved extension specifications are updated in response to
275bd8deadSopenharmony_ci    issues and bugs prioritized by the Khronos OpenGL Working Group. For
285bd8deadSopenharmony_ci    extensions which have been promoted to a core Specification, fixes will
295bd8deadSopenharmony_ci    first appear in the latest version of that core Specification, and will
305bd8deadSopenharmony_ci    eventually be backported to the extension document. This policy is
315bd8deadSopenharmony_ci    described in more detail at
325bd8deadSopenharmony_ci        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
335bd8deadSopenharmony_ci
345bd8deadSopenharmony_ciStatus
355bd8deadSopenharmony_ci
365bd8deadSopenharmony_ci    Complete
375bd8deadSopenharmony_ci
385bd8deadSopenharmony_ciVersion
395bd8deadSopenharmony_ci
405bd8deadSopenharmony_ci    Last Modified Date: February 20, 2018
415bd8deadSopenharmony_ci    Revision: 9
425bd8deadSopenharmony_ci
435bd8deadSopenharmony_ciNumber
445bd8deadSopenharmony_ci
455bd8deadSopenharmony_ci    ARB Extension #194
465bd8deadSopenharmony_ci
475bd8deadSopenharmony_ciDependencies
485bd8deadSopenharmony_ci
495bd8deadSopenharmony_ci    This extensions is written against the OpenGL 4.5 Specification
505bd8deadSopenharmony_ci    (Core Profile - July 7, 2016)
515bd8deadSopenharmony_ci
525bd8deadSopenharmony_ci    This extension requires ARB_gl_spirv.
535bd8deadSopenharmony_ci
545bd8deadSopenharmony_ci    This extension interacts with ARB_shader_ballot and
555bd8deadSopenharmony_ci    SPV_KHR_shader_ballot.
565bd8deadSopenharmony_ci
575bd8deadSopenharmony_ci    This extension interacts with ARB_shader_draw_parameters and
585bd8deadSopenharmony_ci    SPV_KHR_shader_draw_parameters.
595bd8deadSopenharmony_ci
605bd8deadSopenharmony_ci    This extension interacts with ARB_shader_group_vote and
615bd8deadSopenharmony_ci    SPV_KHR_subgroup_vote.
625bd8deadSopenharmony_ci
635bd8deadSopenharmony_ci    This extension interacts with NV_stereo_view_rendering and
645bd8deadSopenharmony_ci    SPV_NV_stereo_view_rendering.
655bd8deadSopenharmony_ci
665bd8deadSopenharmony_ci    This extension interacts with NV_viewport_array2 and
675bd8deadSopenharmony_ci    SPV_NV_viewport_array2.
685bd8deadSopenharmony_ci
695bd8deadSopenharmony_ci    This extension interacts with ARB_shader_viewport_layer_array
705bd8deadSopenharmony_ci    and SPV_NV_viewport_array2.
715bd8deadSopenharmony_ci
725bd8deadSopenharmony_ci    This extension interacts with NV_geometry_shader_passthrough
735bd8deadSopenharmony_ci    and SPV_NV_geometry_shader_passthrough.
745bd8deadSopenharmony_ci
755bd8deadSopenharmony_ci    This extension interacts with NV_sample_mask_override_coverage
765bd8deadSopenharmony_ci    and SPV_NV_sample_mask_override_coverage.
775bd8deadSopenharmony_ci
785bd8deadSopenharmony_ci    This extension interacts with AMD_shader_explicit_vertex_parameter
795bd8deadSopenharmony_ci    and SPV_AMD_shader_explicit_vertex_parameter.
805bd8deadSopenharmony_ci
815bd8deadSopenharmony_ci    This extension interacts with AMD_gpu_shader_half_float
825bd8deadSopenharmony_ci    and SPV_AMD_gpu_shader_half_float.
835bd8deadSopenharmony_ci
845bd8deadSopenharmony_ci    This extension interacts with ARB_shader_atomic_counter_ops and
855bd8deadSopenharmony_ci    SPV_KHR_shader_atomic_counter_ops.
865bd8deadSopenharmony_ci
875bd8deadSopenharmony_ci    This extension interacts with ARB_post_depth_coverage,
885bd8deadSopenharmony_ci    EXT_post_depth_coverage and SPV_KHR_post_depth_coverage.
895bd8deadSopenharmony_ci
905bd8deadSopenharmony_ci    This extension interacts with SPV_KHR_storage_buffer_storage_class.
915bd8deadSopenharmony_ci
925bd8deadSopenharmony_ciOverview
935bd8deadSopenharmony_ci
945bd8deadSopenharmony_ci    ARB_gl_spirv added support for using SPIR-V modules in OpenGL.
955bd8deadSopenharmony_ci    However it only added support for SPIR-V 1.0 concepts that were part of
965bd8deadSopenharmony_ci    the OpenGL 4.5 Core Profile.
975bd8deadSopenharmony_ci
985bd8deadSopenharmony_ci    There are a great number of additional OpenGL ARB and vendor extensions
995bd8deadSopenharmony_ci    which add shading language concepts and since they were defined prior
1005bd8deadSopenharmony_ci    to the existence of SPIR-V support in OpenGL they don't add SPIR-V support
1015bd8deadSopenharmony_ci    for their additional features.  Ideally GL_ARB_gl_spirv would have added
1025bd8deadSopenharmony_ci    support for them, but as noted in Issue 27 of that extension, support for
1035bd8deadSopenharmony_ci    them was left as a future exercise.
1045bd8deadSopenharmony_ci
1055bd8deadSopenharmony_ci    Now that at least some of that functionality has been defined via SPIR-V
1065bd8deadSopenharmony_ci    extensions, there is currently no way for an OpenGL implementation to
1075bd8deadSopenharmony_ci    advertise that is supports additional SPIR-V extensions.
1085bd8deadSopenharmony_ci
1095bd8deadSopenharmony_ci    This extension provides a mechanism for an implementation to advertise
1105bd8deadSopenharmony_ci    which SPIR-V extensions it supports, and further provides a place where
1115bd8deadSopenharmony_ci    the SPIR-V environment for those extensions can be documented for OpenGL.
1125bd8deadSopenharmony_ci
1135bd8deadSopenharmony_ci    It is expected that this document can be extended over time as SPIR-V
1145bd8deadSopenharmony_ci    support for additional extensions is added. The mapping between GLSL and
1155bd8deadSopenharmony_ci    SPIR-V concepts and any other pertinent information can be provided here
1165bd8deadSopenharmony_ci    as interactions with the corresponding OpenGL and SPIR-V extensions.
1175bd8deadSopenharmony_ci
1185bd8deadSopenharmony_ciNew Procedures and Functions
1195bd8deadSopenharmony_ci
1205bd8deadSopenharmony_ci    None
1215bd8deadSopenharmony_ci
1225bd8deadSopenharmony_ciNew Tokens
1235bd8deadSopenharmony_ci
1245bd8deadSopenharmony_ci    Accepted by the <name> parameter of GetStringi:
1255bd8deadSopenharmony_ci
1265bd8deadSopenharmony_ci        SPIR_V_EXTENSIONS           0x9553
1275bd8deadSopenharmony_ci
1285bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetIntegerv:
1295bd8deadSopenharmony_ci
1305bd8deadSopenharmony_ci        NUM_SPIR_V_EXTENSIONS       0x9554
1315bd8deadSopenharmony_ci
1325bd8deadSopenharmony_ciModifications to Chapter 7 of the OpenGL 4.5 (Core Profile) Specification
1335bd8deadSopenharmony_ci(Programs and Shaders)
1345bd8deadSopenharmony_ci
1355bd8deadSopenharmony_ci    [[Modifications when SPV_KHR_storage_buffer_storage_class is supported]]
1365bd8deadSopenharmony_ci
1375bd8deadSopenharmony_ci    (replace section "7.6.2.spv SPIR-V Uniform Offsets and Strides" added by
1385bd8deadSopenharmony_ci     ARB_gl_spirv with the following:)
1395bd8deadSopenharmony_ci
1405bd8deadSopenharmony_ci        "The SPIR-V decorations *GLSLShared* or *GLSLPacked* must not be used.
1415bd8deadSopenharmony_ci        A variable in the *Uniform* or *StorageBuffer* Storage Class decorated
1425bd8deadSopenharmony_ci        as a *Block* must be explicitly laid out using the *Offset*,
1435bd8deadSopenharmony_ci        *ArrayStride*, and *MatrixStride* decorations. If the variable is in
1445bd8deadSopenharmony_ci        the *Uniform* storage class decorated as a *BufferBlock* or in the
1455bd8deadSopenharmony_ci        *StorageBuffer* storage class decorated as a *Block*, its offsets and
1465bd8deadSopenharmony_ci        strides must not contradict std430 alignment and minimum offset
1475bd8deadSopenharmony_ci        requirements. Otherwise, its offsets and strides must not contradict
1485bd8deadSopenharmony_ci        std140 alignment and minimum offset requirements."
1495bd8deadSopenharmony_ci
1505bd8deadSopenharmony_ci
1515bd8deadSopenharmony_ciModifications to Chapter 22 of the OpenGL 4.5 (Core Profile) Specification
1525bd8deadSopenharmony_ci(Context State Queries)
1535bd8deadSopenharmony_ci
1545bd8deadSopenharmony_ci    Additions to section 22.2 (Pointer, String, and Related Context Queries)
1555bd8deadSopenharmony_ci
1565bd8deadSopenharmony_ci        Add the following to the description of tokens accepted by
1575bd8deadSopenharmony_ci        GetStringi:
1585bd8deadSopenharmony_ci
1595bd8deadSopenharmony_ci        "If <name> is SPIR_V_EXTENSIONS, the SPIR-V extension name
1605bd8deadSopenharmony_ci        corresponding to the <index>th supported SPIR-V extension
1615bd8deadSopenharmony_ci        (specified as the Name String in the corresponding SPIR-V
1625bd8deadSopenharmony_ci        extension document) will be returned. <index> may range from zero
1635bd8deadSopenharmony_ci        to the value of NUM_SPIR_V_EXTENSIONS minus one. The value of
1645bd8deadSopenharmony_ci        NUM_SPIR_V_EXTENSIONS can be queried using the GetInteger
1655bd8deadSopenharmony_ci        command. There is no defined relationship between any particular
1665bd8deadSopenharmony_ci        extension name and the <index> values and a SPIR-V extension name
1675bd8deadSopenharmony_ci        may correspond to a different <index> in different GL contexts
1685bd8deadSopenharmony_ci        and/or implementations."
1695bd8deadSopenharmony_ci
1705bd8deadSopenharmony_ci        Modify the INVALID_ENUM error for the GetStringi command to be:
1715bd8deadSopenharmony_ci
1725bd8deadSopenharmony_ci        "An INVALID_ENUM error is generated if <name> is not EXTENSIONS,
1735bd8deadSopenharmony_ci        SHADING_LANGUAGE_VERSION, or SPIR_V_EXTENSIONS."
1745bd8deadSopenharmony_ci
1755bd8deadSopenharmony_ci
1765bd8deadSopenharmony_ciModifications to Appendix A.spv of the OpenGL 4.5 (Core Profile) Specification
1775bd8deadSopenharmony_ci(The OpenGL SPIR-V Execution Environment) [as added by GL_ARB_gl_spirv]
1785bd8deadSopenharmony_ci
1795bd8deadSopenharmony_ci    Additions to section A.spv.2 (Valid SPIR-V Built-In Variable Decorations)
1805bd8deadSopenharmony_ci
1815bd8deadSopenharmony_ci        Built-in Variable Decoration    Minimum GL version (Extension)
1825bd8deadSopenharmony_ci        ----------------------------    -----------------------------
1835bd8deadSopenharmony_ci        SubgroupEqMaskKHR               (ARB_shader_ballot)
1845bd8deadSopenharmony_ci        SubgroupGeMaskKHR               (ARB_shader_ballot)
1855bd8deadSopenharmony_ci        SubgroupGtMaskKHR               (ARB_shader_ballot)
1865bd8deadSopenharmony_ci        SubgroupLeMaskKHR               (ARB_shader_ballot)
1875bd8deadSopenharmony_ci        SubgroupLtMaskKHR               (ARB_shader_ballot)
1885bd8deadSopenharmony_ci        BaseVertex                      (ARB_shader_draw_parameters)
1895bd8deadSopenharmony_ci        BaseInstance                    (ARB_shader_draw_parameters)
1905bd8deadSopenharmony_ci        DrawIndex                       (ARB_shader_draw_parameters)
1915bd8deadSopenharmony_ci        SecondaryPositionNV             (NV_stereo_view_rendering)
1925bd8deadSopenharmony_ci        SecondaryViewportMaskNV         (NV_stereo_view_rendering)
1935bd8deadSopenharmony_ci        ViewportMaskNV                  (NV_viewport_array2)
1945bd8deadSopenharmony_ci        BaryCoordNoPerspAMD             (AMD_shader_explicit_vertex_parameter)
1955bd8deadSopenharmony_ci        BaryCoordNoPerspCentroidAMD     (AMD_shader_explicit_vertex_parameter)
1965bd8deadSopenharmony_ci        BaryCoordNoPerspSampleAMD       (AMD_shader_explicit_vertex_parameter)
1975bd8deadSopenharmony_ci        BaryCoordSmoothAMD              (AMD_shader_explicit_vertex_parameter)
1985bd8deadSopenharmony_ci        BaryCoordSmoothCentroidAMD      (AMD_shader_explicit_vertex_parameter)
1995bd8deadSopenharmony_ci        BaryCoordSmoothSampleAMD        (AMD_shader_explicit_vertex_parameter)
2005bd8deadSopenharmony_ci        BaryCoordPullModelAMD           (AMD_shader_explicit_vertex_parameter)
2015bd8deadSopenharmony_ci
2025bd8deadSopenharmony_ci    Additions to section A.spv.3 (Valid SPIR-V Capabilities)
2035bd8deadSopenharmony_ci
2045bd8deadSopenharmony_ci        Implementations supporting ARB_shader_ballot and
2055bd8deadSopenharmony_ci        SPV_KHR_shader_ballot must support the following operand declared
2065bd8deadSopenharmony_ci        by OpCapability:
2075bd8deadSopenharmony_ci
2085bd8deadSopenharmony_ci            SubgroupBallotKHR
2095bd8deadSopenharmony_ci
2105bd8deadSopenharmony_ci        Implementations supporting ARB_shader_draw_parameters and
2115bd8deadSopenharmony_ci        SPV_KHR_shader_draw_parameters must support the following operand
2125bd8deadSopenharmony_ci        declared by OpCapability:
2135bd8deadSopenharmony_ci
2145bd8deadSopenharmony_ci            DrawParameters
2155bd8deadSopenharmony_ci
2165bd8deadSopenharmony_ci        Implementations supporting ARB_shader_group_vote and
2175bd8deadSopenharmony_ci        SPV_KHR_subgroup_vote must support the following operand declared
2185bd8deadSopenharmony_ci        by OpCapability:
2195bd8deadSopenharmony_ci
2205bd8deadSopenharmony_ci            SubgroupVoteKHR
2215bd8deadSopenharmony_ci
2225bd8deadSopenharmony_ci        Implementations supporting NV_stereo_view_rendering and
2235bd8deadSopenharmony_ci        SPV_NV_stereo_view_rendering must support the following operand
2245bd8deadSopenharmony_ci        declared by OpCapability:
2255bd8deadSopenharmony_ci
2265bd8deadSopenharmony_ci            ShaderStereoViewNV
2275bd8deadSopenharmony_ci
2285bd8deadSopenharmony_ci        Implementations supporting NV_viewport_array2 and
2295bd8deadSopenharmony_ci        SPV_NV_viewport_array2 must support the following operands
2305bd8deadSopenharmony_ci        declared by OpCapability:
2315bd8deadSopenharmony_ci
2325bd8deadSopenharmony_ci            ShaderViewportIndexLayerNV
2335bd8deadSopenharmony_ci            ShaderViewportMaskNV
2345bd8deadSopenharmony_ci
2355bd8deadSopenharmony_ci        Implementations supporting ARB_shader_viewport_layer_array and
2365bd8deadSopenharmony_ci        SPV_NV_viewport_array2 must support the following operands
2375bd8deadSopenharmony_ci        declared by OpCapability:
2385bd8deadSopenharmony_ci
2395bd8deadSopenharmony_ci            ShaderViewportIndexLayerNV
2405bd8deadSopenharmony_ci
2415bd8deadSopenharmony_ci        Implementations supporting NV_geometry_shader_passthrough and
2425bd8deadSopenharmony_ci        SPV_NV_geometry_shader_passthrough must support the following
2435bd8deadSopenharmony_ci        operand declared by OpCapability:
2445bd8deadSopenharmony_ci
2455bd8deadSopenharmony_ci            GeometryShaderPassthroughNV
2465bd8deadSopenharmony_ci
2475bd8deadSopenharmony_ci        Implementations supporting NV_sample_mask_override_coverage and
2485bd8deadSopenharmony_ci        SPV_NV_sample_mask_override_coverage must suport the following
2495bd8deadSopenharmony_ci        operand declared by OpCapability:
2505bd8deadSopenharmony_ci
2515bd8deadSopenharmony_ci            SampleMaskOverrideCoverageNV
2525bd8deadSopenharmony_ci
2535bd8deadSopenharmony_ci        Implementations supporting AMD_gpu_shader_half_float and
2545bd8deadSopenharmony_ci        SPV_AMD_gpu_shader_half_float must support the following operand
2555bd8deadSopenharmony_ci        declared by OpCapability:
2565bd8deadSopenharmony_ci
2575bd8deadSopenharmony_ci            Float16
2585bd8deadSopenharmony_ci
2595bd8deadSopenharmony_ci        Implementations supporting ARB_shader_atomic_counter_ops and
2605bd8deadSopenharmony_ci        SPV_KHR_shader_atomic_counter_ops must support the following
2615bd8deadSopenharmony_ci        operand declared by OpCapability:
2625bd8deadSopenharmony_ci
2635bd8deadSopenharmony_ci            AtomicStorageOps
2645bd8deadSopenharmony_ci
2655bd8deadSopenharmony_ci        Implementations supporting ARB_post_depth_coverage
2665bd8deadSopenharmony_ci        (or EXT_post_depth_coverage) and SPV_KHR_post_depth_coverage
2675bd8deadSopenharmony_ci        must support the following operand declared by OpCapability:
2685bd8deadSopenharmony_ci
2695bd8deadSopenharmony_ci            SampleMaskPostDepthCoverage
2705bd8deadSopenharmony_ci
2715bd8deadSopenharmony_ci    Additions to section A.spv.4 (Validation rules)
2725bd8deadSopenharmony_ci
2735bd8deadSopenharmony_ci    [[Additions for SPV_NV_viewport_array2]]
2745bd8deadSopenharmony_ci
2755bd8deadSopenharmony_ci     * The code:ViewportRelativeNV decoration must: only be used on a variable
2765bd8deadSopenharmony_ci       decorated with code:Layer in the vertex, tessellation evaluation, or
2775bd8deadSopenharmony_ci       geometry shader stages.
2785bd8deadSopenharmony_ci     * The code:ViewportRelativeNV decoration must: not be used unless a
2795bd8deadSopenharmony_ci       variable decorated with one of code:ViewportIndex or
2805bd8deadSopenharmony_ci       code:ViewportMaskNV is also statically used by the same
2815bd8deadSopenharmony_ci        code:OpEntryPoint.
2825bd8deadSopenharmony_ci     * The code:ViewportMaskNV and code:ViewportIndex decorations must: not
2835bd8deadSopenharmony_ci       both be statically used by one or more code:OpEntryPoint's that form
2845bd8deadSopenharmony_ci       the vertex processing stages of a graphics pipeline.
2855bd8deadSopenharmony_ci
2865bd8deadSopenharmony_ci    [[Additions for SPV_AMD_shader_explicit_vertex_parameter]]
2875bd8deadSopenharmony_ci
2885bd8deadSopenharmony_ci     * The code:CustomInterpAMD decoration must not be used on variables with
2895bd8deadSopenharmony_ci       Storage Class other than *Input* or on variables used in the interface
2905bd8deadSopenharmony_ci       of non-fragment shader entry points.
2915bd8deadSopenharmony_ci
2925bd8deadSopenharmony_ci    [[Modifications if SPV_KHR_storage_buffer_storage_class is supported]]
2935bd8deadSopenharmony_ci
2945bd8deadSopenharmony_ci      - Add *StorageBuffer* to the list of Storage Classes that are accepted.
2955bd8deadSopenharmony_ci
2965bd8deadSopenharmony_ci    (replace the following statement from ARB_gl_spirv)
2975bd8deadSopenharmony_ci
2985bd8deadSopenharmony_ci      - OpTypeRuntimeArray must only be used for the last member of an
2995bd8deadSopenharmony_ci        OpTypeStruct in the Uniform Storage Class and is decorated as
3005bd8deadSopenharmony_ci        BufferBlock.
3015bd8deadSopenharmony_ci
3025bd8deadSopenharmony_ci    (with the following:)
3035bd8deadSopenharmony_ci
3045bd8deadSopenharmony_ci      - OpTypeRuntimeArray must: only be used for the last member of an
3055bd8deadSopenharmony_ci        OpTypeStruct that is in the StorageBuffer storage class
3065bd8deadSopenharmony_ci        decorated as Block, or that is in the Uniform storage
3075bd8deadSopenharmony_ci        class decorated as BufferBlock.
3085bd8deadSopenharmony_ci
3095bd8deadSopenharmony_ci
3105bd8deadSopenharmony_ciNew State
3115bd8deadSopenharmony_ci
3125bd8deadSopenharmony_ciAdd the following rows to Table 23.56 (Implementation Dependent Version
3135bd8deadSopenharmony_ciand Extensions support)
3145bd8deadSopenharmony_ci
3155bd8deadSopenharmony_ciGet Value             Type  Get         Minimum Description      Sec.
3165bd8deadSopenharmony_ci                            Command     Value
3175bd8deadSopenharmony_ci--------------------- ----- ----------- ------- ---------------- ----
3185bd8deadSopenharmony_ciSPIR_V_EXTENSIONS     n x S GetStringi     -    Supported SPIR-V 22.2
3195bd8deadSopenharmony_ci                                                extension names
3205bd8deadSopenharmony_ciNUM_SPIR_V_EXTENSIONS  Z+   GetIntegerv    0    No. of supported 22.2
3215bd8deadSopenharmony_ci                                                SPIR-V extension
3225bd8deadSopenharmony_ci                                                names
3235bd8deadSopenharmony_ci
3245bd8deadSopenharmony_ci
3255bd8deadSopenharmony_ciInteractions with ARB_shader_ballot and SPV_KHR_shader_ballot:
3265bd8deadSopenharmony_ci
3275bd8deadSopenharmony_ci    When using these extensions the following GLSL -> SPIR-V mapping is used:
3285bd8deadSopenharmony_ci
3295bd8deadSopenharmony_ci    * in uint64_t gl_SubGroupEqMaskARB; -> SubgroupEqMaskKHR,
3305bd8deadSopenharmony_ci    * in uint64_t gl_SubGroupGeMaskARB; -> SubgroupGeMaskKHR,
3315bd8deadSopenharmony_ci    * in uint64_t gl_SubGroupGtMaskARB; -> SubgroupGtMaskKHR,
3325bd8deadSopenharmony_ci    * in uint64_t gl_SubGroupLeMaskARB; -> SubgroupLeMaskKHR,
3335bd8deadSopenharmony_ci    * in uint64_t gl_SubGroupLtMaskARB; -> SubgroupLtMaskKHR,
3345bd8deadSopenharmony_ci    * in uint gl_SubGroupInvocationARB; -> SubgroupLocalInvocationId,
3355bd8deadSopenharmony_ci    * uniform uint gl_SubGroupSizeARB;  -> SubgroupSize,
3365bd8deadSopenharmony_ci    * ballotARB()                       -> OpSubgroupBallotKHR,
3375bd8deadSopenharmony_ci    * readFirstInvocationARB()          -> OpSubgroupFirstInvocationKHR, and
3385bd8deadSopenharmony_ci    * readInvocationARB()               -> OpSubgroupReadInvocationKHR.
3395bd8deadSopenharmony_ci
3405bd8deadSopenharmony_ciInteractions with ARB_shader_draw_parameters and
3415bd8deadSopenharmony_ciSPV_KHR_shader_draw_parameters:
3425bd8deadSopenharmony_ci
3435bd8deadSopenharmony_ci    When using these extensions the following GLSL -> SPIR-V mapping is used:
3445bd8deadSopenharmony_ci
3455bd8deadSopenharmony_ci    * in int gl_BaseInstanceARB; -> BaseInstance,
3465bd8deadSopenharmony_ci    * in int gl_BaseVertexARB;   -> BaseVertex, and
3475bd8deadSopenharmony_ci    * in int gl_DrawIDARB;       -> DrawIndex.
3485bd8deadSopenharmony_ci
3495bd8deadSopenharmony_ciInteractions with ARB_shader_group_vote and SPV_KHR_subgroup_vote:
3505bd8deadSopenharmony_ci
3515bd8deadSopenharmony_ci    When using these extensions the following GLSL -> SPIR-V mapping is used:
3525bd8deadSopenharmony_ci
3535bd8deadSopenharmony_ci    * anyInvocationARB()        -> OpSubgroupAnyKHR,
3545bd8deadSopenharmony_ci    * allInvocationsARB()       -> OpSubgroupAllKHR, and
3555bd8deadSopenharmony_ci    * allInvocationsEqualARB()  -> OpSubgroupAllEqualKHR.
3565bd8deadSopenharmony_ci
3575bd8deadSopenharmony_ciInteractions with NV_stereo_view_rendering and SPV_NV_stereo_view_rendering:
3585bd8deadSopenharmony_ci
3595bd8deadSopenharmony_ci    When using these extensions the following GLSL -> SPIR-V mapping is used:
3605bd8deadSopenharmony_ci
3615bd8deadSopenharmony_ci    * highp vec4 gl_SecondaryPositionNV;        -> SecondaryPositionNV,
3625bd8deadSopenharmony_ci    * highp int  gl_SecondaryViewportMaskNV[];  -> SecondaryViewportMaskNV, and
3635bd8deadSopenharmony_ci    * layout (secondary_view_offset = n)        -> SecondaryViewportRelativeNV.
3645bd8deadSopenharmony_ci
3655bd8deadSopenharmony_ciInteractions with NV_viewport_array2 and SPV_NV_viewport_array2:
3665bd8deadSopenharmony_ci
3675bd8deadSopenharmony_ci    When using these extensions the following GLSL -> SPIR-V mapping is used:
3685bd8deadSopenharmony_ci
3695bd8deadSopenharmony_ci    * highp int gl_ViewportMask[] -> ViewportMaskNV, and
3705bd8deadSopenharmony_ci    * layout (viewport_relative)  -> ViewportRelativeNV.
3715bd8deadSopenharmony_ci
3725bd8deadSopenharmony_ciInteractions with ARB_shader_viewport_layer_array and SPV_NV_viewport_array2:
3735bd8deadSopenharmony_ci
3745bd8deadSopenharmony_ci    When using these extensions, gl_Layer and gl_ViewportIndex can be written
3755bd8deadSopenharmony_ci    from Vertex or Tessellation shaders.
3765bd8deadSopenharmony_ci
3775bd8deadSopenharmony_ciInteractions with NV_geometry_shader_passthrough and
3785bd8deadSopenharmony_ciSPV_NV_geometry_shader_passthrough:
3795bd8deadSopenharmony_ci
3805bd8deadSopenharmony_ci    When using these extensions the following GLSL -> SPIR-V mapping is used:
3815bd8deadSopenharmony_ci
3825bd8deadSopenharmony_ci    * layout(passthrough) -> PassthroughNV.
3835bd8deadSopenharmony_ci
3845bd8deadSopenharmony_ciInteractions with NV_sample_mask_override_coverage and
3855bd8deadSopenharmony_ciSPV_NV_sample_mask_override_coverage:
3865bd8deadSopenharmony_ci
3875bd8deadSopenharmony_ci    When using these extensions the following GLSL -> SPIR-V mapping is used:
3885bd8deadSopenharmony_ci
3895bd8deadSopenharmony_ci    * layout(override_coverage) -> OverrideCoverageNV.
3905bd8deadSopenharmony_ci
3915bd8deadSopenharmony_ciInteractions with AMD_shader_explicit_vertex_parameter and
3925bd8deadSopenharmony_ciSPV_AMD_shader_explicit_vertex_parameter:
3935bd8deadSopenharmony_ci
3945bd8deadSopenharmony_ci    When using these extensions the following GLSL -> SPIR-V mapping is used:
3955bd8deadSopenharmony_ci
3965bd8deadSopenharmony_ci    * explicitInterpAMD                       -> ExplicitInterpAMD
3975bd8deadSopenharmony_ci    * in vec2 gl_BaryCoordNoPerspAMD;         -> BaryCoordNoPerspAMD
3985bd8deadSopenharmony_ci    * in vec2 gl_BaryCoordNoPerspCentroidAMD; -> BaryCoordNoPerspCentroidAMD
3995bd8deadSopenharmony_ci    * in vec2 gl_BaryCoordNoPerspSampleAMD;   -> BaryCoordNoPerspSampleAMD
4005bd8deadSopenharmony_ci    * in vec2 gl_BaryCoordSmoothAMD;          -> BaryCoordSmoothAMD
4015bd8deadSopenharmony_ci    * in vec2 gl_BaryCoordSmoothCentroidAMD;  -> BaryCoordSmoothCentroidAMD
4025bd8deadSopenharmony_ci    * in vec2 gl_BaryCoordSmoothSampleAMD;    -> BaryCoordSmoothSampleAMD
4035bd8deadSopenharmony_ci    * in vec3 gl_BaryCoordPullModelAMD;       -> BaryCoordPullModelAMD
4045bd8deadSopenharmony_ci
4055bd8deadSopenharmony_ciInteractions with AMD_gpu_shader_half_float and SPV_AMD_gpu_shader_half_float:
4065bd8deadSopenharmony_ci
4075bd8deadSopenharmony_ci    When using these extensions, 16-bit floating-point types are permitted
4085bd8deadSopenharmony_ci    for a number of additional data-types and built-in functions.
4095bd8deadSopenharmony_ci
4105bd8deadSopenharmony_ciInteractions with ARB_shader_atomic_counter_ops and
4115bd8deadSopenharmony_ciSPV_KHR_shader_atomic_counter_ops:
4125bd8deadSopenharmony_ci
4135bd8deadSopenharmony_ci    When using these extensions the following GLSL -> SPIR-V mapping is used:
4145bd8deadSopenharmony_ci
4155bd8deadSopenharmony_ci    * uint atomicCounterAddARB()      -> OpAtomicIAdd
4165bd8deadSopenharmony_ci    * uint atomicCounterSubtractARB() -> OpAtomicISub
4175bd8deadSopenharmony_ci    * uint atomicCounterMinARB()      -> OpAtomicUMin
4185bd8deadSopenharmony_ci    * uint atomicCounterMaxARB()      -> OpAtomicUMax
4195bd8deadSopenharmony_ci    * uint atomicCounterAndARB()      -> OpAtomicAnd
4205bd8deadSopenharmony_ci    * uint atomicCounterOrARB()       -> OpAtomicOr
4215bd8deadSopenharmony_ci    * uint atomicCounterXorARB()      -> OpAtomicXor
4225bd8deadSopenharmony_ci    * uint atomicCounterExchangeARB() -> OpAtomicExchange
4235bd8deadSopenharmony_ci    * uint atomicCounterCompSwapARB() -> OpAtomicCompareExchange
4245bd8deadSopenharmony_ci
4255bd8deadSopenharmony_ciInteractions with ARB_post_depth_coverage or EXT_post_depth_coverage and
4265bd8deadSopenharmony_ciSPV_KHR_post_depth_coverage:
4275bd8deadSopenharmony_ci
4285bd8deadSopenharmony_ci    When using these extensions the following GLSL -> SPIR-V mapping is used:
4295bd8deadSopenharmony_ci
4305bd8deadSopenharmony_ci    * layout(post_depth_coverage) -> PostDepthCoverage.
4315bd8deadSopenharmony_ci
4325bd8deadSopenharmony_ciInteractions with SPV_KHR_storage_buffer_storage_class:
4335bd8deadSopenharmony_ci
4345bd8deadSopenharmony_ci    When SPV_KHR_storage_buffer_storage class is supported, shader storage
4355bd8deadSopenharmony_ci    buffer objects can be mapped to SPIR-V using the *StorageBuffer* storage
4365bd8deadSopenharmony_ci    class and decorated as *Block*, which is considered equivalent (and
4375bd8deadSopenharmony_ci    preferred to) declaring them with the *Uniform* storage class and
4385bd8deadSopenharmony_ci    decorating them with the *BufferBlock* decoration:
4395bd8deadSopenharmony_ci
4405bd8deadSopenharmony_ci      buffer  blockN { ... } ...;  -> Uniform, with BufferBlock decoration
4415bd8deadSopenharmony_ci      buffer  blockN { ... } ...;  -> StorageBuffer, with Block decoration (preferred)
4425bd8deadSopenharmony_ci
4435bd8deadSopenharmony_ci    If SPV_KHR_storage_buffer_storage_class is not supported, ignore all
4445bd8deadSopenharmony_ci    references to the StorageBuffer storage class.
4455bd8deadSopenharmony_ci
4465bd8deadSopenharmony_ciIssues
4475bd8deadSopenharmony_ci
4485bd8deadSopenharmony_ci1. Where should we document environment interactions for new SPIR-V
4495bd8deadSopenharmony_ci   extensions?
4505bd8deadSopenharmony_ci
4515bd8deadSopenharmony_ci   DISCUSSION. The environment interactions could be:
4525bd8deadSopenharmony_ci   a) added to the corresponding (existing) GL extension? This means they
4535bd8deadSopenharmony_ci      would be spread across all manner of documents and hard to find.
4545bd8deadSopenharmony_ci      We would prefer to have them documented in few locations.
4555bd8deadSopenharmony_ci   b) added to ARB_gl_spirv? This means ARB_gl_spirv would be an ever
4565bd8deadSopenharmony_ci      growing document which is a bit strange as it gives no way to
4575bd8deadSopenharmony_ci      advertise or enable the new functionality. Also that document effectively
4585bd8deadSopenharmony_ci      corresponds go GL 4.5 level functionality and is going to be rolled
4595bd8deadSopenharmony_ci      into OpenGL 4.6.
4605bd8deadSopenharmony_ci   c) added to this extension? This document becomes the ever growing version
4615bd8deadSopenharmony_ci      instead, and it does provide a query to be able to tell if new
4625bd8deadSopenharmony_ci      functionality is supported by an implementation.
4635bd8deadSopenharmony_ci
4645bd8deadSopenharmony_ci   RESOLVED. Pick (c). New GL extensions should add their SPIR-V environment
4655bd8deadSopenharmony_ci   restrictions for OpenGL to this document. It it is recommended to include a
4665bd8deadSopenharmony_ci   pointer to this extension from the new GL extension.
4675bd8deadSopenharmony_ci
4685bd8deadSopenharmony_ci2. Does that mean we can add brand new SPIR-V functionality to GL just by
4695bd8deadSopenharmony_ci   editing this extension?
4705bd8deadSopenharmony_ci
4715bd8deadSopenharmony_ci   RESOLVED. Only for shader functionality that already exists in OpenGL
4725bd8deadSopenharmony_ci   by a previous extension.  For completely new functionality it should be
4735bd8deadSopenharmony_ci   done via a new API extension that adds any necessary API support as
4745bd8deadSopenharmony_ci   well as defining the GLSL-version of the functionality.
4755bd8deadSopenharmony_ci
4765bd8deadSopenharmony_ci3. If a new GL extension is added that includes SPIR-V support via a
4775bd8deadSopenharmony_ci   new SPIR-V extension does it's SPIR-V extension also get enumerated by
4785bd8deadSopenharmony_ci   the SPIR_V_EXTENSIONS_ARB query?.
4795bd8deadSopenharmony_ci
4805bd8deadSopenharmony_ci   RESOLVED. Yes. It's good to include it for consistency. Any SPIR-V
4815bd8deadSopenharmony_ci   functionality supported beyond the SPIR-V version that is required
4825bd8deadSopenharmony_ci   for the GL API version should be enumerated.
4835bd8deadSopenharmony_ci
4845bd8deadSopenharmony_ci4. Does (3) mean that we should have a query for the version of SPIR-V
4855bd8deadSopenharmony_ci   that is supported as well?
4865bd8deadSopenharmony_ci
4875bd8deadSopenharmony_ci   RESOLVED. No. With ARB_gl_spirv (and in OpenGL 4.6) OpenGL only supports
4885bd8deadSopenharmony_ci   SPIR-V 1.0. If we want to support additional versions of SPIR-V we'll need
4895bd8deadSopenharmony_ci   to update the SPIR-V environment which will require a new GL extension to
4905bd8deadSopenharmony_ci   to do this.
4915bd8deadSopenharmony_ci
4925bd8deadSopenharmony_ciRevision History
4935bd8deadSopenharmony_ci
4945bd8deadSopenharmony_ci    Rev.    Date         Author         Changes
4955bd8deadSopenharmony_ci    ----  -----------    ------------   ---------------------------------
4965bd8deadSopenharmony_ci     1    2017-01-22     dgkoch         Initial revision
4975bd8deadSopenharmony_ci     2    2017-04-08     dgkoch         Add additional extensions and issues.
4985bd8deadSopenharmony_ci     3    2017-04-21     dgkoch         Assign tokens
4995bd8deadSopenharmony_ci     4    2017-04-22     dgkoch         Add SPV_KHR_shader_atomic_counter_ops
5005bd8deadSopenharmony_ci                                        and add GLSL->SPIR-V mappings.
5015bd8deadSopenharmony_ci     5    2017-04-24     dgkoch         remove ARB suffixes and resolve issue 4.
5025bd8deadSopenharmony_ci     6    2017-04-25     dgkoch         Add SPV_KHR_post_depth_coverage.
5035bd8deadSopenharmony_ci     7    2017-05-09     dgkoch         fix typos.
5045bd8deadSopenharmony_ci     8    2017-07-14     dgkoch         Add SPV_KHR_storage_buffer_storage_class.
5055bd8deadSopenharmony_ci     9    2018-02-20     dgkoch         Update storage class whitelist to include
5065bd8deadSopenharmony_ci                                        storage buffers (SPIR-V/issues/166)
5075bd8deadSopenharmony_ci
508