15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    ARB_gl_spirv
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_ARB_gl_spirv
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContributors
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    John Kessenich, Google
125bd8deadSopenharmony_ci    Daniel Koch, NVIDIA
135bd8deadSopenharmony_ci    Christophe Riccio, Unity
145bd8deadSopenharmony_ci    Graham Sellers, AMD
155bd8deadSopenharmony_ci    Alejandro Piñeiro, Igalia
165bd8deadSopenharmony_ci
175bd8deadSopenharmony_ciContact Point for Bug Reports
185bd8deadSopenharmony_ci
195bd8deadSopenharmony_ci    https://github.com/KhronosGroup/OpenGL-Registry/issues/
205bd8deadSopenharmony_ci
215bd8deadSopenharmony_ciNotice
225bd8deadSopenharmony_ci
235bd8deadSopenharmony_ci    Copyright (c) 2015-2019 The Khronos Group Inc. Copyright terms at
245bd8deadSopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
255bd8deadSopenharmony_ci
265bd8deadSopenharmony_ciSpecification Update Policy
275bd8deadSopenharmony_ci
285bd8deadSopenharmony_ci    Khronos-approved extension specifications are updated in response to
295bd8deadSopenharmony_ci    issues and bugs prioritized by the Khronos OpenGL Working Group. For
305bd8deadSopenharmony_ci    extensions which have been promoted to a core Specification, fixes will
315bd8deadSopenharmony_ci    first appear in the latest version of that core Specification, and will
325bd8deadSopenharmony_ci    eventually be backported to the extension document. This policy is
335bd8deadSopenharmony_ci    described in more detail at
345bd8deadSopenharmony_ci        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
355bd8deadSopenharmony_ci
365bd8deadSopenharmony_ciStatus
375bd8deadSopenharmony_ci
385bd8deadSopenharmony_ci    Complete.
395bd8deadSopenharmony_ci    Ratified by the Khronos Board of Promoters on July 22, 2016.
405bd8deadSopenharmony_ci
415bd8deadSopenharmony_ciVersion
425bd8deadSopenharmony_ci
435bd8deadSopenharmony_ci    Last Modified Date: August 19, 2020
445bd8deadSopenharmony_ci    Revision: 46
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ciNumber
475bd8deadSopenharmony_ci
485bd8deadSopenharmony_ci    ARB Extension #190
495bd8deadSopenharmony_ci
505bd8deadSopenharmony_ciDependencies
515bd8deadSopenharmony_ci
525bd8deadSopenharmony_ci    This extension requires version 3.3 or later of The OpenGL Graphics System.
535bd8deadSopenharmony_ci    (It is not written for OpenGL ES.)
545bd8deadSopenharmony_ci
555bd8deadSopenharmony_ci    This extension is written against the following specifications:
565bd8deadSopenharmony_ci      - The GL_KHR_vulkan_glsl extension, Version 30, April 12, 2016.
575bd8deadSopenharmony_ci      - The OpenGL Graphics System, Version 4.5, Core Profile, May 28, 2015.
585bd8deadSopenharmony_ci      - The OpenGL Shading Language, Version 4.50, Revision 6, April 14, 2016.
595bd8deadSopenharmony_ci      - SPIR-V Specification, Version 1.00, Revision 5
605bd8deadSopenharmony_ci
615bd8deadSopenharmony_ci    This extension interacts with ARB_parallel_shader_compile.
625bd8deadSopenharmony_ci
635bd8deadSopenharmony_ci    This extension interacts with ARB_separate_shader_objects.
645bd8deadSopenharmony_ci
655bd8deadSopenharmony_ci    This extension interacts with ARB_program_interface_query.
665bd8deadSopenharmony_ci
675bd8deadSopenharmony_ciOverview
685bd8deadSopenharmony_ci
695bd8deadSopenharmony_ci    This is version 100 of the GL_ARB_gl_spirv extension.
705bd8deadSopenharmony_ci
715bd8deadSopenharmony_ci    This extension does two things:
725bd8deadSopenharmony_ci
735bd8deadSopenharmony_ci    1. Allows a SPIR-V module to be specified as containing a programmable
745bd8deadSopenharmony_ci       shader stage, rather than using GLSL, whatever the source language
755bd8deadSopenharmony_ci       was used to create the SPIR-V module.
765bd8deadSopenharmony_ci
775bd8deadSopenharmony_ci    2. Modifies GLSL to be a source language for creating SPIR-V modules
785bd8deadSopenharmony_ci       for OpenGL consumption. Such GLSL can be used to create such SPIR-V
795bd8deadSopenharmony_ci       modules, outside of the OpenGL runtime.
805bd8deadSopenharmony_ci
815bd8deadSopenharmony_ci    Enabling GLSL SPIR-V Features
825bd8deadSopenharmony_ci    -----------------------------
835bd8deadSopenharmony_ci
845bd8deadSopenharmony_ci    This extension is not enabled with a #extension as other extensions are.
855bd8deadSopenharmony_ci    It is also not enabled through use of a profile or #version.  The intended
865bd8deadSopenharmony_ci    level of GLSL features comes from the traditional use of #version, profile,
875bd8deadSopenharmony_ci    and #extension.
885bd8deadSopenharmony_ci
895bd8deadSopenharmony_ci    Instead, use of this extension is an effect of using a GLSL front-end in a
905bd8deadSopenharmony_ci    mode that has it generate SPIR-V for OpenGL.  Such tool use is outside the
915bd8deadSopenharmony_ci    scope of using the OpenGL API and outside the definition of GLSL and this
925bd8deadSopenharmony_ci    extension. See the documentation of the compiler to see how to request
935bd8deadSopenharmony_ci    generation of SPIR-V for OpenGL.
945bd8deadSopenharmony_ci
955bd8deadSopenharmony_ci    When a front-end is used to accept the GLSL features in this extension, it
965bd8deadSopenharmony_ci    must error check and reject shaders not adhering to this specification, and
975bd8deadSopenharmony_ci    accept those that do.  Implementation-dependent maximums and capabilities
985bd8deadSopenharmony_ci    are supplied to, or part of, the front-end, so it can do error checking
995bd8deadSopenharmony_ci    against them.
1005bd8deadSopenharmony_ci
1015bd8deadSopenharmony_ci    A shader can query the level of GLSL SPIR-V support available, using the
1025bd8deadSopenharmony_ci    predefined
1035bd8deadSopenharmony_ci
1045bd8deadSopenharmony_ci        #define GL_SPIRV 100
1055bd8deadSopenharmony_ci
1065bd8deadSopenharmony_ci    This allows shader code to say, for example,
1075bd8deadSopenharmony_ci
1085bd8deadSopenharmony_ci        #ifdef GL_SPIRV
1095bd8deadSopenharmony_ci            layout(constant_id = 11) const int count = 4;
1105bd8deadSopenharmony_ci            #if GL_SPIRV > 100
1115bd8deadSopenharmony_ci                ...
1125bd8deadSopenharmony_ci            #endif
1135bd8deadSopenharmony_ci        #else
1145bd8deadSopenharmony_ci            const int count = 6;
1155bd8deadSopenharmony_ci        #endif
1165bd8deadSopenharmony_ci
1175bd8deadSopenharmony_ci    SPIR-V Modules
1185bd8deadSopenharmony_ci    --------------
1195bd8deadSopenharmony_ci
1205bd8deadSopenharmony_ci    An entire stage is held in a single SPIR-V module.  The SPIR-V model is
1215bd8deadSopenharmony_ci    that multiple (e.g., GLSL) compilation units forming a single stage
1225bd8deadSopenharmony_ci    in a high-level language are all compiled and linked together to form a
1235bd8deadSopenharmony_ci    single entry point (and its call tree) in a SPIR-V module.  This would be
1245bd8deadSopenharmony_ci    done prior to using the OpenGL API to create a program object containing the
1255bd8deadSopenharmony_ci    stage.
1265bd8deadSopenharmony_ci
1275bd8deadSopenharmony_ci    The OpenGL API expects the SPIR-V module to have already been validated,
1285bd8deadSopenharmony_ci    and can return an error if it discovers anything invalid in
1295bd8deadSopenharmony_ci    the module.  An invalid SPIR-V module is allowed to result in undefined
1305bd8deadSopenharmony_ci    behavior.
1315bd8deadSopenharmony_ci
1325bd8deadSopenharmony_ci    Specialization Constants
1335bd8deadSopenharmony_ci    ------------------------
1345bd8deadSopenharmony_ci
1355bd8deadSopenharmony_ci    SPIR-V specialization constants, which can be set later by the client API,
1365bd8deadSopenharmony_ci    can be declared using "layout(constant_id=...)". For example, to make a
1375bd8deadSopenharmony_ci    specialization constant with a default value of 12:
1385bd8deadSopenharmony_ci
1395bd8deadSopenharmony_ci        layout(constant_id = 17) const int arraySize = 12;
1405bd8deadSopenharmony_ci
1415bd8deadSopenharmony_ci    Above, "17" is the ID by which the API or other tools can later refer to
1425bd8deadSopenharmony_ci    this specific specialization constant.  The API or an intermediate tool can
1435bd8deadSopenharmony_ci    then change its value to another constant integer before it is fully
1445bd8deadSopenharmony_ci    lowered to executable code.  If it is never changed before final lowering,
1455bd8deadSopenharmony_ci    it will retain the value of 12.
1465bd8deadSopenharmony_ci
1475bd8deadSopenharmony_ci    Specialization constants have const semantics, except they don't fold.
1485bd8deadSopenharmony_ci    Hence, an array can be declared with 'arraySize' from above:
1495bd8deadSopenharmony_ci
1505bd8deadSopenharmony_ci        vec4 data[arraySize];  // legal, even though arraySize might change
1515bd8deadSopenharmony_ci
1525bd8deadSopenharmony_ci    Specialization constants can be in expressions:
1535bd8deadSopenharmony_ci
1545bd8deadSopenharmony_ci        vec4 data2[arraySize + 2];
1555bd8deadSopenharmony_ci
1565bd8deadSopenharmony_ci    This will make data2 be sized by 2 more than whatever constant value
1575bd8deadSopenharmony_ci    'arraySize' has when it is time to lower the shader to executable code.
1585bd8deadSopenharmony_ci
1595bd8deadSopenharmony_ci    An expression formed with specialization constants also behaves in the
1605bd8deadSopenharmony_ci    shader like a specialization constant, not a like a constant.
1615bd8deadSopenharmony_ci
1625bd8deadSopenharmony_ci        arraySize + 2       // a specialization constant (with no constant_id)
1635bd8deadSopenharmony_ci
1645bd8deadSopenharmony_ci    Such expressions can be used in the same places as a constant.
1655bd8deadSopenharmony_ci
1665bd8deadSopenharmony_ci    The constant_id can only be applied to a scalar *int*, a scalar *float*
1675bd8deadSopenharmony_ci    or a scalar *bool*.
1685bd8deadSopenharmony_ci
1695bd8deadSopenharmony_ci    Only basic operators and constructors can be applied to a specialization
1705bd8deadSopenharmony_ci    constant and still result in a specialization constant:
1715bd8deadSopenharmony_ci
1725bd8deadSopenharmony_ci        layout(constant_id = 17) const int arraySize = 12;
1735bd8deadSopenharmony_ci        sin(float(arraySize));    // result is not a specialization constant
1745bd8deadSopenharmony_ci
1755bd8deadSopenharmony_ci    While SPIR-V specialization constants are only for scalars, a vector
1765bd8deadSopenharmony_ci    can be made by operations on scalars:
1775bd8deadSopenharmony_ci
1785bd8deadSopenharmony_ci        layout(constant_id = 18) const int scX = 1;
1795bd8deadSopenharmony_ci        layout(constant_id = 19) const int scZ = 1;
1805bd8deadSopenharmony_ci        const vec3 scVec = vec3(scX, 1, scZ);  // partially specialized vector
1815bd8deadSopenharmony_ci
1825bd8deadSopenharmony_ci    A built-in variable can have a 'constant_id' attached to it:
1835bd8deadSopenharmony_ci
1845bd8deadSopenharmony_ci        layout(constant_id = 18) gl_MaxImageUnits;
1855bd8deadSopenharmony_ci
1865bd8deadSopenharmony_ci    This makes it behave as a specialization constant.  It is not a full
1875bd8deadSopenharmony_ci    redeclaration; all other characteristics are left intact from the
1885bd8deadSopenharmony_ci    original built-in declaration.
1895bd8deadSopenharmony_ci
1905bd8deadSopenharmony_ci    The built-in vector gl_WorkGroupSize can be specialized using special
1915bd8deadSopenharmony_ci    layout local_size_{xyz}_id's applied to the "in" qualifier.  For example:
1925bd8deadSopenharmony_ci
1935bd8deadSopenharmony_ci        layout(local_size_x_id = 18, local_size_z_id = 19) in;
1945bd8deadSopenharmony_ci
1955bd8deadSopenharmony_ci    This leaves gl_WorkGroupSize.y as a non-specialization constant, with
1965bd8deadSopenharmony_ci    gl_WorkGroupSize being a partially specialized vector.  Its x and z
1975bd8deadSopenharmony_ci    components can be later specialized using the ID's 18 and 19.
1985bd8deadSopenharmony_ci
1995bd8deadSopenharmony_ci    gl_FragColor
2005bd8deadSopenharmony_ci    ------------
2015bd8deadSopenharmony_ci
2025bd8deadSopenharmony_ci    The fragment-stage built-in gl_FragColor, which implies a broadcast to all
2035bd8deadSopenharmony_ci    outputs, is not present in SPIR-V. Shaders where writing to gl_FragColor
2045bd8deadSopenharmony_ci    is allowed can still write to it, but it only means to write to an output:
2055bd8deadSopenharmony_ci     - of the same type as gl_FragColor
2065bd8deadSopenharmony_ci     - decorated with location 0
2075bd8deadSopenharmony_ci     - not decorated as a built-in variable.
2085bd8deadSopenharmony_ci    There is no implicit broadcast.
2095bd8deadSopenharmony_ci
2105bd8deadSopenharmony_ci    Mapping to SPIR-V
2115bd8deadSopenharmony_ci    -----------------
2125bd8deadSopenharmony_ci
2135bd8deadSopenharmony_ci    For informational purposes (non-specification), the following is an
2145bd8deadSopenharmony_ci    expected way for an implementation to map GLSL constructs to SPIR-V
2155bd8deadSopenharmony_ci    constructs:
2165bd8deadSopenharmony_ci
2175bd8deadSopenharmony_ci    Mapping of Storage Classes:
2185bd8deadSopenharmony_ci
2195bd8deadSopenharmony_ci      uniform sampler2D...;        -> UniformConstant
2205bd8deadSopenharmony_ci      uniform variable (non-block) -> UniformConstant
2215bd8deadSopenharmony_ci      uniform blockN { ... } ...;  -> Uniform, with Block decoration
2225bd8deadSopenharmony_ci      in / out variable            -> Input/Output, possibly with block (below)
2235bd8deadSopenharmony_ci      in / out block...            -> Input/Output, with Block decoration
2245bd8deadSopenharmony_ci      buffer  blockN { ... } ...;  -> Uniform, with BufferBlock decoration
2255bd8deadSopenharmony_ci      ... uniform atomic_uint ...  -> AtomicCounter
2265bd8deadSopenharmony_ci      shared                       -> Workgroup
2275bd8deadSopenharmony_ci      <normal global>              -> Private
2285bd8deadSopenharmony_ci
2295bd8deadSopenharmony_ci    Mapping of input/output blocks or variables is the same for all versions
2305bd8deadSopenharmony_ci    of GLSL. To the extent variables or members are available in a
2315bd8deadSopenharmony_ci    version and a stage, its location is as follows:
2325bd8deadSopenharmony_ci
2335bd8deadSopenharmony_ci      These are mapped to SPIR-V individual variables, with similarly spelled
2345bd8deadSopenharmony_ci      built-in decorations (except as noted):
2355bd8deadSopenharmony_ci
2365bd8deadSopenharmony_ci        General:
2375bd8deadSopenharmony_ci
2385bd8deadSopenharmony_ci            in gl_VertexID
2395bd8deadSopenharmony_ci            in gl_InstanceID
2405bd8deadSopenharmony_ci            in gl_InvocationID
2415bd8deadSopenharmony_ci            in gl_PatchVerticesIn      (PatchVertices)
2425bd8deadSopenharmony_ci            in gl_PrimitiveIDIn        (PrimitiveID)
2435bd8deadSopenharmony_ci            in/out gl_PrimitiveID      (in/out based only on storage qualifier)
2445bd8deadSopenharmony_ci            in gl_TessCoord
2455bd8deadSopenharmony_ci
2465bd8deadSopenharmony_ci            in/out gl_Layer
2475bd8deadSopenharmony_ci            in/out gl_ViewportIndex
2485bd8deadSopenharmony_ci
2495bd8deadSopenharmony_ci            patch in/out gl_TessLevelOuter  (uses Patch decoration)
2505bd8deadSopenharmony_ci            patch in/out gl_TessLevelInner  (uses Patch decoration)
2515bd8deadSopenharmony_ci
2525bd8deadSopenharmony_ci        Compute stage only:
2535bd8deadSopenharmony_ci
2545bd8deadSopenharmony_ci            in gl_NumWorkGroups
2555bd8deadSopenharmony_ci            in gl_WorkGroupSize
2565bd8deadSopenharmony_ci            in gl_WorkGroupID
2575bd8deadSopenharmony_ci            in gl_LocalInvocationID
2585bd8deadSopenharmony_ci            in gl_GlobalInvocationID
2595bd8deadSopenharmony_ci            in gl_LocalInvocationIndex
2605bd8deadSopenharmony_ci
2615bd8deadSopenharmony_ci        Fragment stage only:
2625bd8deadSopenharmony_ci
2635bd8deadSopenharmony_ci            in gl_FragCoord
2645bd8deadSopenharmony_ci            in gl_FrontFacing
2655bd8deadSopenharmony_ci            in gl_ClipDistance
2665bd8deadSopenharmony_ci            in gl_CullDistance
2675bd8deadSopenharmony_ci            in gl_PointCoord
2685bd8deadSopenharmony_ci            in gl_SampleID
2695bd8deadSopenharmony_ci            in gl_SamplePosition
2705bd8deadSopenharmony_ci            in gl_HelperInvocation
2715bd8deadSopenharmony_ci            out gl_FragDepth
2725bd8deadSopenharmony_ci            in gl_SampleMaskIn        (SampleMask)
2735bd8deadSopenharmony_ci            out gl_SampleMask         (in/out based only on storage qualifier)
2745bd8deadSopenharmony_ci
2755bd8deadSopenharmony_ci      These are mapped to SPIR-V blocks, as implied by the pseudo code, with
2765bd8deadSopenharmony_ci      the members decorated with similarly spelled built-in decorations:
2775bd8deadSopenharmony_ci
2785bd8deadSopenharmony_ci        Non-fragment stage:
2795bd8deadSopenharmony_ci
2805bd8deadSopenharmony_ci            in/out gl_PerVertex {  // some subset of these members will be used
2815bd8deadSopenharmony_ci                gl_Position
2825bd8deadSopenharmony_ci                gl_PointSize
2835bd8deadSopenharmony_ci                gl_ClipDistance
2845bd8deadSopenharmony_ci                gl_CullDistance
2855bd8deadSopenharmony_ci            }                      // name of block is for debug only
2865bd8deadSopenharmony_ci
2875bd8deadSopenharmony_ci      There is at most one input and one output block per stage in SPIR-V.
2885bd8deadSopenharmony_ci      The subset and order of members will match between stages sharing an
2895bd8deadSopenharmony_ci      interface.
2905bd8deadSopenharmony_ci
2915bd8deadSopenharmony_ci    Mapping of precise:
2925bd8deadSopenharmony_ci
2935bd8deadSopenharmony_ci      precise -> NoContraction
2945bd8deadSopenharmony_ci
2955bd8deadSopenharmony_ci    Mapping of atomic_uint /offset/ layout qualifier
2965bd8deadSopenharmony_ci
2975bd8deadSopenharmony_ci      offset         ->  Offset (decoration)
2985bd8deadSopenharmony_ci
2995bd8deadSopenharmony_ci    Mapping of images
3005bd8deadSopenharmony_ci
3015bd8deadSopenharmony_ci      imageLoad()   -> OpImageRead
3025bd8deadSopenharmony_ci      imageStore()  -> OpImageWrite
3035bd8deadSopenharmony_ci      texelFetch()  -> OpImageFetch
3045bd8deadSopenharmony_ci
3055bd8deadSopenharmony_ci      imageAtomicXXX(params, data)  -> %ptr = OpImageTexelPointer params
3065bd8deadSopenharmony_ci                                              OpAtomicXXX %ptr, data
3075bd8deadSopenharmony_ci
3085bd8deadSopenharmony_ci      XXXQueryXXX(combined) -> %image = OpImage combined
3095bd8deadSopenharmony_ci                                        OpXXXQueryXXX %image
3105bd8deadSopenharmony_ci
3115bd8deadSopenharmony_ci    Mapping of layouts
3125bd8deadSopenharmony_ci
3135bd8deadSopenharmony_ci      std140/std430  ->  explicit *Offset*, *ArrayStride*, and *MatrixStride*
3145bd8deadSopenharmony_ci                         Decoration on struct members
3155bd8deadSopenharmony_ci      shared/packed  ->  not allowed
3165bd8deadSopenharmony_ci      <default>      ->  not shared, but std140 or std430
3175bd8deadSopenharmony_ci      xfb_offset     ->  *Offset* Decoration on the object or struct member
3185bd8deadSopenharmony_ci      xfb_buffer     ->  *XfbBuffer* Decoration on the object
3195bd8deadSopenharmony_ci      xfb_stride     ->  *XfbStride* Decoration on the object
3205bd8deadSopenharmony_ci      any xfb_*      ->  the *Xfb* Execution Mode is set
3215bd8deadSopenharmony_ci      captured XFB   ->  has both *XfbBuffer* and *Offset*
3225bd8deadSopenharmony_ci      non-captured   ->  lacking *XfbBuffer* or *Offset*
3235bd8deadSopenharmony_ci
3245bd8deadSopenharmony_ci      max_vertices   ->  OutputVertices
3255bd8deadSopenharmony_ci
3265bd8deadSopenharmony_ci    Mapping of barriers
3275bd8deadSopenharmony_ci
3285bd8deadSopenharmony_ci      barrier() (compute) -> OpControlBarrier(/*Execution*/Workgroup,
3295bd8deadSopenharmony_ci                                              /*Memory*/Workgroup,
3305bd8deadSopenharmony_ci                                              /*Semantics*/AcquireRelease |
3315bd8deadSopenharmony_ci                                                           WorkgroupMemory)
3325bd8deadSopenharmony_ci
3335bd8deadSopenharmony_ci      barrier() (tess control) -> OpControlBarrier(/*Execution*/Workgroup,
3345bd8deadSopenharmony_ci                                                   /*Memory*/Invocation,
3355bd8deadSopenharmony_ci                                                   /*Semantics*/None)
3365bd8deadSopenharmony_ci
3375bd8deadSopenharmony_ci      memoryBarrier() -> OpMemoryBarrier(/*Memory*/Device,
3385bd8deadSopenharmony_ci                                         /*Semantics*/AcquireRelease |
3395bd8deadSopenharmony_ci                                                      UniformMemory |
3405bd8deadSopenharmony_ci                                                      WorkgroupMemory |
3415bd8deadSopenharmony_ci                                                      ImageMemory)
3425bd8deadSopenharmony_ci
3435bd8deadSopenharmony_ci      memoryBarrierBuffer() -> OpMemoryBarrier(/*Memory*/Device,
3445bd8deadSopenharmony_ci                                               /*Semantics*/AcquireRelease |
3455bd8deadSopenharmony_ci                                                            UniformMemory)
3465bd8deadSopenharmony_ci
3475bd8deadSopenharmony_ci      memoryBarrierShared() -> OpMemoryBarrier(/*Memory*/Device,
3485bd8deadSopenharmony_ci                                               /*Semantics*/AcquireRelease |
3495bd8deadSopenharmony_ci                                                            WorkgroupMemory)
3505bd8deadSopenharmony_ci
3515bd8deadSopenharmony_ci      memoryBarrierImage() -> OpMemoryBarrier(/*Memory*/Device,
3525bd8deadSopenharmony_ci                                              /*Semantics*/AcquireRelease |
3535bd8deadSopenharmony_ci                                                           ImageMemory)
3545bd8deadSopenharmony_ci
3555bd8deadSopenharmony_ci      groupMemoryBarrier() -> OpMemoryBarrier(/*Memory*/Workgroup,
3565bd8deadSopenharmony_ci                                              /*Semantics*/AcquireRelease |
3575bd8deadSopenharmony_ci                                                           UniformMemory |
3585bd8deadSopenharmony_ci                                                           WorkgroupMemory |
3595bd8deadSopenharmony_ci                                                           ImageMemory)
3605bd8deadSopenharmony_ci
3615bd8deadSopenharmony_ci    Mapping of atomics
3625bd8deadSopenharmony_ci
3635bd8deadSopenharmony_ci      all atomic builtin functions -> Semantics = None(Relaxed)
3645bd8deadSopenharmony_ci
3655bd8deadSopenharmony_ci      atomicExchange()      -> OpAtomicExchange
3665bd8deadSopenharmony_ci      imageAtomicExchange() -> OpAtomicExchange
3675bd8deadSopenharmony_ci      atomicCompSwap()      -> OpAtomicCompareExchange
3685bd8deadSopenharmony_ci      imageAtomicCompSwap() -> OpAtomicCompareExchange
3695bd8deadSopenharmony_ci      NA                    -> OpAtomicCompareExchangeWeak
3705bd8deadSopenharmony_ci
3715bd8deadSopenharmony_ci      atomicCounterIncrement -> OpAtomicIIncrement
3725bd8deadSopenharmony_ci      atomicCounterDecrement -> OpAtomicIDecrement (with post decrement)
3735bd8deadSopenharmony_ci      atomicCounter          -> OpAtomicLoad
3745bd8deadSopenharmony_ci
3755bd8deadSopenharmony_ci    Mapping of uniform initializers
3765bd8deadSopenharmony_ci
3775bd8deadSopenharmony_ci      Using the OpVariable initializer logic, but only from a constant
3785bd8deadSopenharmony_ci      instruction (not a global one).
3795bd8deadSopenharmony_ci
3805bd8deadSopenharmony_ci    Mapping of other instructions
3815bd8deadSopenharmony_ci
3825bd8deadSopenharmony_ci      %     -> OpUMod/OpSMod
3835bd8deadSopenharmony_ci      mod() -> OpFMod
3845bd8deadSopenharmony_ci      NA    -> OpSRem/OpFRem
3855bd8deadSopenharmony_ci
3865bd8deadSopenharmony_ci      pack/unpack (conversion)    -> pack/unpack in GLSL extended instructions
3875bd8deadSopenharmony_ci      pack/unpack (no conversion) -> OpBitcast
3885bd8deadSopenharmony_ci
3895bd8deadSopenharmony_ci    Differences Relative to Other Specifications
3905bd8deadSopenharmony_ci    --------------------------------------------
3915bd8deadSopenharmony_ci
3925bd8deadSopenharmony_ci    The following summarizes the set of differences to existing specifications.
3935bd8deadSopenharmony_ci
3945bd8deadSopenharmony_ci    Additional use of existing SPIR-V features, relative to Vulkan:
3955bd8deadSopenharmony_ci      + The *UniformConstant* Storage Class can be used on individual
3965bd8deadSopenharmony_ci        variables at global scope. (That is, uniforms don't have to be in a
3975bd8deadSopenharmony_ci        block, unless they are built-in members that are in block in GLSL
3985bd8deadSopenharmony_ci        version 4.5.)
3995bd8deadSopenharmony_ci      + *AtomicCounter* Storage Class can use the *Offset* decoration
4005bd8deadSopenharmony_ci      + OriginLowerLeft
4015bd8deadSopenharmony_ci      + Uniforms support constant initializers.
4025bd8deadSopenharmony_ci
4035bd8deadSopenharmony_ci    Corresponding features that GLSL keeps, despite GL_KHR_vulkan_glsl removal:
4045bd8deadSopenharmony_ci      . default uniforms (those not inside a uniform block)
4055bd8deadSopenharmony_ci      . atomic-counter bindings have the /offset/ layout qualifier
4065bd8deadSopenharmony_ci      . special rules for locations for input doubles in the vertex shader
4075bd8deadSopenharmony_ci      . origin_lower_left
4085bd8deadSopenharmony_ci
4095bd8deadSopenharmony_ci    Addition of features to GLSL:
4105bd8deadSopenharmony_ci      + specialization constants, as per GL_KHR_vulkan_glsl
4115bd8deadSopenharmony_ci      + #define GL_SPIRV 100, when compiled for OpenGL and SPIR-V generation
4125bd8deadSopenharmony_ci      + offset can organize members in a different order than declaration order
4135bd8deadSopenharmony_ci
4145bd8deadSopenharmony_ci    Non-acceptance of SPIR-V features, relative to Vulkan:
4155bd8deadSopenharmony_ci      - VertexIndex and InstanceIndex built-in decorations cannot be used
4165bd8deadSopenharmony_ci      - Push-constant buffers cannot be used
4175bd8deadSopenharmony_ci      - *DescriptorSet* must always be 0, if present
4185bd8deadSopenharmony_ci      - input targets and input attachments
4195bd8deadSopenharmony_ci      - OpTypeSampler
4205bd8deadSopenharmony_ci
4215bd8deadSopenharmony_ci    Corresponding features not added to GLSL that GL_KHR_vulkan_glsl added:
4225bd8deadSopenharmony_ci      . gl_VertexIndex and gl_InstanceIndex
4235bd8deadSopenharmony_ci          (gl_VertexID and gl_InstanceID have same semantics as in GLSL)
4245bd8deadSopenharmony_ci      . push_constant buffers
4255bd8deadSopenharmony_ci      . descriptor sets
4265bd8deadSopenharmony_ci      . input_attachment_index and accessing input targets
4275bd8deadSopenharmony_ci      . shader-combining of textures and samplers
4285bd8deadSopenharmony_ci
4295bd8deadSopenharmony_ci    Removal of features from GLSL, as removed by GL_KHR_vulkan_glsl:
4305bd8deadSopenharmony_ci      - subroutines
4315bd8deadSopenharmony_ci      - the already deprecated texturing functions (e.g., texture2D())
4325bd8deadSopenharmony_ci      - the already deprecated noise functions (e.g., noise1())
4335bd8deadSopenharmony_ci      - compatibility profile features
4345bd8deadSopenharmony_ci      - gl_DepthRangeParameters and gl_NumSamples
4355bd8deadSopenharmony_ci      - *shared* and *packed* block layouts
4365bd8deadSopenharmony_ci
4375bd8deadSopenharmony_ci    Addition of features to The OpenGL Graphics System:
4385bd8deadSopenharmony_ci      + a command to associate a SPIR-V module with a program (ShaderBinary)
4395bd8deadSopenharmony_ci      + a command to select a SPIR-V entry point and set specialization
4405bd8deadSopenharmony_ci        constants in a SPIR-V module (SpecializeShaderARB)
4415bd8deadSopenharmony_ci      + a new appendix for SPIR-V validation rules, precision, etc.
4425bd8deadSopenharmony_ci
4435bd8deadSopenharmony_ci    Changes of system features, relative to Vulkan:
4445bd8deadSopenharmony_ci      . Vulkan uses only one binding point for a resource array, while OpenGL
4455bd8deadSopenharmony_ci        still uses multiple binding points, so binding numbers are counted
4465bd8deadSopenharmony_ci        differently for SPIR-V used in Vulkan and OpenGL
4475bd8deadSopenharmony_ci      . gl_FragColor can be written to, but it won't broadcast, for versions of
4485bd8deadSopenharmony_ci        OpenGL that support gl_FragColor
4495bd8deadSopenharmony_ci      . Vulkan does not allow multi-dimensional arrays of resources like
4505bd8deadSopenharmony_ci        UBOs and SSBOs in its SPIR-V environment spec. SPIR-V supports
4515bd8deadSopenharmony_ci        it and OpenGL already allows this for GLSL shaders. SPIR-V
4525bd8deadSopenharmony_ci        for OpenGL also allows it.
4535bd8deadSopenharmony_ci
4545bd8deadSopenharmony_ci    Additions to the SPIR-V specification:
4555bd8deadSopenharmony_ci      + *Offset* can also apply to an object, for transform feedback.
4565bd8deadSopenharmony_ci      + *Offset* can also apply to a default uniform, for atomic_uint offset.
4575bd8deadSopenharmony_ci
4585bd8deadSopenharmony_ciNew Procedures and Functions
4595bd8deadSopenharmony_ci
4605bd8deadSopenharmony_ci    void SpecializeShaderARB(uint shader,
4615bd8deadSopenharmony_ci                             const char* pEntryPoint,
4625bd8deadSopenharmony_ci                             uint numSpecializationConstants,
4635bd8deadSopenharmony_ci                             const uint* pConstantIndex,
4645bd8deadSopenharmony_ci                             const uint* pConstantValue);
4655bd8deadSopenharmony_ci
4665bd8deadSopenharmony_ciNew Tokens
4675bd8deadSopenharmony_ci
4685bd8deadSopenharmony_ci    Accepted by the <binaryformat> parameter of ShaderBinary:
4695bd8deadSopenharmony_ci
4705bd8deadSopenharmony_ci        SHADER_BINARY_FORMAT_SPIR_V_ARB         0x9551
4715bd8deadSopenharmony_ci
4725bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetShaderiv:
4735bd8deadSopenharmony_ci
4745bd8deadSopenharmony_ci        SPIR_V_BINARY_ARB                       0x9552
4755bd8deadSopenharmony_ci
4765bd8deadSopenharmony_ciModifications to Chapter 7 of the OpenGL 4.5 (Core Profile) Specification
4775bd8deadSopenharmony_ci(Programs and Shaders)
4785bd8deadSopenharmony_ci
4795bd8deadSopenharmony_ci  Additions to overview of Chapter 7, "Programs and Shaders"
4805bd8deadSopenharmony_ci
4815bd8deadSopenharmony_ci    Modify the 4th paragraph beginning with "Alternatively, pre-compiled
4825bd8deadSopenharmony_ci    shader binary code..." as follows:
4835bd8deadSopenharmony_ci
4845bd8deadSopenharmony_ci    "Alternatively, pre-compiled shader binary code can be loaded
4855bd8deadSopenharmony_ci    into a shader object. A SPIR-V module can also be associated with a
4865bd8deadSopenharmony_ci    shader and then _specialized_. An implementation must..."
4875bd8deadSopenharmony_ci
4885bd8deadSopenharmony_ci  Additions to Section 7.1, "Shader Objects":
4895bd8deadSopenharmony_ci
4905bd8deadSopenharmony_ci    Add the following to the end of the description of ShaderSource:
4915bd8deadSopenharmony_ci
4925bd8deadSopenharmony_ci    "If <shader> was previously associated with a SPIR-V module (via the
4935bd8deadSopenharmony_ci    ShaderBinary command), that association is broken. Upon successful
4945bd8deadSopenharmony_ci    completion of this command the SPIR_V_BINARY_ARB state of <shader>
4955bd8deadSopenharmony_ci    is set to FALSE."
4965bd8deadSopenharmony_ci
4975bd8deadSopenharmony_ci    Add a new error for the CompileShader command:
4985bd8deadSopenharmony_ci
4995bd8deadSopenharmony_ci    "An INVALID_OPERATION error is generated if the SPIR_V_BINARY_ARB
5005bd8deadSopenharmony_ci    state of <shader> is TRUE."
5015bd8deadSopenharmony_ci
5025bd8deadSopenharmony_ci    [[ if ARB_parallel_shader_compile is supported: ]]
5035bd8deadSopenharmony_ci    Modify the preamble to the MaxShaderCompilerThreadsARB command to read:
5045bd8deadSopenharmony_ci
5055bd8deadSopenharmony_ci    "Applications may use the following to hint to the driver the maximum
5065bd8deadSopenharmony_ci    number of background threads it would like to be used in the process
5075bd8deadSopenharmony_ci    of compiling or specializing shaders, or linking programs, ..."
5085bd8deadSopenharmony_ci
5095bd8deadSopenharmony_ci  Additions to Section 7.2, "Shader Binaries":
5105bd8deadSopenharmony_ci
5115bd8deadSopenharmony_ci    In the description of ShaderBinary, remove the text stating that GL
5125bd8deadSopenharmony_ci    defines no specific binary formats and replace it with the following:
5135bd8deadSopenharmony_ci
5145bd8deadSopenharmony_ci    "GL defines an execution environment for shaders created from SPIR-V
5155bd8deadSopenharmony_ci    modules. To load a SPIR-V binary into GL, set <binaryformat> to
5165bd8deadSopenharmony_ci    SHADER_BINARY_FORMAT_SPIR_V_ARB. <binary> should point to the start
5175bd8deadSopenharmony_ci    of a valid SPIR-V module binary and <length> should contain the length
5185bd8deadSopenharmony_ci    of that binary, in bytes. Upon successful consumption of the SPIR-V
5195bd8deadSopenharmony_ci    module:
5205bd8deadSopenharmony_ci    * each entry of <shaders> will be associated with that SPIR-V module,
5215bd8deadSopenharmony_ci    * the SPIR_V_BINARY_ARB state of each shader is set to TRUE,
5225bd8deadSopenharmony_ci    * the COMPILE_STATUS of each of these shaders is set to FALSE,
5235bd8deadSopenharmony_ci    * any existing source string (specified by ShaderSource) is removed, and
5245bd8deadSopenharmony_ci    * any information about a previous compile is lost.
5255bd8deadSopenharmony_ci    Shaders associated with SPIR-V modules must be finalized by calling
5265bd8deadSopenharmony_ci    SpecializeShaderARB as described in Section 7.2.1.
5275bd8deadSopenharmony_ci
5285bd8deadSopenharmony_ci    GL also provides a mechanism to obtain token values for additional
5295bd8deadSopenharmony_ci    binary formats provided by extensions. The number of binary formats..."
5305bd8deadSopenharmony_ci
5315bd8deadSopenharmony_ci    Replace the error condition for ShaderBinary which states:
5325bd8deadSopenharmony_ci
5335bd8deadSopenharmony_ci    "An INVALID_OPERATION error is generated if more than one of the
5345bd8deadSopenharmony_ci    handles in shaders refers to the same type of shader object."
5355bd8deadSopenharmony_ci
5365bd8deadSopenharmony_ci    with the following:
5375bd8deadSopenharmony_ci
5385bd8deadSopenharmony_ci    "An INVALID_OPERATION error is generated if <binaryformat> is not
5395bd8deadSopenharmony_ci    SHADER_BINARY_FORMAT_SPIR_V_ARB and more than one of the
5405bd8deadSopenharmony_ci    handles in shaders refers to the same type of shader object."
5415bd8deadSopenharmony_ci
5425bd8deadSopenharmony_ci  Insert Subsection 7.2.1, "Shader Specialization":
5435bd8deadSopenharmony_ci
5445bd8deadSopenharmony_ci    "Shaders associated with SPIR-V modules must be specialized before they
5455bd8deadSopenharmony_ci    can be linked into a program object. It is not necessary to specialize
5465bd8deadSopenharmony_ci    the shader before it is attached to a program object. Once specialized,
5475bd8deadSopenharmony_ci    a shader may not be specialized again without first re-associating the
5485bd8deadSopenharmony_ci    original SPIR-V module with it, through ShaderBinary.
5495bd8deadSopenharmony_ci
5505bd8deadSopenharmony_ci    Specialization does two things:
5515bd8deadSopenharmony_ci
5525bd8deadSopenharmony_ci        * Selects the name of the entry point, for that shader's stage, from
5535bd8deadSopenharmony_ci          the SPIR-V module.
5545bd8deadSopenharmony_ci        * Sets the values of all, or a subset of, the specialization constants
5555bd8deadSopenharmony_ci          in the SPIR-V module.
5565bd8deadSopenharmony_ci
5575bd8deadSopenharmony_ci    To specialize a shader created from a SPIR-V module, call:
5585bd8deadSopenharmony_ci
5595bd8deadSopenharmony_ci        void SpecializeShaderARB(uint shader,
5605bd8deadSopenharmony_ci                                 const char* pEntryPoint,
5615bd8deadSopenharmony_ci                                 uint numSpecializationConstants,
5625bd8deadSopenharmony_ci                                 const uint* pConstantIndex,
5635bd8deadSopenharmony_ci                                 const uint* pConstantValue);
5645bd8deadSopenharmony_ci
5655bd8deadSopenharmony_ci    <shader> is the name of a shader object containing unspecialized SPIR-V
5665bd8deadSopenharmony_ci    as created from a successful call to ShaderBinary to which a SPIR-V
5675bd8deadSopenharmony_ci    module was passed. <pEntryPoint> is a pointer to a NUL-terminated UTF-8
5685bd8deadSopenharmony_ci    string specifying the name of the entry point in the SPIR-V module to
5695bd8deadSopenharmony_ci    use for this shader. <numSpecializationConstants> is the number
5705bd8deadSopenharmony_ci    of specialization constants whose values to set in this call.
5715bd8deadSopenharmony_ci    <pConstantIndex> is a pointer to an array of
5725bd8deadSopenharmony_ci    <numSpecializationConstants> unsigned integers, each holding the index
5735bd8deadSopenharmony_ci    of a specialization constant in the SPIR-V module whose value to set.
5745bd8deadSopenharmony_ci    The corresponding entry in <pConstantValue> is used to set the value of
5755bd8deadSopenharmony_ci    the specialization constant indexed by the entry in <pConstantIndex>.
5765bd8deadSopenharmony_ci    Although this array is of unsigned integer, each entry is bitcast to the
5775bd8deadSopenharmony_ci    appropriate type for the module, and therefore, floating-point constants
5785bd8deadSopenharmony_ci    may be set by including their IEEE-754 bit representation in the
5795bd8deadSopenharmony_ci    <pConstantValue> array. Specialization constants not referenced by
5805bd8deadSopenharmony_ci    <pConstantIndex> retain their default values as specified in the SPIR-V
5815bd8deadSopenharmony_ci    module.
5825bd8deadSopenharmony_ci
5835bd8deadSopenharmony_ci    On successful shader specialization, the compile status for <shader>
5845bd8deadSopenharmony_ci    is set to TRUE. On failure, the compile status for <shader> is set to
5855bd8deadSopenharmony_ci    FALSE and additional information about the cause of the failure may
5865bd8deadSopenharmony_ci    be available in the shader compilation log. Specialization can fail
5875bd8deadSopenharmony_ci    if the SPIR-V module fails to meet the requirements listed in Appendix
5885bd8deadSopenharmony_ci    "The OpenGL SPIR-V Execution Environment".
5895bd8deadSopenharmony_ci
5905bd8deadSopenharmony_ci        Errors
5915bd8deadSopenharmony_ci
5925bd8deadSopenharmony_ci        An INVALID_VALUE error is generated if <shader> is not the name
5935bd8deadSopenharmony_ci        of either a program or shader object.
5945bd8deadSopenharmony_ci
5955bd8deadSopenharmony_ci        An INVALID_OPERATION error is generated if <shader> is the name
5965bd8deadSopenharmony_ci        of a program object.
5975bd8deadSopenharmony_ci
5985bd8deadSopenharmony_ci        INVALID_OPERATION is generated if the value of SPIR_V_BINARY_ARB
5995bd8deadSopenharmony_ci        for <shader> is not TRUE, or if the shader has already been
6005bd8deadSopenharmony_ci        specialized.
6015bd8deadSopenharmony_ci
6025bd8deadSopenharmony_ci        INVALID_VALUE is generated if <pEntryPoint> does not match the
6035bd8deadSopenharmony_ci        <Name> of any OpEntryPoint declaration in the SPIR-V module
6045bd8deadSopenharmony_ci        associated with <shader>.
6055bd8deadSopenharmony_ci
6065bd8deadSopenharmony_ci        INVALID_OPERATION is generated if the <Execution Mode> of the
6075bd8deadSopenharmony_ci        OpEntryPoint indicated by <pEntryPoint> does not match the type
6085bd8deadSopenharmony_ci        of <shader>.
6095bd8deadSopenharmony_ci
6105bd8deadSopenharmony_ci        INVALID_VALUE is generated if any element of <pConstantIndex>
6115bd8deadSopenharmony_ci        refers to a specialization constant that does not exist in the
6125bd8deadSopenharmony_ci        shader module contained in <shader>."
6135bd8deadSopenharmony_ci
6145bd8deadSopenharmony_ci  Additions to Section 7.3, "Program Objects":
6155bd8deadSopenharmony_ci
6165bd8deadSopenharmony_ci    Modify the first paragraph after the AttachShader command to read:
6175bd8deadSopenharmony_ci
6185bd8deadSopenharmony_ci    "Shader objects may be attached to program objects before source code
6195bd8deadSopenharmony_ci    or shader binary has been loaded into the shader object, or before the
6205bd8deadSopenharmony_ci    shader object has been compiled or specialized. Multiple shader ..."
6215bd8deadSopenharmony_ci
6225bd8deadSopenharmony_ci    Modify the first paragraph after the LinkProgram command to read:
6235bd8deadSopenharmony_ci
6245bd8deadSopenharmony_ci    "Linking can fail for a variety of reasons as specified in the OpenGL
6255bd8deadSopenharmony_ci    Shading language specification for source shaders, or if the requirements
6265bd8deadSopenharmony_ci    in the Appendix "The OpenGL SPIR-V Execution Environment" are not met
6275bd8deadSopenharmony_ci    for SPIR-V shaders, as well as any of the following reasons..."
6285bd8deadSopenharmony_ci
6295bd8deadSopenharmony_ci    Modify the second bullet point in the list of reasons LinkProgram can
6305bd8deadSopenharmony_ci    fail:
6315bd8deadSopenharmony_ci
6325bd8deadSopenharmony_ci    "One or more of the shader objects attached to <program> are not compiled
6335bd8deadSopenharmony_ci    or specialized successfully."
6345bd8deadSopenharmony_ci
6355bd8deadSopenharmony_ci    Add a new bullet point to this list:
6365bd8deadSopenharmony_ci
6375bd8deadSopenharmony_ci    "All the shader objects attached to <program> do not have the same value
6385bd8deadSopenharmony_ci    for the SPIR_V_BINARY_ARB state."
6395bd8deadSopenharmony_ci
6405bd8deadSopenharmony_ci  Modifications to Section 7.3.1, "Program Interfaces"
6415bd8deadSopenharmony_ci
6425bd8deadSopenharmony_ci    Add the following paragraph after the list of rules describing how the
6435bd8deadSopenharmony_ci    name string is generated, before the paragraph that begins "The order
6445bd8deadSopenharmony_ci    of the active resource list...":
6455bd8deadSopenharmony_ci
6465bd8deadSopenharmony_ci    "For shaders constructed from SPIR-V binaries (that is with a state of
6475bd8deadSopenharmony_ci    SPIR_V_BINARY_ARB equal to TRUE), variables may not have names associated
6485bd8deadSopenharmony_ci    with them as the OpName and OpMemberName debug instructions are optional
6495bd8deadSopenharmony_ci    and may not be present in a SPIR-V module. When the Op*Name instructions
6505bd8deadSopenharmony_ci    are present, it is implementation-dependent if these are reported via
6515bd8deadSopenharmony_ci    the name reflection APIs. If no _name reflection information_ is
6525bd8deadSopenharmony_ci    available, the name string associated with each active variable is the
6535bd8deadSopenharmony_ci    empty string (""). In this case, any queries that operate with a name
6545bd8deadSopenharmony_ci    as input, will return INVALID_INDEX or -1 as appropriate, and any queries
6555bd8deadSopenharmony_ci    that return information about the name of a resource will report a
6565bd8deadSopenharmony_ci    name length of one (for the null character) and return an empty string
6575bd8deadSopenharmony_ci    with a length of zero."
6585bd8deadSopenharmony_ci
6595bd8deadSopenharmony_ci  Add a new subsection "7.4.spv, SPIR-V Shader Interface Matching" after
6605bd8deadSopenharmony_ci  section 7.4.1 "Shader Interface Matching":
6615bd8deadSopenharmony_ci
6625bd8deadSopenharmony_ci    "7.4.spv, SPIR-V Shader Interface Matching
6635bd8deadSopenharmony_ci
6645bd8deadSopenharmony_ci    SPIR-V shaders must also follow the rules in this section, whether they
6655bd8deadSopenharmony_ci    add to or override those given in section 7.4.1 "Shader Interface
6665bd8deadSopenharmony_ci    Matching."  Most importantly, SPIR-V variables and structure members
6675bd8deadSopenharmony_ci    do not have names and so no interface matching is done by name strings.
6685bd8deadSopenharmony_ci
6695bd8deadSopenharmony_ci    All variables forming the input or output interfaces of shader stages
6705bd8deadSopenharmony_ci    must be listed as operands to the *OpEntryPoint* instruction and are
6715bd8deadSopenharmony_ci    declared with the *Input* or *Output* Storage Classes, respectively,
6725bd8deadSopenharmony_ci    in the SPIR-V module.
6735bd8deadSopenharmony_ci
6745bd8deadSopenharmony_ci    Shader built-in variables meeting the following requirements define the
6755bd8deadSopenharmony_ci    built-in interface block. They must:
6765bd8deadSopenharmony_ci      - be explicitly declared (there are no implicit built-ins),
6775bd8deadSopenharmony_ci      - be decorated with the *BuiltIn* decoration,
6785bd8deadSopenharmony_ci      - be declared in a block whose top-level members are the built-ins.
6795bd8deadSopenharmony_ci      - not have any *Location* or *Component* decorations.
6805bd8deadSopenharmony_ci    Built-ins only participate in interface matching if they are declared in
6815bd8deadSopenharmony_ci    such a block. There must be no more than one built-in interface block
6825bd8deadSopenharmony_ci    per shader per interface.
6835bd8deadSopenharmony_ci
6845bd8deadSopenharmony_ci    User-defined interface variables must be decorated with a *Location*
6855bd8deadSopenharmony_ci    and can also be decorated with a *Component*. These correspond to the
6865bd8deadSopenharmony_ci    location and component discussed in section 7.4.1 "Shader Interface
6875bd8deadSopenharmony_ci    Matching". Uniform and shader storage block variables must also be
6885bd8deadSopenharmony_ci    decorated with a *Binding*.
6895bd8deadSopenharmony_ci
6905bd8deadSopenharmony_ci    A user-defined output variable is considered to match an input variable
6915bd8deadSopenharmony_ci    in the subsequent stage only if the two variables are declared with the
6925bd8deadSopenharmony_ci    same *Location* and *Component* decoration and match in type and
6935bd8deadSopenharmony_ci    decoration, except that interpolation decorations are not required to
6945bd8deadSopenharmony_ci    match.
6955bd8deadSopenharmony_ci
6965bd8deadSopenharmony_ci    Variables or block members declared as structures are considered to
6975bd8deadSopenharmony_ci    match in type if and only if the structure members match in type,
6985bd8deadSopenharmony_ci    decoration, number, and declaration order. Variables or block members
6995bd8deadSopenharmony_ci    declared as arrays are considered to match in type only if both
7005bd8deadSopenharmony_ci    declarations specify the same element type and size.
7015bd8deadSopenharmony_ci
7025bd8deadSopenharmony_ci    At an interface between two non-fragment shader stages, the built-in
7035bd8deadSopenharmony_ci    interface block must match exactly, as described above. At an interface
7045bd8deadSopenharmony_ci    involving the fragment shader inputs, the presence or absence of any
7055bd8deadSopenharmony_ci    built-in output does not affect the interface matching.
7065bd8deadSopenharmony_ci
7075bd8deadSopenharmony_ci    At an interface between two shader stages, the user-defined variable
7085bd8deadSopenharmony_ci    interface must match exactly. Additionally, scalar and vector inputs
7095bd8deadSopenharmony_ci    are well-defined if there is a corresponding output satisfying all of
7105bd8deadSopenharmony_ci    the following conditions:
7115bd8deadSopenharmony_ci     - the input and output match exactly in decoration,
7125bd8deadSopenharmony_ci     - the output is a vector with the same basic type and has at least as
7135bd8deadSopenharmony_ci       many components as the input, and
7145bd8deadSopenharmony_ci     - the common component type of the input and output is 32-bit integer
7155bd8deadSopenharmony_ci       or floating-point (64-bit component types are excluded).
7165bd8deadSopenharmony_ci    In this case, the components of the input will be taken from the first
7175bd8deadSopenharmony_ci    components of the output, and any extra components of the output will
7185bd8deadSopenharmony_ci    be ignored."
7195bd8deadSopenharmony_ci
7205bd8deadSopenharmony_ci  Add a new subsection 7.6.2.spv "SPIR-V Uniform Offsets and Strides" after
7215bd8deadSopenharmony_ci  section 7.6.2.2 "Standard Uniform Block Layout":
7225bd8deadSopenharmony_ci
7235bd8deadSopenharmony_ci    "7.6.2.spv SPIR-V Uniform Offsets and Strides
7245bd8deadSopenharmony_ci
7255bd8deadSopenharmony_ci    The SPIR-V decorations *GLSLShared* or *GLSLPacked* must not be used. A
7265bd8deadSopenharmony_ci    variable in the *Uniform* Storage Class decorated as a *Block* or
7275bd8deadSopenharmony_ci    *BufferBlock* must be explicitly laid out using the *Offset*, *ArrayStride*,
7285bd8deadSopenharmony_ci    and *MatrixStride* decorations. These must follow the alignment rules listed
7295bd8deadSopenharmony_ci    above, but not necessarily the packing rules. More specifically, explicit
7305bd8deadSopenharmony_ci    SPIR-V offsets and strides must obey the following:
7315bd8deadSopenharmony_ci
7325bd8deadSopenharmony_ci    Define the /base alignment/ recursively as:
7335bd8deadSopenharmony_ci
7345bd8deadSopenharmony_ci      - A scalar of size N has a base alignment of N.
7355bd8deadSopenharmony_ci
7365bd8deadSopenharmony_ci      - A two-component vector, with components of size N, has a base alignment
7375bd8deadSopenharmony_ci        of 2N.
7385bd8deadSopenharmony_ci
7395bd8deadSopenharmony_ci      - A three- or four-component vector, with components of size N, has a base
7405bd8deadSopenharmony_ci        alignment of 4N.
7415bd8deadSopenharmony_ci
7425bd8deadSopenharmony_ci      - An array has a base alignment equal to the base alignment of its element
7435bd8deadSopenharmony_ci        type, rounded up to a multiple of 16.
7445bd8deadSopenharmony_ci
7455bd8deadSopenharmony_ci      - A structure has a base alignment equal to the largest base alignment of
7465bd8deadSopenharmony_ci        any of its members, rounded up to a multiple of 16.
7475bd8deadSopenharmony_ci
7485bd8deadSopenharmony_ci      - A row-major matrix of C columns has a base alignment equal to the base
7495bd8deadSopenharmony_ci        alignment of a vector of C matrix components.
7505bd8deadSopenharmony_ci
7515bd8deadSopenharmony_ci      - A column-major matrix has a base alignment equal to the base alignment
7525bd8deadSopenharmony_ci        of the matrix column type.
7535bd8deadSopenharmony_ci
7545bd8deadSopenharmony_ci    Given this definition, blocks must be laid out such that:
7555bd8deadSopenharmony_ci
7565bd8deadSopenharmony_ci      - The *Offset* decoration must be a multiple of its base alignment.
7575bd8deadSopenharmony_ci
7585bd8deadSopenharmony_ci      - Any *ArrayStride* or *MatrixStride* decoration must be an integer
7595bd8deadSopenharmony_ci        multiple of the base alignment of the array or matrix.
7605bd8deadSopenharmony_ci
7615bd8deadSopenharmony_ci      - The *Offset* decoration of a member must not place it between the end of
7625bd8deadSopenharmony_ci        a structure or an array and the next multiple of the base alignment of
7635bd8deadSopenharmony_ci        that structure or array.
7645bd8deadSopenharmony_ci
7655bd8deadSopenharmony_ci      - The numeric order of *Offset* decorations need not follow member
7665bd8deadSopenharmony_ci        declaration order.
7675bd8deadSopenharmony_ci
7685bd8deadSopenharmony_ci    With one exception: Variables in the *Uniform* storage class with a
7695bd8deadSopenharmony_ci    decoration of *BufferBlock* do not need their base alignments rounded up
7705bd8deadSopenharmony_ci    to a multiple of 16.
7715bd8deadSopenharmony_ci
7725bd8deadSopenharmony_ci  Modifications to Section 7.13 "Shader, Program, and Program Pipeline Queries"
7735bd8deadSopenharmony_ci
7745bd8deadSopenharmony_ci    Add the following to the list of <pname> that are accepted by GetShaderiv:
7755bd8deadSopenharmony_ci
7765bd8deadSopenharmony_ci    "If <pname> is SPIR_V_BINARY_ARB, TRUE is returned if the shader has been
7775bd8deadSopenharmony_ci    successfully associated with a SPIR-V binary module by the ShaderBinary
7785bd8deadSopenharmony_ci    command and FALSE is returned otherwise."
7795bd8deadSopenharmony_ci
7805bd8deadSopenharmony_ci    Modify the description of COMPILE_STATUS to be as follows:
7815bd8deadSopenharmony_ci
7825bd8deadSopenharmony_ci    "If <pname> is COMPILE_STATUS, TRUE is returned if the shader was last
7835bd8deadSopenharmony_ci    compiled or specialized successfully, and FALSE is returned otherwise."
7845bd8deadSopenharmony_ci
7855bd8deadSopenharmony_ci    [[ if ARB_parallel_shader_compile is supported: ]]
7865bd8deadSopenharmony_ci    Modify the description of COMPLETION_STATUS_ARB to be as follows:
7875bd8deadSopenharmony_ci
7885bd8deadSopenharmony_ci    "If <pname> is COMPLETION_STATUS_ARB, FALSE is returned if the shader is
7895bd8deadSopenharmony_ci     currently being compiled or specialized by a background thread, TRUE
7905bd8deadSopenharmony_ci     otherwise."
7915bd8deadSopenharmony_ci
7925bd8deadSopenharmony_ci    Modify the Errors list for GetShaderiv and add SPIR_V_BINARY_ARB to the
7935bd8deadSopenharmony_ci    list of <pname> that are accepted.
7945bd8deadSopenharmony_ci
7955bd8deadSopenharmony_ci    In the description of the GetProgramiv command, modify the definitions of
7965bd8deadSopenharmony_ci    the ACTIVE_ATTRIBUTE_MAX_LENGTH, ACTIVE_UNIFORM_MAX_LENGTH,
7975bd8deadSopenharmony_ci    TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH, and
7985bd8deadSopenharmony_ci    ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH <pname> values to be as follows:
7995bd8deadSopenharmony_ci
8005bd8deadSopenharmony_ci    "If pname is ACTIVE_ATTRIBUTE_MAX_LENGTH, the length of the longest
8015bd8deadSopenharmony_ci    active attribute name, including a null terminator, is returned.
8025bd8deadSopenharmony_ci    If no active attributes exist, zero is returned. If no name reflection
8035bd8deadSopenharmony_ci    information is available, one is returned."
8045bd8deadSopenharmony_ci
8055bd8deadSopenharmony_ci    "If pname is ACTIVE_UNIFORM_MAX_LENGTH, the length of the longest active
8065bd8deadSopenharmony_ci    uniform name, including a null terminator, is returned. If no active
8075bd8deadSopenharmony_ci    uniforms exist, zero is returned. If no name reflection information is
8085bd8deadSopenharmony_ci    available, one is returned."
8095bd8deadSopenharmony_ci
8105bd8deadSopenharmony_ci    "If pname is TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH, the length of the
8115bd8deadSopenharmony_ci    longest output variable name specified to be used for transform feedback,
8125bd8deadSopenharmony_ci    including a null terminator, is returned. If no outputs are used for
8135bd8deadSopenharmony_ci    transform feedback, zero is returned. If no name reflection information
8145bd8deadSopenharmony_ci    is available, one is returned."
8155bd8deadSopenharmony_ci
8165bd8deadSopenharmony_ci    "If pname is ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, the length of the
8175bd8deadSopenharmony_ci    longest active uniform block name, including the null terminator, is
8185bd8deadSopenharmony_ci    returned. If no active uniform blocks exist, zero is returned. If no
8195bd8deadSopenharmony_ci    name reflection information is available, one is returned."
8205bd8deadSopenharmony_ci
8215bd8deadSopenharmony_ci    Modify the description of GetShaderInfoLog to read as follows:
8225bd8deadSopenharmony_ci
8235bd8deadSopenharmony_ci    "If <shader> is a shader object, GetShaderInfoLog will return either
8245bd8deadSopenharmony_ci    an empty string or information about the last compilation or
8255bd8deadSopenharmony_ci    specialization attempt for that object."
8265bd8deadSopenharmony_ci
8275bd8deadSopenharmony_ci  Modifications to Section 7.14 "Required State":
8285bd8deadSopenharmony_ci
8295bd8deadSopenharmony_ci    Add to the list of state per shader object:
8305bd8deadSopenharmony_ci
8315bd8deadSopenharmony_ci    "A boolean holding the SPIR-V binary status, initially FALSE."
8325bd8deadSopenharmony_ci
8335bd8deadSopenharmony_ciModifications to Chapter 11 of the OpenGL 4.5 (Core Profile) Specification
8345bd8deadSopenharmony_ci(Programmable Vertex Processing)
8355bd8deadSopenharmony_ci
8365bd8deadSopenharmony_ci  Modify Section 11.1.1 "Vertex Attributes"
8375bd8deadSopenharmony_ci
8385bd8deadSopenharmony_ci    Replace the last sentence in the first paragraph ("This binding can be..")
8395bd8deadSopenharmony_ci    with the following:
8405bd8deadSopenharmony_ci
8415bd8deadSopenharmony_ci    "This binding can be specified in the shader text using the location
8425bd8deadSopenharmony_ci    qualifier, in a SPIR-V shader using the *Location* decoration, by the
8435bd8deadSopenharmony_ci    application before the program is linked, or automatically assigned by
8445bd8deadSopenharmony_ci    the GL when the program is linked."
8455bd8deadSopenharmony_ci
8465bd8deadSopenharmony_ci    In the second paragraph of the definition of BindAttribLocation, replace
8475bd8deadSopenharmony_ci    occurrences of "shader text" with "shader text or SPIR-V binary".
8485bd8deadSopenharmony_ci
8495bd8deadSopenharmony_ci    Add to the end of the third paragraph of the definition of
8505bd8deadSopenharmony_ci    BindAttribLocation:
8515bd8deadSopenharmony_ci
8525bd8deadSopenharmony_ci    "BindAttribLocation has no effect on SPIR-V shaders as the locations
8535bd8deadSopenharmony_ci    must always be fully specified in the SPIR-V shader as described in
8545bd8deadSopenharmony_ci    section 11.1.1.1 (SPIR-V Vertex Input Interface)."
8555bd8deadSopenharmony_ci
8565bd8deadSopenharmony_ci  Add the following new subsection to the end of section 11.1.1
8575bd8deadSopenharmony_ci  "Vertex Attributes":
8585bd8deadSopenharmony_ci
8595bd8deadSopenharmony_ci    "Section 11.1.1.1 SPIR-V Vertex Input interface
8605bd8deadSopenharmony_ci
8615bd8deadSopenharmony_ci    When a SPIR-V vertex stage is present, the vertex shader
8625bd8deadSopenharmony_ci    variables listed by *OpEntryPoint* with the *Input* Storage Class
8635bd8deadSopenharmony_ci    form the vertex input attribute interface. These inputs must be
8645bd8deadSopenharmony_ci    decorated with a *Location* and can also be decorated with a
8655bd8deadSopenharmony_ci    *Component* decoration. These correspond to the location and
8665bd8deadSopenharmony_ci    component layout discussed in section  11.1.1 "Vertex Attributes."
8675bd8deadSopenharmony_ci
8685bd8deadSopenharmony_ci    The vertex shader input variables are matched only by the
8695bd8deadSopenharmony_ci    *Location* and *Component* decorations, and must have a corresponding
8705bd8deadSopenharmony_ci    attribute and binding in the pipeline."
8715bd8deadSopenharmony_ci
8725bd8deadSopenharmony_ci  Modify section 11.1.2.1 "Output Variables"
8735bd8deadSopenharmony_ci
8745bd8deadSopenharmony_ci    Replace the first sentence of the second paragraph describing transform
8755bd8deadSopenharmony_ci    feedback mode ("The set of variables to record...") with the following:
8765bd8deadSopenharmony_ci
8775bd8deadSopenharmony_ci    "The set of variables to record can be specified in shader text using
8785bd8deadSopenharmony_ci    xfb_buffer, xfb_offset, or xfb_stride layout qualifiers. For SPIR-V
8795bd8deadSopenharmony_ci    shaders, these are specified by the *XfbBuffer*, *Offset*, and *XfbStride*
8805bd8deadSopenharmony_ci    decorations, respectively. When a SPIR-V entry point is using any of these
8815bd8deadSopenharmony_ci    for transform feedback, it must declare the *Xfb* Execution Mode."
8825bd8deadSopenharmony_ci
8835bd8deadSopenharmony_ci    Modify the last paragraph of the definition of TransformFeedbackVaryings
8845bd8deadSopenharmony_ci    ("If the shader is used to record...") as follows:
8855bd8deadSopenharmony_ci
8865bd8deadSopenharmony_ci    "If the shader used to record output variables for transform feedback
8875bd8deadSopenharmony_ci    varyings uses the xfb_buffer, xfb_offset, or xfb_stride layout qualifiers,
8885bd8deadSopenharmony_ci    or its SPIR-V entry point declares the *Xfb* Execution Mode, the values
8895bd8deadSopenharmony_ci    specified by TransformFeedbackVaryings are ignored, and the set of
8905bd8deadSopenharmony_ci    variables captured for transform feedback is instead derived from the
8915bd8deadSopenharmony_ci    specified layout qualifiers or SPIR-V decorations: outputs specifying both
8925bd8deadSopenharmony_ci    an *XfbBuffer* and an *Offset* are captured, while outputs not specifying
8935bd8deadSopenharmony_ci    both of these are not captured. Values are captured each time the shader
8945bd8deadSopenharmony_ci    writes to such a decorated object."
8955bd8deadSopenharmony_ci
8965bd8deadSopenharmony_ciModifications to Chapter 15 of the OpenGL 4.5 (Core Profile) Specification
8975bd8deadSopenharmony_ci(Programmable Fragment Processing)
8985bd8deadSopenharmony_ci
8995bd8deadSopenharmony_ci  Modify section 15.2.3 "Shader Outputs"
9005bd8deadSopenharmony_ci
9015bd8deadSopenharmony_ci    Replace the sentence leading up to the definition of the
9025bd8deadSopenharmony_ci    BindFragDataLocationIndexed command with the following:
9035bd8deadSopenharmony_ci
9045bd8deadSopenharmony_ci    "The binding of a user-defined output variable to components of a
9055bd8deadSopenharmony_ci    fragment color number can be specified explicitly in the shader text,
9065bd8deadSopenharmony_ci    SPIR-V shader, or using the command ..."
9075bd8deadSopenharmony_ci
9085bd8deadSopenharmony_ci    Modify the paragraph following the definition of BindFragDataLocation,
9095bd8deadSopenharmony_ci    replacing the second and third sentences with the following:
9105bd8deadSopenharmony_ci
9115bd8deadSopenharmony_ci    "Output variables declared with location, component, or index layout
9125bd8deadSopenharmony_ci    qualifiers will use the values specified in the shader text. For SPIR-V
9135bd8deadSopenharmony_ci    shaders, these are specified by the *Location*, *Component*, and *Index*
9145bd8deadSopenharmony_ci    decorations. Output variables without such layout or decoration qualifiers
9155bd8deadSopenharmony_ci    will use the bindings specified by BindFragDataLocationIndexed or
9165bd8deadSopenharmony_ci    BindFragDataLocation, if any. BindFragDataLocation* has no effect on
9175bd8deadSopenharmony_ci    SPIR-V shaders as the locations must always be fully specified as
9185bd8deadSopenharmony_ci    described in section 15.2.3.1 (SPIR-V Fragment Output Interface)."
9195bd8deadSopenharmony_ci
9205bd8deadSopenharmony_ci  Add the following new subsection to the end of 15.2.3 "Shader Outputs"
9215bd8deadSopenharmony_ci
9225bd8deadSopenharmony_ci    "Section 15.2.3.1 "SPIR-V Fragment Output Interface"
9235bd8deadSopenharmony_ci
9245bd8deadSopenharmony_ci    When a SPIR-V fragment stage is present, the variables listed by
9255bd8deadSopenharmony_ci    *OpEntryPoint* with the *Output* Storage Class form the fragment
9265bd8deadSopenharmony_ci    output interface. These variables must be decorated with a *Location*
9275bd8deadSopenharmony_ci    They can also be decorated with a *Component* and/or an *Index*.
9285bd8deadSopenharmony_ci
9295bd8deadSopenharmony_ci    User-defined fragment shader output variables are matched only by their
9305bd8deadSopenharmony_ci    *Location*, *Component*, and *Index* decorations. If two outputs
9315bd8deadSopenharmony_ci    are placed within the same location, they must have the same underlying
9325bd8deadSopenharmony_ci    type (floating-point or integer). No component aliasing of output
9335bd8deadSopenharmony_ci    variables is allowed.  That is, there must not be two output variables
9345bd8deadSopenharmony_ci    which have the same location, component, and index, either explicitly
9355bd8deadSopenharmony_ci    declared or implied. Output values written by a fragment shader must
9365bd8deadSopenharmony_ci    be declared with either *OpTypeFloat* or *OpTypeInt*, and a *Width* of
9375bd8deadSopenharmony_ci    32. Composites of these types are also permitted."
9385bd8deadSopenharmony_ci
9395bd8deadSopenharmony_ci
9405bd8deadSopenharmony_ciAdd Appendix A.spv "The OpenGL SPIR-V Execution Environment" to the OpenGL 4.5
9415bd8deadSopenharmony_ci(Core Profile) Specification
9425bd8deadSopenharmony_ci
9435bd8deadSopenharmony_ci    "A.spv.1 (Required Versions and Formats)
9445bd8deadSopenharmony_ci
9455bd8deadSopenharmony_ci    An implementation of this extension must support the 1.0 version of
9465bd8deadSopenharmony_ci    SPIR-V and the 1.0 version of the SPIR-V Extended Instructions for GLSL.
9475bd8deadSopenharmony_ci
9485bd8deadSopenharmony_ci    A SPIR-V module passed into ShaderBinary is interpreted as a series of
9495bd8deadSopenharmony_ci    32-bit words in host endianness, with literal strings packed as described
9505bd8deadSopenharmony_ci    in section 2.2 of the SPIR-V Specification. The first few words of the
9515bd8deadSopenharmony_ci    SPIR-V module must be a magic number and a SPIR-V version number, as
9525bd8deadSopenharmony_ci    described in section 2.3 of the SPIR-V Specification.
9535bd8deadSopenharmony_ci
9545bd8deadSopenharmony_ci    A.spv.2 (Valid SPIR-V Built-In Variable Decorations)
9555bd8deadSopenharmony_ci
9565bd8deadSopenharmony_ci    Implementations supporting GL 4.5 must support the following
9575bd8deadSopenharmony_ci    built-in variable decorations. When used with earlier versions
9585bd8deadSopenharmony_ci    of GL, this list may be subset to the functionality in that
9595bd8deadSopenharmony_ci    version. Each built-in below lists the minimum OpenGL version
9605bd8deadSopenharmony_ci    (or extension) that is required to use the built-in variable
9615bd8deadSopenharmony_ci    decoration.
9625bd8deadSopenharmony_ci
9635bd8deadSopenharmony_ci
9645bd8deadSopenharmony_ci        Built-in Variable Decoration    Minimum GL version (Extension)
9655bd8deadSopenharmony_ci        ----------------------------    -----------------------------
9665bd8deadSopenharmony_ci        NumWorkgroups                   GL 4.3 (ARB_compute_shader)
9675bd8deadSopenharmony_ci        WorkgroupSize                   GL 4.3 (ARB_compute_shader)
9685bd8deadSopenharmony_ci        WorkgroupId                     GL 4.3 (ARB_compute_shader)
9695bd8deadSopenharmony_ci        LocalInvocationId               GL 4.3 (ARB_compute_shader)
9705bd8deadSopenharmony_ci        GlobalInvocationId              GL 4.3 (ARB_compute_shader)
9715bd8deadSopenharmony_ci        LocalInvocationIndex            GL 4.3 (ARB_compute_shader)
9725bd8deadSopenharmony_ci
9735bd8deadSopenharmony_ci        VertexId
9745bd8deadSopenharmony_ci        InstanceId
9755bd8deadSopenharmony_ci
9765bd8deadSopenharmony_ci        Position
9775bd8deadSopenharmony_ci        PointSize
9785bd8deadSopenharmony_ci        ClipDistance
9795bd8deadSopenharmony_ci        CullDistance                    GL 4.5 (ARB_cull_distance)
9805bd8deadSopenharmony_ci
9815bd8deadSopenharmony_ci        PrimitiveId
9825bd8deadSopenharmony_ci        InvocationId                    GL 4.0 (ARB_tessellation_shader)
9835bd8deadSopenharmony_ci
9845bd8deadSopenharmony_ci        Layer
9855bd8deadSopenharmony_ci        ViewportIndex                   GL 4.1 (ARB_viewport_array)
9865bd8deadSopenharmony_ci
9875bd8deadSopenharmony_ci        PatchVertices                   GL 4.0 (ARB_tessellation_shader)
9885bd8deadSopenharmony_ci        TessLevelOuter                  GL 4.0 (ARB_tessellation_shader)
9895bd8deadSopenharmony_ci        TessLevelInner                  GL 4.0 (ARB_tessellation_shader)
9905bd8deadSopenharmony_ci        TessCoord                       GL 4.0 (ARB_tessellation_shader)
9915bd8deadSopenharmony_ci
9925bd8deadSopenharmony_ci        FragCoord
9935bd8deadSopenharmony_ci        FrontFacing
9945bd8deadSopenharmony_ci        PointCoord
9955bd8deadSopenharmony_ci        SampleId                        GL 4.0 (ARB_sample_shading)
9965bd8deadSopenharmony_ci        SamplePosition                  GL 4.0 (ARB_sample_shading)
9975bd8deadSopenharmony_ci        SampleMask                      GL 4.0 (ARB_sample_shading)
9985bd8deadSopenharmony_ci        HelperInvocation                GL 4.5 (ARB_ES3_1_compatibility)
9995bd8deadSopenharmony_ci        FragDepth
10005bd8deadSopenharmony_ci
10015bd8deadSopenharmony_ci    A.spv.3 (Valid SPIR-V Capabilities)
10025bd8deadSopenharmony_ci
10035bd8deadSopenharmony_ci    Implementations supporting OpenGL 4.5 must support the following
10045bd8deadSopenharmony_ci    capability operands declared by OpCapability.
10055bd8deadSopenharmony_ci
10065bd8deadSopenharmony_ci    When used against earlier versions of GL, this list may be subset
10075bd8deadSopenharmony_ci    to the functionality in that version. Each capability below lists
10085bd8deadSopenharmony_ci    the OpenGL version (or extension) that is required to use the
10095bd8deadSopenharmony_ci    OpCapability.
10105bd8deadSopenharmony_ci
10115bd8deadSopenharmony_ci        OpCapability                        Minimum GL version (Extension)
10125bd8deadSopenharmony_ci        ------------------------------      -----------------------------
10135bd8deadSopenharmony_ci        Matrix
10145bd8deadSopenharmony_ci        Shader
10155bd8deadSopenharmony_ci        Geometry
10165bd8deadSopenharmony_ci        Tessellation                        GL 4.0 (ARB_tessellation_shader)
10175bd8deadSopenharmony_ci        Float64                             GL 4.0 (ARB_gpu_shader_fp64)
10185bd8deadSopenharmony_ci        AtomicStorage                       GL 4.2 (ARB_shader_atomic_counters)
10195bd8deadSopenharmony_ci        TessellationPointSize               GL 4.0 (ARB_tessellation_shader)
10205bd8deadSopenharmony_ci        GeometryPointSize
10215bd8deadSopenharmony_ci        ImageGatherExtended                 GL 4.0 (ARB_gpu_shader5)
10225bd8deadSopenharmony_ci        StorageImageMultisample             GL 4.2 (ARB_shader_image_load_store)
10235bd8deadSopenharmony_ci        UniformBufferArrayDynamicIndexing   GL 4.0 (ARB_gpu_shader5)
10245bd8deadSopenharmony_ci        SampledImageArrayDynamicIndexing    GL 4.0 (ARB_gpu_shader5)
10255bd8deadSopenharmony_ci        StorageBufferArrayDynamicIndexing   GL 4.3 (ARB_shader_storage_buffer_object)
10265bd8deadSopenharmony_ci        StorageImageArrayDynamicIndexing    GL 4.2 (ARB_shader_image_load_store)
10275bd8deadSopenharmony_ci        ClipDistance
10285bd8deadSopenharmony_ci        CullDistance                        GL 4.5 (ARB_cull_distance)
10295bd8deadSopenharmony_ci        ImageCubeArray                      GL 4.0 (ARB_texture_cube_map_array)
10305bd8deadSopenharmony_ci        SampleRateShading                   GL 4.0 (ARB_sample_shading)
10315bd8deadSopenharmony_ci        ImageRect
10325bd8deadSopenharmony_ci        SampledRect
10335bd8deadSopenharmony_ci        Sampled1D
10345bd8deadSopenharmony_ci        Image1D
10355bd8deadSopenharmony_ci        SampledCubeArray                    GL 4.0 (ARB_texture_cube_map_array)
10365bd8deadSopenharmony_ci        SampledBuffer
10375bd8deadSopenharmony_ci        ImageBuffer
10385bd8deadSopenharmony_ci        ImageMSArray
10395bd8deadSopenharmony_ci        StorageImageExtendedFormats         GL 4.2 (ARB_shader_image_load_store)
10405bd8deadSopenharmony_ci        ImageQuery
10415bd8deadSopenharmony_ci        DerivativeControl                   GL 4.5 (ARB_derivative_control)
10425bd8deadSopenharmony_ci        InterpolationFunction               GL 4.0 (ARB_gpu_shader5)
10435bd8deadSopenharmony_ci        TransformFeedback
10445bd8deadSopenharmony_ci        GeometryStreams                     GL 4.0 (ARB_gpu_shader5)
10455bd8deadSopenharmony_ci        StorageImageWriteWithoutFormat      GL 4.2 (ARB_shader_image_load_store)
10465bd8deadSopenharmony_ci        MultiViewport                       GL 4.1 (ARB_viewport_array)
10475bd8deadSopenharmony_ci
10485bd8deadSopenharmony_ci    Implementations supporting ARB_gpu_shader_int64 must support the
10495bd8deadSopenharmony_ci    following operand declared by OpCapability:
10505bd8deadSopenharmony_ci
10515bd8deadSopenharmony_ci        Int64
10525bd8deadSopenharmony_ci
10535bd8deadSopenharmony_ci    Implementations supporting ARB_sparse_texture2 must support the
10545bd8deadSopenharmony_ci    following operand declared by OpCapability:
10555bd8deadSopenharmony_ci
10565bd8deadSopenharmony_ci        SparseResidency
10575bd8deadSopenharmony_ci
10585bd8deadSopenharmony_ci    Implementations supporting ARB_sparse_texture_clamp must support the
10595bd8deadSopenharmony_ci    following operand declared by OpCapability:
10605bd8deadSopenharmony_ci
10615bd8deadSopenharmony_ci        MinLod
10625bd8deadSopenharmony_ci
10635bd8deadSopenharmony_ci    Implementations supporting EXT_shader_image_load_formatted must
10645bd8deadSopenharmony_ci    support the following operand declared by OpCapability:
10655bd8deadSopenharmony_ci
10665bd8deadSopenharmony_ci        StorageImageReadWithoutFormat
10675bd8deadSopenharmony_ci
10685bd8deadSopenharmony_ci    Implementations supporting NV_shader_atomic_int64 must support the
10695bd8deadSopenharmony_ci    following operand declared by OpCapability:
10705bd8deadSopenharmony_ci
10715bd8deadSopenharmony_ci        Int64Atomics
10725bd8deadSopenharmony_ci
10735bd8deadSopenharmony_ci    A.spv.4 (Validation rules)
10745bd8deadSopenharmony_ci
10755bd8deadSopenharmony_ci    (in addition to what's allowed/disallowed above)
10765bd8deadSopenharmony_ci
10775bd8deadSopenharmony_ci    Every entry point must have no return value and accept no arguments.
10785bd8deadSopenharmony_ci
10795bd8deadSopenharmony_ci    The *Logical* addressing model must be selected.
10805bd8deadSopenharmony_ci
10815bd8deadSopenharmony_ci    *Scope* for execution must be limited to:
10825bd8deadSopenharmony_ci      - Workgroup
10835bd8deadSopenharmony_ci      - Subgroup
10845bd8deadSopenharmony_ci
10855bd8deadSopenharmony_ci    *Scope* for memory must be limited to:
10865bd8deadSopenharmony_ci      - Device
10875bd8deadSopenharmony_ci      - Workgroup
10885bd8deadSopenharmony_ci      - Invocation
10895bd8deadSopenharmony_ci
10905bd8deadSopenharmony_ci    *Storage Class* must be limited to:
10915bd8deadSopenharmony_ci      - *UniformConstant*
10925bd8deadSopenharmony_ci      - *Input*
10935bd8deadSopenharmony_ci      - *Uniform*
10945bd8deadSopenharmony_ci      - *Output*
10955bd8deadSopenharmony_ci      - *Workgroup*
10965bd8deadSopenharmony_ci      - *Private*
10975bd8deadSopenharmony_ci      - *Function*
10985bd8deadSopenharmony_ci      - *AtomicCounter*
10995bd8deadSopenharmony_ci      - *Image*
11005bd8deadSopenharmony_ci
11015bd8deadSopenharmony_ci    Images:
11025bd8deadSopenharmony_ci      - OpTypeImage must declare a scalar 32-bit float or 32-bit integer
11035bd8deadSopenharmony_ci        type for the /Sampled Type/.
11045bd8deadSopenharmony_ci      - OpSampledImage, OpImageQuerySizeLod, and OpImageQueryLevels must
11055bd8deadSopenharmony_ci        only consume an /Image/ operand whose type has its /Sampled/
11065bd8deadSopenharmony_ci        operand set to 1.
11075bd8deadSopenharmony_ci      - The /Depth/ operand of OpTypeImage is ignored.
11085bd8deadSopenharmony_ci      - The Image Format of OpImageWrite must not be Unknown, unless the
11095bd8deadSopenharmony_ci        StorageImageWriteWithoutFormat OpCapability was declared.
11105bd8deadSopenharmony_ci
11115bd8deadSopenharmony_ci    *AtomicCounter* storage class:
11125bd8deadSopenharmony_ci      - Unless otherwise specified, variables declared in the AtomicCounter
11135bd8deadSopenharmony_ci        storage class must be unsigned 32-bit integers.
11145bd8deadSopenharmony_ci      - When using the Atomic Instructions, the 'Memory Semantics' operand
11155bd8deadSopenharmony_ci        must be *AtomicCounterMemory*, without inclusion of memory-ordering
11165bd8deadSopenharmony_ci        bits (implying *Relaxed* semantics).
11175bd8deadSopenharmony_ci
11185bd8deadSopenharmony_ci    Decorations:
11195bd8deadSopenharmony_ci      - The Flat, NoPerspective, Sample, and Centroid decorations must not
11205bd8deadSopenharmony_ci        be used on variables with Storage Class other than *Input* or on
11215bd8deadSopenharmony_ci        variables used in the interface of non-fragment shader entry points.
11225bd8deadSopenharmony_ci      - The Patch decoration must not be used on variables in the interface
11235bd8deadSopenharmony_ci        of a vertex, geometry, or fragment shader stage's entry point.
11245bd8deadSopenharmony_ci      - OpTypeRuntimeArray must only be used for the last member of an
11255bd8deadSopenharmony_ci        OpTypeStruct in the Uniform Storage Class and is decorated as
11265bd8deadSopenharmony_ci        BufferBlock.
11275bd8deadSopenharmony_ci      - If the *Xfb* Execution Mode is set, any output variable that is at
11285bd8deadSopenharmony_ci        least partially captured:
11295bd8deadSopenharmony_ci        * must be decorated with an *XfbBuffer*, declaring the capturing buffer
11305bd8deadSopenharmony_ci        * must have at least one captured output variable in the capturing
11315bd8deadSopenharmony_ci          buffer decorated with an *XfbStride* (and all such *XfbStride* values
11325bd8deadSopenharmony_ci          for the capturing buffer must be equal)
11335bd8deadSopenharmony_ci      - If the *Xfb* Execution Mode is set, any captured output:
11345bd8deadSopenharmony_ci        * must be a non-structure decorated with *Offset* or a member of a
11355bd8deadSopenharmony_ci          structure whose type member is decorated with *Offset*
11365bd8deadSopenharmony_ci          (not all members of such a struct need be captured)
11375bd8deadSopenharmony_ci        * must be a numerical type scalar, vector, matrix, or array of these
11385bd8deadSopenharmony_ci        * must have an *Offset* that is a multiple of its first component
11395bd8deadSopenharmony_ci        * must have an *Offset* that is a multiple of 8 if any captured output
11405bd8deadSopenharmony_ci          in the capturing buffer is a 64-bit type, in which case the
11415bd8deadSopenharmony_ci          corresponding *XfbStride* must also be a multiple of 8
11425bd8deadSopenharmony_ci        * must not overlap (i.e., alias in any capturing buffer) any other
11435bd8deadSopenharmony_ci          captured output
11445bd8deadSopenharmony_ci        * must not have an *Offset* that causes overflow of the *XfbStride*
11455bd8deadSopenharmony_ci
11465bd8deadSopenharmony_ci    Compute Shaders
11475bd8deadSopenharmony_ci      - For each compute shader entry point, either a LocalSize execution
11485bd8deadSopenharmony_ci        mode or an object decorated with the WorkgroupSize decoration must
11495bd8deadSopenharmony_ci        be specified.
11505bd8deadSopenharmony_ci
11515bd8deadSopenharmony_ci    Recursion:
11525bd8deadSopenharmony_ci      - For all entry points, the static function-call graph rooted at that
11535bd8deadSopenharmony_ci        entry point must not contain cycles.
11545bd8deadSopenharmony_ci
11555bd8deadSopenharmony_ci    User declared input and output variables:
11565bd8deadSopenharmony_ci      - Must not use OpTypeBool, either directly or as part of an aggregate.
11575bd8deadSopenharmony_ci
11585bd8deadSopenharmony_ci    Atomic Access Rules:
11595bd8deadSopenharmony_ci      - Atomic instructions must declare a scalar 32-bit integer type, or a
11605bd8deadSopenharmony_ci        scalar 64-bit integer type if the *Int64Atomics* capability is enabled,
11615bd8deadSopenharmony_ci        for the value pointed to by *Pointer*
11625bd8deadSopenharmony_ci
11635bd8deadSopenharmony_ci    A.spv.5 (Precision and Operation of SPIR-V Instructions)
11645bd8deadSopenharmony_ci
11655bd8deadSopenharmony_ci    The following rules apply to both single and double-precision floating
11665bd8deadSopenharmony_ci    point instructions:
11675bd8deadSopenharmony_ci     - Positive and negative infinities and positive and negative zeros are
11685bd8deadSopenharmony_ci       generated as dictated by [IEEE 754], but subject to the precisions
11695bd8deadSopenharmony_ci       allowed in the following table.
11705bd8deadSopenharmony_ci     - Dividing a non-zero by a zero results in the appropriately signed
11715bd8deadSopenharmony_ci       IEEE 754 infinity.
11725bd8deadSopenharmony_ci     - Any denormalized value input into a shader or potentially generated
11735bd8deadSopenharmony_ci       by any instruction in a shader may be flushed to 0.
11745bd8deadSopenharmony_ci     - The rounding mode cannot be set and is undefined.
11755bd8deadSopenharmony_ci     - NaNs are not required to be generated. Instructions that operate on
11765bd8deadSopenharmony_ci       a NaN are not required to return a NaN as the result.
11775bd8deadSopenharmony_ci     - Support for signaling NaNs is optional and exceptions are never
11785bd8deadSopenharmony_ci       raised.
11795bd8deadSopenharmony_ci
11805bd8deadSopenharmony_ci    The precision of double-precision instructions is at least that of
11815bd8deadSopenharmony_ci    single precision. For single precision (32 bit) instructions,
11825bd8deadSopenharmony_ci    precisions are required to be at least as follows:
11835bd8deadSopenharmony_ci
11845bd8deadSopenharmony_ci       Instruction                                           Precision
11855bd8deadSopenharmony_ci       -----------                                           ---------
11865bd8deadSopenharmony_ci       OpFAdd                                            Correctly rounded
11875bd8deadSopenharmony_ci       OpFSub                                            Correctly rounded
11885bd8deadSopenharmony_ci       OpFMul                                            Correctly rounded
11895bd8deadSopenharmony_ci       OpFOrdEqual, OpFUnordEqual                          Correct result
11905bd8deadSopenharmony_ci       OpFOrdLessThan, OpFUnordLessThan                    Correct result
11915bd8deadSopenharmony_ci       OpFOrdGreaterThan, OpFUnordGreaterThan              Correct result
11925bd8deadSopenharmony_ci       OpFOrdLessThanEqual, OpFUnordLessThanEqual          Correct result
11935bd8deadSopenharmony_ci       OpFOrdGreaterThanEqual, OpFUnordGreaterThanEqual    Correct result
11945bd8deadSopenharmony_ci       OpFDiv                                          2.5 ULP for b in the
11955bd8deadSopenharmony_ci                                                  range [2^(-126), 2^(126)]
11965bd8deadSopenharmony_ci       conversions between types                         Correctly rounded
11975bd8deadSopenharmony_ci
11985bd8deadSopenharmony_ci    A.spv.6 (Precision of GLSL.std.450 Instructions)
11995bd8deadSopenharmony_ci
12005bd8deadSopenharmony_ci       Instruction                                           Precision
12015bd8deadSopenharmony_ci       -----------                                           ---------
12025bd8deadSopenharmony_ci       fma()             Inherited from OpFMul followed by OpFAdd.
12035bd8deadSopenharmony_ci       exp(x), exp2(x)   (3+2*|x|) ULP
12045bd8deadSopenharmony_ci       log(), log2()     3 ULP outside the range [0.5, 2.0]
12055bd8deadSopenharmony_ci                         absolute error < 2^(-21) inside the range [0.5, 2.0]
12065bd8deadSopenharmony_ci       pow(x, y)         Inherited from exp2(y * log2(x))
12075bd8deadSopenharmony_ci       sqrt()            Inherited from 1.0 / inversesqrt()
12085bd8deadSopenharmony_ci       inversesqrt()     2 ULP
12095bd8deadSopenharmony_ci
12105bd8deadSopenharmony_ci    GLSL.std.450 extended instructions specifically defined in terms of
12115bd8deadSopenharmony_ci    the above instructions inherit the above errors. GLSL.std.450
12125bd8deadSopenharmony_ci    extended instructions not listed above and not defined in terms of the
12135bd8deadSopenharmony_ci    above have undefined precision. These include, for example, the
12145bd8deadSopenharmony_ci    trigonometric functions and determinant.
12155bd8deadSopenharmony_ci
12165bd8deadSopenharmony_ci    For the OpSRem and OpSMod instructions, if either operand is negative
12175bd8deadSopenharmony_ci    the result is undefined.
12185bd8deadSopenharmony_ci
12195bd8deadSopenharmony_ciChanges to The OpenGL Shading Language Specification, Version 4.50
12205bd8deadSopenharmony_ci
12215bd8deadSopenharmony_ci  Changes to Chapter 1 of the OpenGL Shading Language 4.50 Specification
12225bd8deadSopenharmony_ci  (Introduction)
12235bd8deadSopenharmony_ci
12245bd8deadSopenharmony_ci    Add a paragraph: "The OpenGL API will specify the OpenGL commands used to
12255bd8deadSopenharmony_ci    manipulate SPIR-V shaders.  Independent offline tool chains will compile
12265bd8deadSopenharmony_ci    GLSL down to the SPIR-V intermediate language. SPIR-V generation is not
12275bd8deadSopenharmony_ci    enabled with a #extension, #version, or a profile.  Instead, use of GLSL
12285bd8deadSopenharmony_ci    for SPIR-V is determined by offline tool-chain use. See the documentation
12295bd8deadSopenharmony_ci    of such tools to see how to request generation of SPIR-V for OpenGL."
12305bd8deadSopenharmony_ci
12315bd8deadSopenharmony_ci    "GLSL -> SPIR-V compilers must be directed as to what SPIR-V *Capabilities*
12325bd8deadSopenharmony_ci    are legal at run-time and give errors for GLSL feature use outside those
12335bd8deadSopenharmony_ci    capabilities.  This is also true for implementation-dependent limits that
12345bd8deadSopenharmony_ci    can be error checked by the front-end against constants present in the
12355bd8deadSopenharmony_ci    GLSL source: the front-end can be informed of such limits, and report
12365bd8deadSopenharmony_ci    errors when they are exceeded."
12375bd8deadSopenharmony_ci
12385bd8deadSopenharmony_ci  Changes to Chapter 3 of the OpenGL Shading Language 4.50 Specification
12395bd8deadSopenharmony_ci  (Basics)
12405bd8deadSopenharmony_ci
12415bd8deadSopenharmony_ci    After describing the compatibility profile rules, add:
12425bd8deadSopenharmony_ci
12435bd8deadSopenharmony_ci       "Compatibility-profile features are not available when generating SPIR-V."
12445bd8deadSopenharmony_ci
12455bd8deadSopenharmony_ci    Add a new paragraph at the end of section "3.3 Preprocessor":  "When
12465bd8deadSopenharmony_ci    shaders are compiled for OpenGL SPIR-V, the following predefined macro is
12475bd8deadSopenharmony_ci    available:
12485bd8deadSopenharmony_ci
12495bd8deadSopenharmony_ci        #define GL_SPIRV 100
12505bd8deadSopenharmony_ci
12515bd8deadSopenharmony_ci  Changes to Chapter 4 of the OpenGL Shading Language 4.50 Specification
12525bd8deadSopenharmony_ci  (Variables and Types)
12535bd8deadSopenharmony_ci
12545bd8deadSopenharmony_ci    Change section 4.3.3 Constant Expressions:
12555bd8deadSopenharmony_ci
12565bd8deadSopenharmony_ci      Add a new very first sentence to this section:
12575bd8deadSopenharmony_ci
12585bd8deadSopenharmony_ci        "SPIR-V specialization constants are expressed in GLSL as const, with
12595bd8deadSopenharmony_ci        a layout qualifier identifier of constant_id, as described in section
12605bd8deadSopenharmony_ci        4.4.x Specialization-Constant Qualifier."
12615bd8deadSopenharmony_ci
12625bd8deadSopenharmony_ci      Add to this bullet
12635bd8deadSopenharmony_ci
12645bd8deadSopenharmony_ci        "A constant expression is one of...
12655bd8deadSopenharmony_ci          * a variable declared with the const qualifier and an initializer,
12665bd8deadSopenharmony_ci            where the initializer is a constant expression"
12675bd8deadSopenharmony_ci
12685bd8deadSopenharmony_ci      to make it say:
12695bd8deadSopenharmony_ci
12705bd8deadSopenharmony_ci        "A constant expression is one of...
12715bd8deadSopenharmony_ci          * a variable declared with the const qualifier and an initializer,
12725bd8deadSopenharmony_ci            where the initializer is a constant expression; this includes both
12735bd8deadSopenharmony_ci            const declared with a specialization-constant layout qualifier,
12745bd8deadSopenharmony_ci            e.g., 'layout(constant_id = ...)' and those declared without a
12755bd8deadSopenharmony_ci            specialization-constant layout qualifier"
12765bd8deadSopenharmony_ci
12775bd8deadSopenharmony_ci      Add to "including getting an element of a constant array," that
12785bd8deadSopenharmony_ci
12795bd8deadSopenharmony_ci        "an array access with a specialization constant as an index does
12805bd8deadSopenharmony_ci        not result in a constant expression"
12815bd8deadSopenharmony_ci
12825bd8deadSopenharmony_ci      Add to this bullet
12835bd8deadSopenharmony_ci
12845bd8deadSopenharmony_ci        "A constant expression is one of...
12855bd8deadSopenharmony_ci          * the value returned by a built-in function..."
12865bd8deadSopenharmony_ci
12875bd8deadSopenharmony_ci      to make it say:
12885bd8deadSopenharmony_ci
12895bd8deadSopenharmony_ci        "A constant expression is one of...
12905bd8deadSopenharmony_ci          * for non-specialization-constants only: the value returned by a
12915bd8deadSopenharmony_ci            built-in function... (when any function is called with an argument
12925bd8deadSopenharmony_ci            that is a specialization constant, the result is not a constant
12935bd8deadSopenharmony_ci            expression)"
12945bd8deadSopenharmony_ci
12955bd8deadSopenharmony_ci      Rewrite the last half of the last paragraph to be its own paragraph
12965bd8deadSopenharmony_ci      saying:
12975bd8deadSopenharmony_ci
12985bd8deadSopenharmony_ci        "Non-specialization constant expressions may be evaluated by the
12995bd8deadSopenharmony_ci        compiler's host platform, and are therefore not required ...
13005bd8deadSopenharmony_ci        [rest of paragraph stays the same]"
13015bd8deadSopenharmony_ci
13025bd8deadSopenharmony_ci      Add a paragraph
13035bd8deadSopenharmony_ci
13045bd8deadSopenharmony_ci        "Specialization constant expressions are never evaluated by the
13055bd8deadSopenharmony_ci        front-end, but instead retain the operations needed to evaluate them
13065bd8deadSopenharmony_ci        later on the host."
13075bd8deadSopenharmony_ci
13085bd8deadSopenharmony_ci    Add to the table in section 4.4 Layout Qualifiers:
13095bd8deadSopenharmony_ci
13105bd8deadSopenharmony_ci                             | Individual Variable | Block | Allowed Interface
13115bd8deadSopenharmony_ci      ------------------------------------------------------------------------
13125bd8deadSopenharmony_ci      constant_id =          |     scalar only     |       |      const
13135bd8deadSopenharmony_ci      ------------------------------------------------------------------------
13145bd8deadSopenharmony_ci
13155bd8deadSopenharmony_ci    (The other columns remain blank.)
13165bd8deadSopenharmony_ci
13175bd8deadSopenharmony_ci    Also add to this table:
13185bd8deadSopenharmony_ci
13195bd8deadSopenharmony_ci                         | Qualifier Only | Allowed Interface
13205bd8deadSopenharmony_ci      -------------------------------------------------------
13215bd8deadSopenharmony_ci      local_size_x_id =  |        X       |       in
13225bd8deadSopenharmony_ci      local_size_y_id =  |        X       |       in
13235bd8deadSopenharmony_ci      local_size_z_id =  |        X       |       in
13245bd8deadSopenharmony_ci
13255bd8deadSopenharmony_ci    (The other columns remain blank.)
13265bd8deadSopenharmony_ci
13275bd8deadSopenharmony_ci    Expand this sentence in section 4.4.1 Input Layout Qualifiers
13285bd8deadSopenharmony_ci
13295bd8deadSopenharmony_ci      "Where integral-constant-expression is defined in section 4.3.3 Constant
13305bd8deadSopenharmony_ci      Expressions as 'integral constant expression'"
13315bd8deadSopenharmony_ci
13325bd8deadSopenharmony_ci    to include the following:
13335bd8deadSopenharmony_ci
13345bd8deadSopenharmony_ci      ", with it being a compile-time error for integer-constant-expression to
13355bd8deadSopenharmony_ci      be a specialization constant:  The constant used to set a layout
13365bd8deadSopenharmony_ci      identifier X in layout(layout-qualifier-name = X) must evaluate to a
13375bd8deadSopenharmony_ci      front-end constant containing no specialization constants."
13385bd8deadSopenharmony_ci
13395bd8deadSopenharmony_ci    At the end of the paragraphs describing the *location* rules, add this
13405bd8deadSopenharmony_ci    paragraph:
13415bd8deadSopenharmony_ci
13425bd8deadSopenharmony_ci      "When generating SPIR-V, all *in* and *out* qualified user-declared
13435bd8deadSopenharmony_ci      (non built-in) variables and blocks (or all their members) must have a
13445bd8deadSopenharmony_ci      shader-specified *location*. Otherwise, a compile-time error is
13455bd8deadSopenharmony_ci      generated."
13465bd8deadSopenharmony_ci
13475bd8deadSopenharmony_ci    [Note that an earlier existing rule just above this says "If a block has
13485bd8deadSopenharmony_ci    no block-level *location* layout qualifier, it is required that either all
13495bd8deadSopenharmony_ci    or none of its members have a *location* layout qualifier, or a compile-
13505bd8deadSopenharmony_ci    time error results."]
13515bd8deadSopenharmony_ci
13525bd8deadSopenharmony_ci    Add a new subsection at the end of section 4.4:
13535bd8deadSopenharmony_ci
13545bd8deadSopenharmony_ci      "4.4.x Specialization-Constant Qualifier
13555bd8deadSopenharmony_ci
13565bd8deadSopenharmony_ci      "Specialization constants are declared using "layout(constant_id=...)".
13575bd8deadSopenharmony_ci      For example:
13585bd8deadSopenharmony_ci
13595bd8deadSopenharmony_ci        layout(constant_id = 17) const int arraySize = 12;
13605bd8deadSopenharmony_ci
13615bd8deadSopenharmony_ci      "The above makes a specialization constant with a default value of 12.
13625bd8deadSopenharmony_ci      17 is the ID by which the API or other tools can later refer to
13635bd8deadSopenharmony_ci      this specific specialization constant. If it is never changed before
13645bd8deadSopenharmony_ci      final lowering, it will retain the value of 12. It is a compile-time
13655bd8deadSopenharmony_ci      error to use the constant_id qualifier on anything but a scalar bool,
13665bd8deadSopenharmony_ci      int, uint, float, or double.
13675bd8deadSopenharmony_ci
13685bd8deadSopenharmony_ci      "Built-in constants can be declared to be specialization constants.
13695bd8deadSopenharmony_ci      For example,
13705bd8deadSopenharmony_ci
13715bd8deadSopenharmony_ci        layout(constant_id = 31) gl_MaxClipDistances;  // add specialization id
13725bd8deadSopenharmony_ci
13735bd8deadSopenharmony_ci      "The declaration uses just the name of the previously declared built-in
13745bd8deadSopenharmony_ci      variable, with a constant_id layout declaration.  It is a compile-time
13755bd8deadSopenharmony_ci      error to do this after the constant has been used: Constants are strictly
13765bd8deadSopenharmony_ci      either non-specialization constants or specialization constants, not
13775bd8deadSopenharmony_ci      both.
13785bd8deadSopenharmony_ci
13795bd8deadSopenharmony_ci      "The built-in constant vector gl_WorkGroupSize can be specialized using
13805bd8deadSopenharmony_ci      the local_size_{xyz}_id qualifiers, to individually give the components
13815bd8deadSopenharmony_ci      an id. For example:
13825bd8deadSopenharmony_ci
13835bd8deadSopenharmony_ci          layout(local_size_x_id = 18, local_size_z_id = 19) in;
13845bd8deadSopenharmony_ci
13855bd8deadSopenharmony_ci      "This leaves gl_WorkGroupSize.y as a non-specialization constant, with
13865bd8deadSopenharmony_ci      gl_WorkGroupSize being a partially specialized vector.  Its x and z
13875bd8deadSopenharmony_ci      components can be later specialized using the ids 18 and 19.  These ids
13885bd8deadSopenharmony_ci      are declared independently from declaring the workgroup size:
13895bd8deadSopenharmony_ci
13905bd8deadSopenharmony_ci        layout(local_size_x = 32, local_size_y = 32) in;   // size is (32,32,1)
13915bd8deadSopenharmony_ci        layout(local_size_x_id = 18) in;                   // constant_id for x
13925bd8deadSopenharmony_ci        layout(local_size_z_id = 19) in;                   // constant_id for z
13935bd8deadSopenharmony_ci
13945bd8deadSopenharmony_ci      "Existing rules for declaring local_size_x, local_size_y, and
13955bd8deadSopenharmony_ci      local_size_z are not changed by this extension. For the local-size ids,
13965bd8deadSopenharmony_ci      it is a compile-time error to provide different id values for the same
13975bd8deadSopenharmony_ci      local-size id, or to provide them after any use.  Otherwise, order,
13985bd8deadSopenharmony_ci      placement, number of statements, and replication do not cause errors.
13995bd8deadSopenharmony_ci
14005bd8deadSopenharmony_ci      "Two arrays sized with specialization constants are the same type only if
14015bd8deadSopenharmony_ci      sized with the same symbol, involving no operations.
14025bd8deadSopenharmony_ci
14035bd8deadSopenharmony_ci        layout(constant_id = 51) const int aSize = 20;
14045bd8deadSopenharmony_ci        const int pad = 2;
14055bd8deadSopenharmony_ci        const int total = aSize + pad; // specialization constant
14065bd8deadSopenharmony_ci        int a[total], b[total];        // a and b have the same type
14075bd8deadSopenharmony_ci        int c[22];                     // different type than a or b
14085bd8deadSopenharmony_ci        int d[aSize + pad];            // different type than a, b, or c
14095bd8deadSopenharmony_ci        int e[aSize + 2];              // different type than a, b, c, or d
14105bd8deadSopenharmony_ci
14115bd8deadSopenharmony_ci      "Types containing arrays sized with a specialization constant cannot be
14125bd8deadSopenharmony_ci      compared, assigned as aggregates, declared with an initializer, or used
14135bd8deadSopenharmony_ci      as an initializer.  They can, however, be passed as arguments to
14145bd8deadSopenharmony_ci      functions having formal parameters of the same type.
14155bd8deadSopenharmony_ci
14165bd8deadSopenharmony_ci      "Arrays inside a block may be sized with a specialization constant, but
14175bd8deadSopenharmony_ci      the block will have a static layout.  Changing the specialized size will
14185bd8deadSopenharmony_ci      not re-layout the block. In the absence of explicit offsets, the layout
14195bd8deadSopenharmony_ci      will be based on the default size of the array."
14205bd8deadSopenharmony_ci
14215bd8deadSopenharmony_ci    Change section 4.4.5 Uniform and Shader Storage Block Layout Qualifiers
14225bd8deadSopenharmony_ci
14235bd8deadSopenharmony_ci      Add
14245bd8deadSopenharmony_ci
14255bd8deadSopenharmony_ci        "The 'shared' and 'packed' layout qualifiers are not available when
14265bd8deadSopenharmony_ci        generating SPIR-V."
14275bd8deadSopenharmony_ci
14285bd8deadSopenharmony_ci      Change
14295bd8deadSopenharmony_ci
14305bd8deadSopenharmony_ci        "The initial state of compilation is as if the following were declared:"
14315bd8deadSopenharmony_ci
14325bd8deadSopenharmony_ci      To
14335bd8deadSopenharmony_ci
14345bd8deadSopenharmony_ci        "The initial state of compilation when generating SPIR-V is as if the
14355bd8deadSopenharmony_ci        following were declared:"
14365bd8deadSopenharmony_ci
14375bd8deadSopenharmony_ci          layout(std140, column_major) uniform;
14385bd8deadSopenharmony_ci          layout(std430, column_major) buffer;
14395bd8deadSopenharmony_ci
14405bd8deadSopenharmony_ci        "The initial state of compilation when not generating SPIR-V is as if
14415bd8deadSopenharmony_ci        the following were declared:..."
14425bd8deadSopenharmony_ci
14435bd8deadSopenharmony_ci      Change
14445bd8deadSopenharmony_ci
14455bd8deadSopenharmony_ci        "It is a compile-time error to specify an offset that is smaller than
14465bd8deadSopenharmony_ci        the offset of the previous member in the block or that lies within the
14475bd8deadSopenharmony_ci        previous member of the block."
14485bd8deadSopenharmony_ci
14495bd8deadSopenharmony_ci      To
14505bd8deadSopenharmony_ci
14515bd8deadSopenharmony_ci        "It is a compile-time error to have any offset, explicit or assigned,
14525bd8deadSopenharmony_ci        that lies within another member of the block. When not generating
14535bd8deadSopenharmony_ci        SPIR-V, it is a compile-time error to specify an offset that is smaller
14545bd8deadSopenharmony_ci        than the offset of the previous member in the block."
14555bd8deadSopenharmony_ci
14565bd8deadSopenharmony_ci  Changes to Chapter 5 of the OpenGL Shading Language 4.50 Specification
14575bd8deadSopenharmony_ci  (Operators and Expressions)
14585bd8deadSopenharmony_ci
14595bd8deadSopenharmony_ci    Add a section at the end of section 5
14605bd8deadSopenharmony_ci
14615bd8deadSopenharmony_ci      "5.x Specialization Constant Operations"
14625bd8deadSopenharmony_ci
14635bd8deadSopenharmony_ci      Only some operations discussed in this section may be applied to a
14645bd8deadSopenharmony_ci      specialization constant and still yield a result that is as
14655bd8deadSopenharmony_ci      specialization constant.  The operations allowed are listed below.
14665bd8deadSopenharmony_ci      When a specialization constant is operated on with one of these
14675bd8deadSopenharmony_ci      operators and with another constant or specialization constant, the
14685bd8deadSopenharmony_ci      result is implicitly a specialization constant.
14695bd8deadSopenharmony_ci
14705bd8deadSopenharmony_ci       - int(), uint(), and bool() constructors for type conversions
14715bd8deadSopenharmony_ci         from any of the following types to any of the following types:
14725bd8deadSopenharmony_ci           * int
14735bd8deadSopenharmony_ci           * uint
14745bd8deadSopenharmony_ci           * bool
14755bd8deadSopenharmony_ci       - vector versions of the above conversion constructors
14765bd8deadSopenharmony_ci       - allowed implicit conversions of the above
14775bd8deadSopenharmony_ci       - swizzles (e.g., foo.yx)
14785bd8deadSopenharmony_ci       - The following when applied to integer or unsigned integer types:
14795bd8deadSopenharmony_ci           * unary negative ( - )
14805bd8deadSopenharmony_ci           * binary operations ( + , - , * , / , % )
14815bd8deadSopenharmony_ci           * shift ( <<, >> )
14825bd8deadSopenharmony_ci           * bitwise operations ( & , | , ^ )
14835bd8deadSopenharmony_ci       - The following when applied to integer or unsigned integer scalar types:
14845bd8deadSopenharmony_ci           * comparison ( == , != , > , >= , < , <= )
14855bd8deadSopenharmony_ci       - The following when applied to the Boolean scalar type:
14865bd8deadSopenharmony_ci           * not ( ! )
14875bd8deadSopenharmony_ci           * logical operations ( && , || , ^^ )
14885bd8deadSopenharmony_ci           * comparison ( == , != )
14895bd8deadSopenharmony_ci       - The ternary operator ( ? : )
14905bd8deadSopenharmony_ci
14915bd8deadSopenharmony_ci  Changes to Chapter 6 of the OpenGL Shading Language 4.50 Specification
14925bd8deadSopenharmony_ci
14935bd8deadSopenharmony_ci    Add at the beginning of section 6.1.2 Subroutines:
14945bd8deadSopenharmony_ci
14955bd8deadSopenharmony_ci      "Subroutine functionality is not available when generating SPIR-V."
14965bd8deadSopenharmony_ci
14975bd8deadSopenharmony_ci  Changes to Chapter 7 of the OpenGL Shading Language 4.50 Specification
14985bd8deadSopenharmony_ci  (Built-In Variables)
14995bd8deadSopenharmony_ci
15005bd8deadSopenharmony_ci    Add to the beginning of section 7.4 Built-In Uniform State:
15015bd8deadSopenharmony_ci
15025bd8deadSopenharmony_ci      "Built-in uniform state is not available when generating SPIR-V."
15035bd8deadSopenharmony_ci
15045bd8deadSopenharmony_ci  Section 8.14 "Noise Functions"
15055bd8deadSopenharmony_ci
15065bd8deadSopenharmony_ci    Add: "Noise functions are not present when generating SPIR-V."
15075bd8deadSopenharmony_ci
15085bd8deadSopenharmony_ci  Changes to Chapter 9 of the OpenGL Shading Language 4.50 Specification
15095bd8deadSopenharmony_ci  (Shading Language Grammar for Core Profile)
15105bd8deadSopenharmony_ci
15115bd8deadSopenharmony_ci    Arrays can no longer require the size to be a compile-time folded constant
15125bd8deadSopenharmony_ci    expression.  Change
15135bd8deadSopenharmony_ci
15145bd8deadSopenharmony_ci      | LEFT_BRACKET constant_expression RIGHT_BRACKET
15155bd8deadSopenharmony_ci
15165bd8deadSopenharmony_ci    to
15175bd8deadSopenharmony_ci
15185bd8deadSopenharmony_ci      | LEFT_BRACKET conditional_expression RIGHT_BRACKET
15195bd8deadSopenharmony_ci
15205bd8deadSopenharmony_ci    and change
15215bd8deadSopenharmony_ci
15225bd8deadSopenharmony_ci      | array_specifier LEFT_BRACKET constant_expression RIGHT_BRACKET
15235bd8deadSopenharmony_ci
15245bd8deadSopenharmony_ci    to
15255bd8deadSopenharmony_ci
15265bd8deadSopenharmony_ci      | array_specifier LEFT_BRACKET conditional_expression RIGHT_BRACKET
15275bd8deadSopenharmony_ci
15285bd8deadSopenharmony_ciChanges to the SPIR-V specification
15295bd8deadSopenharmony_ci
15305bd8deadSopenharmony_ci  Section 3.20. Decoration
15315bd8deadSopenharmony_ci
15325bd8deadSopenharmony_ci    *Offset* can also apply to an object, for transform feedback.
15335bd8deadSopenharmony_ci
15345bd8deadSopenharmony_ci    *Offset* can also apply to an object in AtomicCounter storage for an
15355bd8deadSopenharmony_ci    atomic counter.
15365bd8deadSopenharmony_ci
15375bd8deadSopenharmony_ciDependencies on ARB_parallel_shader_compile
15385bd8deadSopenharmony_ci
15395bd8deadSopenharmony_ci    If ARB_parallel_shader_compile is supported, the shader specialization
15405bd8deadSopenharmony_ci    may occur on a background thread in the same manner that compiling and
15415bd8deadSopenharmony_ci    linking does.
15425bd8deadSopenharmony_ci
15435bd8deadSopenharmony_ciDependencies on ARB_separate_shader_objects
15445bd8deadSopenharmony_ci
15455bd8deadSopenharmony_ci    If ARB_separate_shader_objects is not supported, ignore all references
15465bd8deadSopenharmony_ci    to separable program objects.
15475bd8deadSopenharmony_ci
15485bd8deadSopenharmony_ciDependencies on ARB_program_interface_query
15495bd8deadSopenharmony_ci
15505bd8deadSopenharmony_ci    If ARB_prorgram_interface_query is not supported, ignore references
15515bd8deadSopenharmony_ci    to commands added by this extension, however other commands defined
15525bd8deadSopenharmony_ci    in terms of these functions still operate as specified before the
15535bd8deadSopenharmony_ci    addition of the program interface query extension.
15545bd8deadSopenharmony_ci
15555bd8deadSopenharmony_ciNew State
15565bd8deadSopenharmony_ci
15575bd8deadSopenharmony_ciAdd the following to Table 23.30 "Shader Object State"
15585bd8deadSopenharmony_ci
15595bd8deadSopenharmony_ciGet Value         Type  Get Command  Initial Value Description           Sec
15605bd8deadSopenharmony_ci----------------- ----- ------------ ------------- --------------------- ---
15615bd8deadSopenharmony_ciSPIR_V_BINARY_ARB  B    GetShaderiv  FALSE         Shader is associated  7.2
15625bd8deadSopenharmony_ci                                                   with a SPIR-V module.
15635bd8deadSopenharmony_ci
15645bd8deadSopenharmony_ciUsage Example
15655bd8deadSopenharmony_ci
15665bd8deadSopenharmony_ci    const uint* pSpirVModule;   // This points to the SPIR-V code in memory
15675bd8deadSopenharmony_ci    uint spirVLength;           // Length of pSpirVModule in bytes.
15685bd8deadSopenharmony_ci
15695bd8deadSopenharmony_ci    // Create the shader object.
15705bd8deadSopenharmony_ci    GLuint shader = glCreateShader(GL_FRAGMENT_SHADER);
15715bd8deadSopenharmony_ci
15725bd8deadSopenharmony_ci    // Load the SPIR-V module into the shader object
15735bd8deadSopenharmony_ci    glShaderBinary(1, &shader,
15745bd8deadSopenharmony_ci                   GL_SHADER_BINARY_FORMAT_SPIR_V_ARB,
15755bd8deadSopenharmony_ci                   pSpirVModule, spirVLength);
15765bd8deadSopenharmony_ci
15775bd8deadSopenharmony_ci    // This will now return FALSE
15785bd8deadSopenharmony_ci    GLint status;
15795bd8deadSopenharmony_ci    glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
15805bd8deadSopenharmony_ci
15815bd8deadSopenharmony_ci    // Specialize the shader
15825bd8deadSopenharmony_ci    const GLuint constantIndices[] = { 0, 7, 3 };
15835bd8deadSopenharmony_ci    const GLuint constantValues[] = { 1, 42, 0x3F800000 };
15845bd8deadSopenharmony_ci    glSpecializeShaderARB(shader,
15855bd8deadSopenharmony_ci                          "main",
15865bd8deadSopenharmony_ci                          3,
15875bd8deadSopenharmony_ci                          constantIndices,
15885bd8deadSopenharmony_ci                          constantValues);
15895bd8deadSopenharmony_ci
15905bd8deadSopenharmony_ci    // This should now return TRUE
15915bd8deadSopenharmony_ci    glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
15925bd8deadSopenharmony_ci
15935bd8deadSopenharmony_ci    // Create a program, attach our shader to it, and link
15945bd8deadSopenharmony_ci    GLuint program = glCreateProgram();
15955bd8deadSopenharmony_ci
15965bd8deadSopenharmony_ci    glAttachShader(program, shader);
15975bd8deadSopenharmony_ci
15985bd8deadSopenharmony_ci    glLinkProgram(program);
15995bd8deadSopenharmony_ci
16005bd8deadSopenharmony_ci
16015bd8deadSopenharmony_ciIssues
16025bd8deadSopenharmony_ci
16035bd8deadSopenharmony_ci1. Do we need separate extensions to expose legacy GLSL and ESSL legacy
16045bd8deadSopenharmony_ci   capabilities in SPIR-V?
16055bd8deadSopenharmony_ci
16065bd8deadSopenharmony_ci    DISCUSSION:
16075bd8deadSopenharmony_ci
16085bd8deadSopenharmony_ci    When GLSL was created, multiple extensions were simultaneously introduced
16095bd8deadSopenharmony_ci    to separate the API mechanism (ARB_shader_objects), the shading language
16105bd8deadSopenharmony_ci    (GL_ARB_shading_language_100) and the shader stages (GL_ARB_vertex_shader,
16115bd8deadSopenharmony_ci    GL_ARB_fragment_shader).
16125bd8deadSopenharmony_ci
16135bd8deadSopenharmony_ci    We can expect that future versions of OpenGL will support SPIR-V
16145bd8deadSopenharmony_ci    as well but with a different set of capabilities.
16155bd8deadSopenharmony_ci
16165bd8deadSopenharmony_ci    Additionally, it's probably enough for the ARB to only define a SPIR-V
16175bd8deadSopenharmony_ci    capabilities for OpenGL 4.5 but SPIR-V is not only going to be consumed by
16185bd8deadSopenharmony_ci    OpenGL implementation but also by engine tool chains which can't afford to
16195bd8deadSopenharmony_ci    only support the last version of OpenGL. As a result Unity would define its
16205bd8deadSopenharmony_ci    own private extensions at least to clearly define the capability sets our
16215bd8deadSopenharmony_ci    engine supports at time T, e.g.: GL_UNITY_spirv_webgl,
16225bd8deadSopenharmony_ci    GL_UNITY_spirv_base_level, GL_UNITY_spirv_base_compute,
16235bd8deadSopenharmony_ci    GL_UNITY_spirv_max_level, etc to target older versions of OpenGL without
16245bd8deadSopenharmony_ci    being forced to use a specific GLSL version.
16255bd8deadSopenharmony_ci
16265bd8deadSopenharmony_ci    For example, GL_UNITY_spirv_base_compute has a feature subset between
16275bd8deadSopenharmony_ci    GLSL 420 + GL_ARB_shader_storage_buffer_object + GL_ARB_compute_shader +
16285bd8deadSopenharmony_ci    GL_ARB_shader_image_load_store and GLES 310 would correspond to what we
16295bd8deadSopenharmony_ci    call an OpenGL device level in Unity 5.1.
16305bd8deadSopenharmony_ci
16315bd8deadSopenharmony_ci    We should except that many engines would have the need of such ISV
16325bd8deadSopenharmony_ci    specific capability sets. This said it's important for the Khronos Group
16335bd8deadSopenharmony_ci    to set future convergence point but OpenGL 4.5 is not realistic today, which
16345bd8deadSopenharmony_ci    is the domain where ISVs must work.
16355bd8deadSopenharmony_ci
16365bd8deadSopenharmony_ci    Possible Resolution:
16375bd8deadSopenharmony_ci       Two extensions:
16385bd8deadSopenharmony_ci        - GL_ARB_program_binary_spirv to specify the mechanism.
16395bd8deadSopenharmony_ci        - GL_ARB_spir_v_gl_450 to specify the required SPIR-V capabilities for
16405bd8deadSopenharmony_ci        OpenGL 4.5.
16415bd8deadSopenharmony_ci
16425bd8deadSopenharmony_ci    Key data needed: What will IHVs actually support?
16435bd8deadSopenharmony_ci
16445bd8deadSopenharmony_ci    RESOLVED:
16455bd8deadSopenharmony_ci
16465bd8deadSopenharmony_ci    Minimum: 3.3 for desktop
16475bd8deadSopenharmony_ci             3.1 for ES [ however, ES is not covered by this extension ]
16485bd8deadSopenharmony_ci
16495bd8deadSopenharmony_ci    Need to add capabilities needed to distinguish between 3.3 and 4.5.
16505bd8deadSopenharmony_ci
16515bd8deadSopenharmony_ci    See bug 14520 for data on fine-grained capabilities and other
16525bd8deadSopenharmony_ci    relevant details.
16535bd8deadSopenharmony_ci
16545bd8deadSopenharmony_ci2. Do we want to look at SPIR-V as a shading language or a binary format?
16555bd8deadSopenharmony_ci
16565bd8deadSopenharmony_ci    DISCUSSION:
16575bd8deadSopenharmony_ci
16585bd8deadSopenharmony_ci    Practically, this issue is about whether we want to load SPIR-V
16595bd8deadSopenharmony_ci    through the shader object API, the program binary API or do we need
16605bd8deadSopenharmony_ci    a new construct. Unfortunately, there is a lot of issues with the
16615bd8deadSopenharmony_ci    two first options and the third might be a little too complex.
16625bd8deadSopenharmony_ci
16635bd8deadSopenharmony_ci    Support through program binary API:
16645bd8deadSopenharmony_ci    - SPIR-V is the standard binary format
16655bd8deadSopenharmony_ci    - It makes SPIR-V a post LinkProgram construct
16665bd8deadSopenharmony_ci    - No location remapping is possible (glBindAttribLocation,
16675bd8deadSopenharmony_ci      glBindFragDataLocation[Indexed])
16685bd8deadSopenharmony_ci    - Can't support multiple OpEntryPoint instructions
16695bd8deadSopenharmony_ci    - Can't provide program arguments (alternative to #pragma)
16705bd8deadSopenharmony_ci    - Can't retrieve SPIR-V source. GL_NUM_PROGRAM_BINARY_FORMATS can
16715bd8deadSopenharmony_ci    enumerate multiple format but glGetProgramBinary doesn't allow us to
16725bd8deadSopenharmony_ci    select the format we want to query back.
16735bd8deadSopenharmony_ci    - Currently SPIR-V doesn't support multiple shader stages per module
16745bd8deadSopenharmony_ci    but this would be useful for linked programs.
16755bd8deadSopenharmony_ci
16765bd8deadSopenharmony_ci    Support through shader object API:
16775bd8deadSopenharmony_ci    - OpenGL API allows to attach multiple shader objects but SPIR-V modules
16785bd8deadSopenharmony_ci    are fully contained: A single module define the entire stage.
16795bd8deadSopenharmony_ci    - SPIR-V modules don't have to support multiple stage per module but we
16805bd8deadSopenharmony_ci    lose the represent linked program and perform offline cross shader stage
16815bd8deadSopenharmony_ci    dead code elimination.
16825bd8deadSopenharmony_ci    - Need a new glCompileShader variant to support multiple entry-points
16835bd8deadSopenharmony_ci    (OpEntryPoint) or compilation arguments (OpCompileFlag)
16845bd8deadSopenharmony_ci    - glShaderSource doesn't allow to specify the shading language. Is looking
16855bd8deadSopenharmony_ci    at the first bytes to check the magic string okay?
16865bd8deadSopenharmony_ci    - Reflection may be striped from SPIR-V modules
16875bd8deadSopenharmony_ci
16885bd8deadSopenharmony_ci    Support through new API, "modules":
16895bd8deadSopenharmony_ci    // The difference between a module and a shader:
16905bd8deadSopenharmony_ci    // - Can contain multiple entry points
16915bd8deadSopenharmony_ci    // - Could specify the language, support both GLSL and SPIR-V (maybe)
16925bd8deadSopenharmony_ci    // - Can contain multiple shader stages
16935bd8deadSopenharmony_ci    // - Cross shader stage dead code elimination could be perform offline. (How to hint the compiler? OpCompileFlag?)
16945bd8deadSopenharmony_ci    // - Could be faster to compile shader variants?
16955bd8deadSopenharmony_ci    // - Programs created with glLinkProgramModule don't need GL_PROGRAM_SEPARABLE
16965bd8deadSopenharmony_ci    // - No need to specify the shader stage at object creation, it's embedded in the SPIR-V module
16975bd8deadSopenharmony_ci
16985bd8deadSopenharmony_ci    GLint length = 0;
16995bd8deadSopenharmony_ci    GLbyte* binary = LoadBinary(Path, &length);
17005bd8deadSopenharmony_ci
17015bd8deadSopenharmony_ci    GLuint ModuleName = 0;
17025bd8deadSopenharmony_ci    glCreateModules(1, &ModuleName);
17035bd8deadSopenharmony_ci    glCompileModule(ModuleName, GL_SHADING_LANGUAGE_SPIR_V, &binary, &length);
17045bd8deadSopenharmony_ci
17055bd8deadSopenharmony_ci    GLboolean HasReflection = GL_FALSE;
17065bd8deadSopenharmony_ci    glGetModuleiv(ModuleName, GL_MODULE_REFLECTION, &HasReflection);
17075bd8deadSopenharmony_ci
17085bd8deadSopenharmony_ci    GLuint ProgramName[2];
17095bd8deadSopenharmony_ci    glCreatePrograms(2, &ProgramName[0]);
17105bd8deadSopenharmony_ci
17115bd8deadSopenharmony_ci    assert(HasReflection == GL_TRUE);
17125bd8deadSopenharmony_ci    GLchar const * Strings[] = {"gl_Position", "block.Color"};
17135bd8deadSopenharmony_ci    glTransformFeedbackVaryings(ProgramName[0], 2, Strings, GL_INTERLEAVED_ATTRIBS);
17145bd8deadSopenharmony_ci    glBindAttribLocation(ProgramName[0], 0, "Position");
17155bd8deadSopenharmony_ci    glBindAttribLocation(ProgramName[0], 1, "Color");
17165bd8deadSopenharmony_ci    glBindFragDataLocation(ProgramName[0], 0, "Color");
17175bd8deadSopenharmony_ci    glLinkProgramModule(ProgramName[0], ModuleName, "mainA", "-pragma optimize(on)");
17185bd8deadSopenharmony_ci
17195bd8deadSopenharmony_ci    glLinkProgramModule(ProgramName[1], ModuleName, "mainB", "-pragma optimize(on)");
17205bd8deadSopenharmony_ci
17215bd8deadSopenharmony_ci    Other notes:
17225bd8deadSopenharmony_ci
17235bd8deadSopenharmony_ci     - API doesn't require GLSL -> SPIR-V followed by getProgramBinary()
17245bd8deadSopenharmony_ci       * need an ID for specifying you want a SPIR-V binary?
17255bd8deadSopenharmony_ci        (christophe) GetProgramBinary doesn't do conversion, currently we would retrieve a SPIR-V
17265bd8deadSopenharmony_ci        is the program binary was a SPIR-V binary. However, that would prevent query a of native
17275bd8deadSopenharmony_ci        binary cache. I guess we could add a program parameter or specific that if we use
17285bd8deadSopenharmony_ci        GL_PROGRAM_BINARY_RETRIEVABLE_HINT GetProgramBinary return a native program binary cache,
17295bd8deadSopenharmony_ci        otherwise we get a SPIR-V binary back.
17305bd8deadSopenharmony_ci
17315bd8deadSopenharmony_ci     - LoadProgramBinary() needs a flag to link by SSO or by name?
17325bd8deadSopenharmony_ci        * or does API spec. just say this comes from using SSO mode or...?
17335bd8deadSopenharmony_ci        (christophe) GL_PROGRAM_SEPARABLE doesn't change linking by name or by location.
17345bd8deadSopenharmony_ci        In GLSL 450, when locations are present, we link by location. Otherwise, we link by name.
17355bd8deadSopenharmony_ci        GL_PROGRAM_SEPARABLE protects the shader code against a backward compatibility change regarding
17365bd8deadSopenharmony_ci        gl_PerVertex block. With separated shader stages, the block must be declared in the shader will
17375bd8deadSopenharmony_ci        before it was optional. This behavior was requested by AMD during the separated program
17385bd8deadSopenharmony_ci        ratification process.
17395bd8deadSopenharmony_ci
17405bd8deadSopenharmony_ci    Neither the program binary API or the shader object API
17415bd8deadSopenharmony_ci    seem to match SPIR-V features. Creating a new module API has potential but maybe
17425bd8deadSopenharmony_ci    we could build something around the shader object.
17435bd8deadSopenharmony_ci
17445bd8deadSopenharmony_ci    RESOLVED: Use the existing ShaderBinary() and a new entry point,
17455bd8deadSopenharmony_ci    SpecializeShaderARB() to set specialization constants.
17465bd8deadSopenharmony_ci
17475bd8deadSopenharmony_ci3. Allow more than one stage per SPIR-V module?
17485bd8deadSopenharmony_ci
17495bd8deadSopenharmony_ci    DISCUSSION:
17505bd8deadSopenharmony_ci
17515bd8deadSopenharmony_ci    SPIR-V supports multiple entry points per module, of any stage, or any
17525bd8deadSopenharmony_ci    number of instances of the same stage.  However, the knowledge of which
17535bd8deadSopenharmony_ci    of those might be used together lies outside the module.
17545bd8deadSopenharmony_ci
17555bd8deadSopenharmony_ci    OpenGL supports both linked programs and separated programs. If we
17565bd8deadSopenharmony_ci    consider strict separated programs with a program per shader stage, we can
17575bd8deadSopenharmony_ci    rely on a SPIR-V module per program. However, linked programs allows
17585bd8deadSopenharmony_ci    combining multiple shader stages into a single program. Furthermore,
17595bd8deadSopenharmony_ci    linked programs are more efficient than separated programs as the
17605bd8deadSopenharmony_ci    implementation can perform cross shader stages optimizations and packing of
17615bd8deadSopenharmony_ci    inputs and outputs with linked programs.
17625bd8deadSopenharmony_ci
17635bd8deadSopenharmony_ci    Allowing multiple shader stage in a module would profile a semantic for
17645bd8deadSopenharmony_ci    linked programs and would allow performing dead code elimination and input
17655bd8deadSopenharmony_ci    and output location packing offline.
17665bd8deadSopenharmony_ci
17675bd8deadSopenharmony_ci    RESOLVED: Allow full generality of what SPIR-V supports, and have
17685bd8deadSopenharmony_ci    the new entry points in the API select the subset of a module that it
17695bd8deadSopenharmony_ci    cares about.
17705bd8deadSopenharmony_ci
17715bd8deadSopenharmony_ci4. Do we want to expose multiple entry points?
17725bd8deadSopenharmony_ci
17735bd8deadSopenharmony_ci    DISCUSSION:
17745bd8deadSopenharmony_ci
17755bd8deadSopenharmony_ci    SPIR-V supports multiple entry points through the OpEntryPoint
17765bd8deadSopenharmony_ci    instruction. Do we want to expose this?
17775bd8deadSopenharmony_ci
17785bd8deadSopenharmony_ci    A way to expose it would be to introduce a variant of glLinkProgram
17795bd8deadSopenharmony_ci    which takes the entry point main as an argument.
17805bd8deadSopenharmony_ci
17815bd8deadSopenharmony_ci    Typically, engines such as UE4 and Unity are rebuilding a big shared shader
17825bd8deadSopenharmony_ci    library over and over again for each shader variation.
17835bd8deadSopenharmony_ci
17845bd8deadSopenharmony_ci    While orthogonal to GL_ARB_program_instance, this feature would work
17855bd8deadSopenharmony_ci    extremely well with program instance for an application.
17865bd8deadSopenharmony_ci
17875bd8deadSopenharmony_ci    We could defer but I'll rather have all the SPIR-V interactions
17885bd8deadSopenharmony_ci    mechanisms defined in one extension from start to provide first class
17895bd8deadSopenharmony_ci    citizenship to SPIR-V.
17905bd8deadSopenharmony_ci
17915bd8deadSopenharmony_ci    RESOLVED: This is mostly a duplicate of Issue 3, and a single resolution
17925bd8deadSopenharmony_ci    for both is needed there in that one place.
17935bd8deadSopenharmony_ci
17945bd8deadSopenharmony_ci5. Do we want to add support for "constantId" in OpenGL?
17955bd8deadSopenharmony_ci
17965bd8deadSopenharmony_ci    RESOLVED: Have the new entry points in the API support specializing
17975bd8deadSopenharmony_ci    constants, as in Vulkan.
17985bd8deadSopenharmony_ci
17995bd8deadSopenharmony_ci6. Do we want to support multiple modules per program
18005bd8deadSopenharmony_ci
18015bd8deadSopenharmony_ci    DISCUSSION:
18025bd8deadSopenharmony_ci
18035bd8deadSopenharmony_ci    A use case could be to compile subroutines into different modules
18045bd8deadSopenharmony_ci    and link a set of subroutines we want to use into a program canvas.
18055bd8deadSopenharmony_ci    In another use case, using multiple entry points we could build multiple
18065bd8deadSopenharmony_ci    code paths sharing the same shader library.
18075bd8deadSopenharmony_ci
18085bd8deadSopenharmony_ci    SPIR-V for Vulkan currently expects fully linked stages.
18095bd8deadSopenharmony_ci
18105bd8deadSopenharmony_ci    This could be part of a much needed rework or the subroutines.
18115bd8deadSopenharmony_ci    Okay to defer for now.
18125bd8deadSopenharmony_ci
18135bd8deadSopenharmony_ci    RESOLVED: Fully linked modules only, no direct "subroutine" support.
18145bd8deadSopenharmony_ci
18155bd8deadSopenharmony_ci7. Do we want to be able to provide compilation arguments?
18165bd8deadSopenharmony_ci
18175bd8deadSopenharmony_ci    DISCUSSION:
18185bd8deadSopenharmony_ci
18195bd8deadSopenharmony_ci    SPIR-V supports the OpCompileFlag instructions to store
18205bd8deadSopenharmony_ci    compilation arguments however OpenGL doesn't support compilation
18215bd8deadSopenharmony_ci    arguments. If we add a new variant of glLinkProgram, it could be an
18225bd8deadSopenharmony_ci    opportunity to add a compilation arguments parameter to glLinkProgram.
18235bd8deadSopenharmony_ci
18245bd8deadSopenharmony_ci    Some use cases:
18255bd8deadSopenharmony_ci    - Compiling the shaders with different optimizations: It's currently
18265bd8deadSopenharmony_ci    supported with #pragma but SPIR-V doesn't contain preprocessor
18275bd8deadSopenharmony_ci    information
18285bd8deadSopenharmony_ci    - Vendors refused to fix GLSL bugs and there are a lot of them. The
18295bd8deadSopenharmony_ci    reason is that fixing these bugs could cause to break shader compilation
18305bd8deadSopenharmony_ci    hence applications. If we want to start a virtue circle, we need to
18315bd8deadSopenharmony_ci    give developers the opportunity to enforce conformant compilation.
18325bd8deadSopenharmony_ci    - Display on or off warnings in the compilation log.
18335bd8deadSopenharmony_ci    - All the cool stuff C++ compilers are using compilation arguments for.
18345bd8deadSopenharmony_ci
18355bd8deadSopenharmony_ci    Note that the instruction OpCompileFlag was removed from SPIR-V, and
18365bd8deadSopenharmony_ci    a Bug 13418 "Need a way to control target-compiler behavior from the API"
18375bd8deadSopenharmony_ci    was deferred to a future release.
18385bd8deadSopenharmony_ci
18395bd8deadSopenharmony_ci    RESOLVED: No flags in first release.
18405bd8deadSopenharmony_ci
18415bd8deadSopenharmony_ci8. Do we want to build a reflection API on SPIR-V modules specifics?
18425bd8deadSopenharmony_ci
18435bd8deadSopenharmony_ci    - Retrieve compilation arguments
18445bd8deadSopenharmony_ci    - Retrieve shader stages included
18455bd8deadSopenharmony_ci    - Retrieve the list of entry points
18465bd8deadSopenharmony_ci    - Retrieve the list of required capabilities
18475bd8deadSopenharmony_ci
18485bd8deadSopenharmony_ci    Arguably, it's trivial to build a SPIR-V parser and figure this out
18495bd8deadSopenharmony_ci    ourselves.
18505bd8deadSopenharmony_ci
18515bd8deadSopenharmony_ci    DISCUSSION:
18525bd8deadSopenharmony_ci
18535bd8deadSopenharmony_ci    If drivers implement SPIR-V support by lowering it to the same
18545bd8deadSopenharmony_ci    representation that GLSL is lowered to, and that representation is the
18555bd8deadSopenharmony_ci    source of reflection information, much reflection would naturally be
18565bd8deadSopenharmony_ci    present.
18575bd8deadSopenharmony_ci
18585bd8deadSopenharmony_ci    RESOLVED: First start without reflection, then add later if needed.
18595bd8deadSopenharmony_ci    In the meantime, we have to document how the existing API operates
18605bd8deadSopenharmony_ci    with no reflection information. See Issue 22.
18615bd8deadSopenharmony_ci
18625bd8deadSopenharmony_ci9. Separate programs require gl_PerVertex output blocks to be declared.
18635bd8deadSopenharmony_ci   How do we enforce this requirement in SPIR-V modules?
18645bd8deadSopenharmony_ci
18655bd8deadSopenharmony_ci    DISCUSSION: Force compiler to generate a gl_PerVertex block if the
18665bd8deadSopenharmony_ci    shader code writes vertex-shader output built-ins?
18675bd8deadSopenharmony_ci
18685bd8deadSopenharmony_ci    RESOLVED: (In the validation rules): SPIR-V should contain the
18695bd8deadSopenharmony_ci    same form of input/output block as expected by recent versions of GLSL.
18705bd8deadSopenharmony_ci    All in/out built-in show up in SPIR-V in blocks, as per Vulkan rules.
18715bd8deadSopenharmony_ci    GLSL can stay the same, front ends need to block non-blocked built-ins.
18725bd8deadSopenharmony_ci
18735bd8deadSopenharmony_ci10. Do we want to support glBindAttribLocation and glBindFragDataLocation[Indexed]
18745bd8deadSopenharmony_ci    with SPIR-V?  Also, what about glTransformFeedbackVaryings?
18755bd8deadSopenharmony_ci
18765bd8deadSopenharmony_ci    DISCUSSION: Locations can be explicitly put into the shader, and
18775bd8deadSopenharmony_ci    then the application uses the right location.
18785bd8deadSopenharmony_ci
18795bd8deadSopenharmony_ci    Note that SPIR-V 1.0 does not allow using specialization constants for
18805bd8deadSopenharmony_ci
18815bd8deadSopenharmony_ci        layout(location=X) ...  // X must be a literal, not specialized
18825bd8deadSopenharmony_ci
18835bd8deadSopenharmony_ci    Alternatively, add a SPIR-V instruction that assigns a string name to an
18845bd8deadSopenharmony_ci    input which the API can use to link with.  This would initially be an
18855bd8deadSopenharmony_ci    extension to SPIR-V as part of this.
18865bd8deadSopenharmony_ci
18875bd8deadSopenharmony_ci    RESOLVED: Don't support any of glBindAttribLocation,
18885bd8deadSopenharmony_ci    glBindFragDataLocation[Index], or glTransformFeedbackVaryings.
18895bd8deadSopenharmony_ci
18905bd8deadSopenharmony_ci11. What capabilities do we need for GL 4.5?
18915bd8deadSopenharmony_ci
18925bd8deadSopenharmony_ci    RESOLVED: There is a Appendix A.spv for this.
18935bd8deadSopenharmony_ci
18945bd8deadSopenharmony_ci12. How is user-linkage done between stages?
18955bd8deadSopenharmony_ci
18965bd8deadSopenharmony_ci    DISCUSSION: SPIR-V linkage is by location number and BuiltIn decoration.
18975bd8deadSopenharmony_ci    Does OpenGL need linkage by name? Is SSO required to work with SPIR-V?
18985bd8deadSopenharmony_ci    Require OpName can't be stripped out for linkage objects.  If we use the
18995bd8deadSopenharmony_ci    program binary API, yes but this is not desirable. See issue 2.
19005bd8deadSopenharmony_ci
19015bd8deadSopenharmony_ci    RESOLVED: Link the Vulkan way: built-in decorations, location numbers,
19025bd8deadSopenharmony_ci    etc., never by name.  No reflection required.  This is a lot like SSO.
19035bd8deadSopenharmony_ci
19045bd8deadSopenharmony_ci13. Can we really handle separate textures and samplers?
19055bd8deadSopenharmony_ci
19065bd8deadSopenharmony_ci    DISCUSSION: AMD: No, can't do this because OpenGL has features that need
19075bd8deadSopenharmony_ci    cross validation that can't be done.
19085bd8deadSopenharmony_ci
19095bd8deadSopenharmony_ci    RESOLVED: Remove separate textures and samplers.
19105bd8deadSopenharmony_ci
19115bd8deadSopenharmony_ci14. Are there differences in binding counting between Vulkan and OpenGL?
19125bd8deadSopenharmony_ci
19135bd8deadSopenharmony_ci    DISCUSSION: Yes, OpenGL uses multiple binding points for a resource array
19145bd8deadSopenharmony_ci    while Vulkan uses just one.
19155bd8deadSopenharmony_ci
19165bd8deadSopenharmony_ci    RESOLVED: This leaves OpenGL as is, but state in the overview what this
19175bd8deadSopenharmony_ci    difference is.
19185bd8deadSopenharmony_ci
19195bd8deadSopenharmony_ci15. What GL version(s) should be required for the ImageQuery OpCapability?
19205bd8deadSopenharmony_ci
19215bd8deadSopenharmony_ci    DISCUSSION: The GL features it corresponds with are:
19225bd8deadSopenharmony_ci        - textureSize - EXT_gpu_shader4 (GL 3.0)
19235bd8deadSopenharmony_ci        - textureQueryLod - ARB_texture_query_lod (GL 4.0)
19245bd8deadSopenharmony_ci        - textureQueryLevels - ARB_texture_query_levels (GL 4.3)
19255bd8deadSopenharmony_ci        - imageSize - ARB_shader_image_size (GL 4.3)
19265bd8deadSopenharmony_ci        - textureSamples, imageSamples - ARB_shader_texture_image_samples (GL 4.5)
19275bd8deadSopenharmony_ci    The belief is that these are largely software features and while some
19285bd8deadSopenharmony_ci    of them were not added until later API versions, it was not because of
19295bd8deadSopenharmony_ci    hardware reasons.
19305bd8deadSopenharmony_ci
19315bd8deadSopenharmony_ci    RESOLVED: Require ImageQuery to be supported for all versions of GL,
19325bd8deadSopenharmony_ci    as it is required for all Vulkan implementations.
19335bd8deadSopenharmony_ci
19345bd8deadSopenharmony_ci16. At what point should an error due to an invalid SPIR-V module/capability
19355bd8deadSopenharmony_ci    be reported? ShaderBinary, SpecializeShaderARB, LinkProgram time?
19365bd8deadSopenharmony_ci    ShaderBinary says a "valid SPIR-V module binary" is required, but you
19375bd8deadSopenharmony_ci    can have a valid module that uses capabilities or extensions not
19385bd8deadSopenharmony_ci    supported by an implementation.
19395bd8deadSopenharmony_ci
19405bd8deadSopenharmony_ci    RESOLVED. ShaderBinary is expected to form an association between the
19415bd8deadSopenharmony_ci    SPIR-V module and likely would not parse the module as would be required
19425bd8deadSopenharmony_ci    to detect unsupported capabilities or other validation failures. In order
19435bd8deadSopenharmony_ci    to avoid requiring the implementation to parse the module multiples times,
19445bd8deadSopenharmony_ci    we allow this analysis to happen at either SpecializeShaderARB or
19455bd8deadSopenharmony_ci    LinkProgram time, similar to how many errors for source shaders are
19465bd8deadSopenharmony_ci    detected at either compile or link time.
19475bd8deadSopenharmony_ci
19485bd8deadSopenharmony_ci17. Should we allow program objects to contain both source shaders and
19495bd8deadSopenharmony_ci    SPIR-V binary shaders, or should this be a link time failure?
19505bd8deadSopenharmony_ci
19515bd8deadSopenharmony_ci    RESOLVED. No. This would be needlessly complex to specify. Make this
19525bd8deadSopenharmony_ci    a link-time error. This can be determined by examining the
19535bd8deadSopenharmony_ci    SPIR_V_BINARY_ARB state of each shader. They must either: all be TRUE
19545bd8deadSopenharmony_ci    (SPIR-V shader) or all be FALSE (source shaders). If an application
19555bd8deadSopenharmony_ci    really wishes to mix source and SPIR-V binary shaders, this can be
19565bd8deadSopenharmony_ci    done at program object boundaries by using separable program objects
19575bd8deadSopenharmony_ci    (if supported).
19585bd8deadSopenharmony_ci
19595bd8deadSopenharmony_ci18. Do we need a section for "SPIR-V Transform Feedback Interface"?
19605bd8deadSopenharmony_ci    This would discuss any requirements for the Xfb related decorations
19615bd8deadSopenharmony_ci    in SPIR-V.
19625bd8deadSopenharmony_ci
19635bd8deadSopenharmony_ci    RESOLVED. Yes.
19645bd8deadSopenharmony_ci
19655bd8deadSopenharmony_ci19. How should the program interface query operations behave for program
19665bd8deadSopenharmony_ci    objects created from SPIR-V shaders?
19675bd8deadSopenharmony_ci
19685bd8deadSopenharmony_ci    DISCUSSION: we previously said we didn't need reflection to work
19695bd8deadSopenharmony_ci    for SPIR-V shaders (at least for the first version), however we
19705bd8deadSopenharmony_ci    are left with specifying how it should "not work". The primary issue
19715bd8deadSopenharmony_ci    is that SPIR-V binaries are not required to have names associated
19725bd8deadSopenharmony_ci    with variables. They can be associated in debug information, but there
19735bd8deadSopenharmony_ci    is no requirement for that to be present, and it should not be relied
19745bd8deadSopenharmony_ci    upon.
19755bd8deadSopenharmony_ci
19765bd8deadSopenharmony_ci    Options:
19775bd8deadSopenharmony_ci    A) Make it work.  If debug names are present they are enumerated
19785bd8deadSopenharmony_ci    correctly with associated variables. If the names aren't present,
19795bd8deadSopenharmony_ci    the compiler or driver gets to make them up. Alternatively, we could
19805bd8deadSopenharmony_ci    augment SPIR-V to have a mode where all interface variables need to
19815bd8deadSopenharmony_ci    have names which must not be stripped.
19825bd8deadSopenharmony_ci
19835bd8deadSopenharmony_ci    B) Completely disallow it. All/Most such operations return an error.
19845bd8deadSopenharmony_ci    This may result in some implementation-dependent behavior which
19855bd8deadSopenharmony_ci    is impossible to know (although this problem may exist anyhow due
19865bd8deadSopenharmony_ci    to the offline-compilation step).  This would likely include not
19875bd8deadSopenharmony_ci    being able to tell how many active resources there are and related
19885bd8deadSopenharmony_ci    problems.
19895bd8deadSopenharmony_ci
19905bd8deadSopenharmony_ci    C) Allow as much as possible to work "naturally". You can query for
19915bd8deadSopenharmony_ci    the number of active resources, and for details about them. Anything
19925bd8deadSopenharmony_ci    that doesn't query by name will work as expected. Queries for maximum
19935bd8deadSopenharmony_ci    length of names return one. Queries for anything "by name" return
19945bd8deadSopenharmony_ci    INVALID_INDEX (or -1). Querying the name property of a resource
19955bd8deadSopenharmony_ci    returns an empty string. This may allow many queries to work, but it's
19965bd8deadSopenharmony_ci    not clear how useful it would be if you can't actually know which
19975bd8deadSopenharmony_ci    specific variable you are retrieving information on. If everything
19985bd8deadSopenharmony_ci    is specified a-priori by location/binding/offset/index/component
19995bd8deadSopenharmony_ci    in the shader, this may be sufficient.
20005bd8deadSopenharmony_ci
20015bd8deadSopenharmony_ci    RESOLVED.  Pick (c), but also allow debug names to be returned if an
20025bd8deadSopenharmony_ci    implementation wants to.
20035bd8deadSopenharmony_ci
20045bd8deadSopenharmony_ci20. How should we deal with implementation-dependent behavior that
20055bd8deadSopenharmony_ci    must normally be queried after linking? Examples include:
20065bd8deadSopenharmony_ci     - set of active resources
20075bd8deadSopenharmony_ci     - offsets and strides of GLSLShared and GLSLPacked UBO/SSBOs
20085bd8deadSopenharmony_ci     - MATRIX_STRIDE, UNIFORM_ARRAY_STRIDE for UBOs (only relevant for
20095bd8deadSopenharmony_ci       packed/shared?)
20105bd8deadSopenharmony_ci     - UNIFORM_ARRAY_STRIDE for arrays of atomic counter buffers.
20115bd8deadSopenharmony_ci
20125bd8deadSopenharmony_ci    DISCUSSION:
20135bd8deadSopenharmony_ci    - Option (c) from issue 19 allows determination of active resources (by
20145bd8deadSopenharmony_ci      shader specified layouts, but not name).
20155bd8deadSopenharmony_ci    - GLSLShared and GLSLPacked should not be allowed in this
20165bd8deadSopenharmony_ci      extension as there is no way to sensibly support, short of Option (a)
20175bd8deadSopenharmony_ci      from Issue 19.
20185bd8deadSopenharmony_ci    - For arrays of atomic counters, Option (c) from Issue 19 may be enough
20195bd8deadSopenharmony_ci      to figure this out, but I'm not sure that will work for offline
20205bd8deadSopenharmony_ci      compilation. Do we need to define a standard "layout" (stride) for
20215bd8deadSopenharmony_ci      arrays of atomic counters?
20225bd8deadSopenharmony_ci
20235bd8deadSopenharmony_ci    RESOLVED:
20245bd8deadSopenharmony_ci    Picked (c) in issue 19, allowing determination of the number and types
20255bd8deadSopenharmony_ci    of active resources.
20265bd8deadSopenharmony_ci    Remove the shared and packed layouts and have the same behavior as in
20275bd8deadSopenharmony_ci    Vulkan.
20285bd8deadSopenharmony_ci    Atomic counter buffers don't have an associated name string already so
20295bd8deadSopenharmony_ci    there should be no issue with figuring out the UNIFORM_ARRAY_STRIDE for
20305bd8deadSopenharmony_ci    them.
20315bd8deadSopenharmony_ci
20325bd8deadSopenharmony_ci21. What do we need to say about various linking rules related to "named
20335bd8deadSopenharmony_ci    uniform blocks" and "named shader storage blocks"?
20345bd8deadSopenharmony_ci
20355bd8deadSopenharmony_ci    RESOLVED. We don't need to say anything, as they won't have
20365bd8deadSopenharmony_ci    names in SPIR-V shaders, so they aren't really "named". Instead of
20375bd8deadSopenharmony_ci    being identified by name they are identified (and matched) by
20385bd8deadSopenharmony_ci    uniform block index and/or binding.
20395bd8deadSopenharmony_ci
20405bd8deadSopenharmony_ci22. How do the program interface query APIs work when no name reflection
20415bd8deadSopenharmony_ci    information is available?
20425bd8deadSopenharmony_ci
20435bd8deadSopenharmony_ci    RESOLVED: The following naturally follows from the specification:
20445bd8deadSopenharmony_ci
20455bd8deadSopenharmony_ci    GetProgramInterfaceiv(.., pname=MAX_NAME_LENGTH, ..) -> params = 1
20465bd8deadSopenharmony_ci    GetProgramResourceIndex(.., name) -> INVALID_INDEX
20475bd8deadSopenharmony_ci    GetProgramResourceName(.., length, name) -> length=0, name = ""
20485bd8deadSopenharmony_ci    GetProgramResourceiv(.., props=NAME_LENGTH, ..) -> params = 1
20495bd8deadSopenharmony_ci    GetProgramResourceLocation(.., name) -> -1
20505bd8deadSopenharmony_ci    GetProgramResourceLocationIndex(.., name) -> -1
20515bd8deadSopenharmony_ci    GetUniformLocation(.., name) -> -1
20525bd8deadSopenharmony_ci    GetActiveUniformName(.., length, uniformName) -> length=0, uniformName = ""
20535bd8deadSopenharmony_ci    GetUniformIndices(..,uniformNames, uniformIndices) -> uniformIndices=INVALID_INDEX
20545bd8deadSopenharmony_ci    GetActiveUniform(..,length,.., name) -> length = 0, name = ""
20555bd8deadSopenharmony_ci    GetActiveUniformsiv(..,pname=UNIFORM_NAME_LENGTH,..) -> params = 1
20565bd8deadSopenharmony_ci    GetUniformBlockIndex(.., uniformBlockName) -> INVALID_INDEX
20575bd8deadSopenharmony_ci    GetActiveUniformBlockName(..,length,uniformBlockName) -> length=0, uniformBlockName=""
20585bd8deadSopenharmony_ci    GetActiveUniformBlockiv(.., pname=UNIFORM_BLOCK_NAME_LENGTH, ..) -> params = 1
20595bd8deadSopenharmony_ci    GetActiveAttrib(..) -> length = 0, name = ""
20605bd8deadSopenharmony_ci    GetAttribLocation(.., name) -> -1
20615bd8deadSopenharmony_ci    GetTransformFeedbackVarying(..) -> length = 0, name = ""
20625bd8deadSopenharmony_ci    GetFragDatatLocation(.., name) -> -1
20635bd8deadSopenharmony_ci    GetFragDataIndex(.., name) -> -1
20645bd8deadSopenharmony_ci    GetProgramiv(.., pname=ACTIVE_ATTRIBUTE_MAX_LENGTH, ..) -> params = 1
20655bd8deadSopenharmony_ci    GetProgramiv(.., pname=ACTIVE_UNIFORM_MAX_LENGTH, ..) -> params = 1
20665bd8deadSopenharmony_ci    GetProgramiv(.., pname=TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH, ..) -> params = 1
20675bd8deadSopenharmony_ci    GetProgramiv(.., pname=ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, ..) -> params = 1
20685bd8deadSopenharmony_ci
20695bd8deadSopenharmony_ci23. How does setting uniforms work if we can't query for locations based on
20705bd8deadSopenharmony_ci    names?
20715bd8deadSopenharmony_ci
20725bd8deadSopenharmony_ci    RESOLVED. The shaders need to specify explicit locations for all uniform
20735bd8deadSopenharmony_ci    variables. The application can use offline reflection (or a reflection
20745bd8deadSopenharmony_ci    library) to know which variables are at which location, and then
20755bd8deadSopenharmony_ci    use that to specify the values of uniforms by location, as normal
20765bd8deadSopenharmony_ci    (e.g. Uniform*, ProgramUniform*).
20775bd8deadSopenharmony_ci
20785bd8deadSopenharmony_ci24. What about UniformBlockBinding and ShaderStorageBlockBinding?
20795bd8deadSopenharmony_ci
20805bd8deadSopenharmony_ci    RESOLVED. Because it is not possible to obtain the uniform block index
20815bd8deadSopenharmony_ci    or storage block index from an unnamed block, the binding value remains
20825bd8deadSopenharmony_ci    as specified in the shader by the layout qualifier or decoration.
20835bd8deadSopenharmony_ci    If you are feeling lucky you could just guess and remap used index values
20845bd8deadSopenharmony_ci    [0, #active blocks), but you won't really know what is going
20855bd8deadSopenharmony_ci    where, so just treat it as an immutable binding, similar to the atomic
20865bd8deadSopenharmony_ci    counter buffer binding point. Really.
20875bd8deadSopenharmony_ci
20885bd8deadSopenharmony_ci25. What about subroutine queries based on names?
20895bd8deadSopenharmony_ci
20905bd8deadSopenharmony_ci    RESOLVED. SPIR-V does not currently support subroutines, so it is not
20915bd8deadSopenharmony_ci    possibly to have any active subroutines from a SPIR-V based shader,
20925bd8deadSopenharmony_ci    and thus there is never anything to report.
20935bd8deadSopenharmony_ci
20945bd8deadSopenharmony_ci26. How do we change the location of samplers and images?
20955bd8deadSopenharmony_ci
20965bd8deadSopenharmony_ci    RESOLVED. You don't. Well you can using Uniform1i as usual, but you have
20975bd8deadSopenharmony_ci    no way of knowing which location corresponds to which sampler or image
20985bd8deadSopenharmony_ci    variable as GetUniformLocation won't work without a named variable. Best
20995bd8deadSopenharmony_ci    to just treat them as immutable bindings which are specified in the
21005bd8deadSopenharmony_ci    shader source or binary.
21015bd8deadSopenharmony_ci
21025bd8deadSopenharmony_ci27. Appendix A.spv.3 gives a list of required capabilities that correspond
21035bd8deadSopenharmony_ci    to the core GL 4.5 features as well as for *some* of the ARB extensions
21045bd8deadSopenharmony_ci    that require shading language support. What about the rest of the
21055bd8deadSopenharmony_ci    ARB and vendor extensions that require shading language support?
21065bd8deadSopenharmony_ci
21075bd8deadSopenharmony_ci    RESOLVED: Extensions that can be represented in terms of core
21085bd8deadSopenharmony_ci    SPIR-V 1.0 functionality don't need any specific consideration.
21095bd8deadSopenharmony_ci    Other ARB or vendor extensions that require SPIR-V functionality that
21105bd8deadSopenharmony_ci    can't be expressed in terms of SPIR-V 1.0 functionality will need to
21115bd8deadSopenharmony_ci    have SPIR-V extensions defined to add the required functionality.
21125bd8deadSopenharmony_ci    Further GL extensions can be defined to advertise support for
21135bd8deadSopenharmony_ci    consuming such SPIR-V capabilities once they have been defined.
21145bd8deadSopenharmony_ci
21155bd8deadSopenharmony_ci    A (partial) list of extensions that are expected to need some form
21165bd8deadSopenharmony_ci    of modification to SPIR-V follows.
21175bd8deadSopenharmony_ci
21185bd8deadSopenharmony_ci        ARB_shader_viewport_layer_array
21195bd8deadSopenharmony_ci            - need to allow ViewportIndex and Layer to be output by VS
21205bd8deadSopenharmony_ci              and TES.
21215bd8deadSopenharmony_ci        ARB_shader_clock
21225bd8deadSopenharmony_ci            - need clock() builtin function
21235bd8deadSopenharmony_ci        ARB_shader_ballot
21245bd8deadSopenharmony_ci            - use subgroup capability and add other builtins
21255bd8deadSopenharmony_ci        ARB_shader_atomic_counter_ops
21265bd8deadSopenharmony_ci            - need atomic counter builtin functions
21275bd8deadSopenharmony_ci        ARB_post_depth_coverage
21285bd8deadSopenharmony_ci            - need post_depth_coverage layout
21295bd8deadSopenharmony_ci        ARB_fragment_shader_interlock
21305bd8deadSopenharmony_ci            - need new layouts and interlock builtin functions
21315bd8deadSopenharmony_ci        KHR_blend_equation_advanced
21325bd8deadSopenharmony_ci            - need new layouts
21335bd8deadSopenharmony_ci        ARB_shader_group_vote
21345bd8deadSopenharmony_ci            - need new builtin functions
21355bd8deadSopenharmony_ci        ARB_shader_draw_parameters
21365bd8deadSopenharmony_ci            - need new builtin variables
21375bd8deadSopenharmony_ci        ARB_bindless_texture
21385bd8deadSopenharmony_ci            - need new layout qualifiers and probably other semantics
21395bd8deadSopenharmony_ci        ARB_compute_variable_group_size
21405bd8deadSopenharmony_ci            - need new layout qualifiers and builtin variables
21415bd8deadSopenharmony_ci
21425bd8deadSopenharmony_ci28. Should a SPIR-V binary linked through this extension work with
21435bd8deadSopenharmony_ci    ARB_get_program_binary? Do we need to define what would happen
21445bd8deadSopenharmony_ci    with specialization constants?
21455bd8deadSopenharmony_ci
21465bd8deadSopenharmony_ci    RESOLVED. Yes it should work seamlessly, and no, it shouldn't be
21475bd8deadSopenharmony_ci    required to add more details on how to store specialization
21485bd8deadSopenharmony_ci    constants. It is expected that GetProgramBinary should operate
21495bd8deadSopenharmony_ci    irrespective of how the program was created.
21505bd8deadSopenharmony_ci
21515bd8deadSopenharmony_ci    (from GL 4.6 spec section 7.5, Program Binaries):
21525bd8deadSopenharmony_ci
21535bd8deadSopenharmony_ci        GetProgramBinary returns a binary representation of the
21545bd8deadSopenharmony_ci        program object's compiled and linked executable source,
21555bd8deadSopenharmony_ci        henceforth referred to as its program binary.
21565bd8deadSopenharmony_ci
21575bd8deadSopenharmony_ci    There are two ways you can end up with a linked executable.
21585bd8deadSopenharmony_ci
21595bd8deadSopenharmony_ci    GLSL sources:
21605bd8deadSopenharmony_ci        ShaderSource() -> CompileShader() -> AttachShader() -> LinkProgram()
21615bd8deadSopenharmony_ci    SPIR-V binaries:
21625bd8deadSopenharmony_ci        ShaderBinary() -> SpecializeShader() -> AttachShader() -> LinkProgram()
21635bd8deadSopenharmony_ci
21645bd8deadSopenharmony_ci    Exactly what is stored in a program binary is not defined by the
21655bd8deadSopenharmony_ci    GL spec.
21665bd8deadSopenharmony_ci
21675bd8deadSopenharmony_ci    If the driver is storing the final compiled machine assembly for
21685bd8deadSopenharmony_ci    the program in the program binary, it clearly shouldn't matter
21695bd8deadSopenharmony_ci    which path it takes to get to the LinkProgram step.
21705bd8deadSopenharmony_ci
21715bd8deadSopenharmony_ci    If instead the driver is storing some higher level representation
21725bd8deadSopenharmony_ci    of the shaders (say the original sources, or some IR) then it's up
21735bd8deadSopenharmony_ci    to the implementation to store whatever it needs to reconstitute
21745bd8deadSopenharmony_ci    the linked binary. If the given implementation happened to choose
21755bd8deadSopenharmony_ci    to store the SPIR-V code then it would also need to store any
21765bd8deadSopenharmony_ci    relevant specialization information with it as well.
21775bd8deadSopenharmony_ci
21785bd8deadSopenharmony_ci
21795bd8deadSopenharmony_ciRevision History
21805bd8deadSopenharmony_ci
21815bd8deadSopenharmony_ci    Rev.    Date         Author         Changes
21825bd8deadSopenharmony_ci    ----  -----------    ------------   ---------------------------------
21835bd8deadSopenharmony_ci    46    19-Aug-2020    dgkoch         Atomic pointers must be 32-bit or
21845bd8deadSopenharmony_ci                                        64-bit scalar integers (SPIR-V/254,
21855bd8deadSopenharmony_ci                                        internal API issue 132)
21865bd8deadSopenharmony_ci    45    17-Sep-2019    Jon Leech      Add OpTypeBool constraint on user
21875bd8deadSopenharmony_ci                                        interface variables, and require the
21885bd8deadSopenharmony_ci                                        StorageImageWriteWithoutFormat
21895bd8deadSopenharmony_ci                                        capability for OpImageWrite to
21905bd8deadSopenharmony_ci                                        Unknown formats in the Validation
21915bd8deadSopenharmony_ci                                        Rules section (internal API issues
21925bd8deadSopenharmony_ci                                        111 and 112, respectively).
21935bd8deadSopenharmony_ci    44    15-Feb-2019    apinheiro      Added issue 28, about interaction with
21945bd8deadSopenharmony_ci                                        ARB_get_program_binary (internal API issue 100)
21955bd8deadSopenharmony_ci    43    15-Feb-2019    apinheiro      Add uniform initializers reference and
21965bd8deadSopenharmony_ci                                        mapping (internal API issue 99)
21975bd8deadSopenharmony_ci    42    9-Jan-2019     JohnK          Explicitly give rules for SPIR-V
21985bd8deadSopenharmony_ci                                        uniform offsets (internal API issue
21995bd8deadSopenharmony_ci                                        92)
22005bd8deadSopenharmony_ci    41    10-Dec-2018    Jon Leech      Use 'workgroup' consistently
22015bd8deadSopenharmony_ci                                        throughout (Bug 11723, internal API
22025bd8deadSopenharmony_ci                                        issue 87).
22035bd8deadSopenharmony_ci    40    29-May-2018    dgkoch         note post decrement for atomicCounterDecrement
22045bd8deadSopenharmony_ci                                        mapping
22055bd8deadSopenharmony_ci    39    25-Apr-2018    JohnK          add mappings of barriers and atomics
22065bd8deadSopenharmony_ci    38    10-Apr-2018    dgkoch         OpImageQuerySizeLod and OpImageQuerylevels
22075bd8deadSopenharmony_ci                                        only work with Sampled images
22085bd8deadSopenharmony_ci                                        (SPIR-V/issues/280).
22095bd8deadSopenharmony_ci    37    20-Feb-2018    dgkoch         Add whitelist for accepted storage
22105bd8deadSopenharmony_ci                                        classes (SPIR-V/issues/166).
22115bd8deadSopenharmony_ci                                        Require Binding for uniform and storage
22125bd8deadSopenharmony_ci                                        buffer blocks (opengl/api/issues/55).
22135bd8deadSopenharmony_ci    36    15-Nov-2017    dgkoch         clarify error for glSpecializeShader
22145bd8deadSopenharmony_ci                                        and add new error if shader types
22155bd8deadSopenharmony_ci                                        mismatch (OpenGL-API/issues/16)
22165bd8deadSopenharmony_ci    35    25-Oct-2017    JohnK          remove the already deprecated noise
22175bd8deadSopenharmony_ci                                        functions
22185bd8deadSopenharmony_ci    34    29-May-2017    dgkoch         Fix typos. RuntimeArrays are only
22195bd8deadSopenharmony_ci                                        supported on SSBOs.
22205bd8deadSopenharmony_ci    33    26-May-2017    JohnK          Require in/out explicit locations
22215bd8deadSopenharmony_ci    32    25-Apr-2017    JohnK          Bring up-to-date:
22225bd8deadSopenharmony_ci                                          Out-of-order block offsets
22235bd8deadSopenharmony_ci                                          gl_NumSamples not supported
22245bd8deadSopenharmony_ci                                          atomic counter restrictions
22255bd8deadSopenharmony_ci                                          bug fixes
22265bd8deadSopenharmony_ci    31    21-Jul-2016    dgkoch         Clarify string length on queries
22275bd8deadSopenharmony_ci    30    13-Jul-2016    JohnK          SPIR-V Offset can also apply to an
22285bd8deadSopenharmony_ci                                        atomic_uint offset.
22295bd8deadSopenharmony_ci    29    04-Jul-2015    dgkoch         Allow handles of the same shader types
22305bd8deadSopenharmony_ci                                        for ShaderBinary when using SPIRV.
22315bd8deadSopenharmony_ci    28    09-Jun-2016    dgkoch         Move future extensions to Issue 27.
22325bd8deadSopenharmony_ci    27    08-Jun-2016    dgkoch         Assign enums, add a couple missing
22335bd8deadSopenharmony_ci                                        errors. Editorial fixes.
22345bd8deadSopenharmony_ci                                        Specify required version and format
22355bd8deadSopenharmony_ci                                        of SPIRV. Add Issue 27.
22365bd8deadSopenharmony_ci    26    02-Jun-2016    JohnK          Completion of draft. Pack/unpack, TBD,
22375bd8deadSopenharmony_ci                                        and resolutions.
22385bd8deadSopenharmony_ci    25    02-Jun-2016    JohnK          Include XFB linking/interface rules
22395bd8deadSopenharmony_ci    24    02-Jun-2016    JohnK          Remove use of GLSL shared/packed
22405bd8deadSopenharmony_ci                                        and SPIR-V GLSLShared/GLSLPacked,
22415bd8deadSopenharmony_ci                                        bringing in KHR_vulkan_glsl rules for
22425bd8deadSopenharmony_ci                                        std140 and std430
22435bd8deadSopenharmony_ci    23    01-Jun-2016    dgkoch         Finish API edits. Cleanup editing
22445bd8deadSopenharmony_ci                                        pass on formatting and issue resolutions.
22455bd8deadSopenharmony_ci                                        Add issues 22-26 and resolve the rest.
22465bd8deadSopenharmony_ci    22    26-May-2016    dgkoch         Add ARB suffix to SpecializeShader
22475bd8deadSopenharmony_ci                                        Add SPIR_V_BINARY_ARB shader state
22485bd8deadSopenharmony_ci                                        (and some but not all related rules)
22495bd8deadSopenharmony_ci                                        Add a bunch of API edits alluding to
22505bd8deadSopenharmony_ci                                        SPIR-V shaders. Lots of comments about
22515bd8deadSopenharmony_ci                                        outstanding API areas that still need
22525bd8deadSopenharmony_ci                                        to be addressed.
22535bd8deadSopenharmony_ci                                        Add unresolved issues 16-21.
22545bd8deadSopenharmony_ci    21    25-May-2016    JohnK          Add interface matching rules
22555bd8deadSopenharmony_ci    20    19-May-2016    dgkoch         Remove language about 'default entry point'
22565bd8deadSopenharmony_ci                                        Recast features in terms of GL version.
22575bd8deadSopenharmony_ci    19    19-May-2016    dgkoch         Add min GLSL version required for
22585bd8deadSopenharmony_ci                                        built-in variable decorations and
22595bd8deadSopenharmony_ci                                        OpCapabilities. Fix various dates.
22605bd8deadSopenharmony_ci    18    13-May-2016    JohnK          Bring in the actual correct subset of
22615bd8deadSopenharmony_ci                                        GL_KHR_vulkan_glsl, rather than refer
22625bd8deadSopenharmony_ci                                        to it with differences
22635bd8deadSopenharmony_ci    17    12-May-2016    dgkoch         Verify capabilities for GLSL 4.50
22645bd8deadSopenharmony_ci                                        Add capabilities for non-core ARB
22655bd8deadSopenharmony_ci                                        extensions, and extensions that
22665bd8deadSopenharmony_ci                                        already have SPIR-V correspondence.
22675bd8deadSopenharmony_ci    16    12-May-2016    dgkoch         grammatical fixes, replace non-ascii
22685bd8deadSopenharmony_ci                                        chars, formatting
22695bd8deadSopenharmony_ci    15    11-May-2016    JohnK          Clear up misc. TBDs throughout
22705bd8deadSopenharmony_ci    14    11-May-2016    JohnK          Flesh out GL_KHR_vulkan_glsl changes
22715bd8deadSopenharmony_ci    13    11-May-2016    JohnK          Move to final organization to flesh out
22725bd8deadSopenharmony_ci    12    10-May-2016    JohnK          Add the Vulkan validation rules that
22735bd8deadSopenharmony_ci                                        apply and the TBD from the f2f
22745bd8deadSopenharmony_ci    11    21-Apr-2016    JohnK          Editorial update to API description
22755bd8deadSopenharmony_ci    10    11-Feb-2016    gsellers       Add prototype API language.
22765bd8deadSopenharmony_ci     9    31-Jan-2016    JohnK          Issues 13 & 14
22775bd8deadSopenharmony_ci     8    04-Dec-2015    JohnK          Resolve issue 10
22785bd8deadSopenharmony_ci     7    05-Nov-2015    JohnK          Remove gl_FragColor, update issue 10
22795bd8deadSopenharmony_ci     6    22-Oct-2015    JohnK          Resolutions from Houston
22805bd8deadSopenharmony_ci     5    21-Oct-2015    JohnK          Make into a consistent format
22815bd8deadSopenharmony_ci     4    16-Oct-2015    JohnK          Added dependencies with GL_KHR_vulkan_glsl
22825bd8deadSopenharmony_ci     3    08-Oct-2015    JohnK          Added exec. env. detail, updated issues
22835bd8deadSopenharmony_ci     2    22-Apr-2015    Christophe     Added issues
22845bd8deadSopenharmony_ci     1    26-Mar-2015    JohnK          Initial revision
2285