15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    EXT_shader_framebuffer_fetch
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_EXT_shader_framebuffer_fetch
85bd8deadSopenharmony_ci    GL_EXT_shader_framebuffer_fetch_non_coherent
95bd8deadSopenharmony_ci
105bd8deadSopenharmony_ciContact
115bd8deadSopenharmony_ci
125bd8deadSopenharmony_ci    Benj Lipchak, Apple (lipchak 'at' apple.com)
135bd8deadSopenharmony_ci
145bd8deadSopenharmony_ciContributors
155bd8deadSopenharmony_ci
165bd8deadSopenharmony_ci    Francisco Jerez, Intel
175bd8deadSopenharmony_ci
185bd8deadSopenharmony_ciStatus
195bd8deadSopenharmony_ci
205bd8deadSopenharmony_ci    Complete
215bd8deadSopenharmony_ci
225bd8deadSopenharmony_ciVersion
235bd8deadSopenharmony_ci
245bd8deadSopenharmony_ci    Last Modified Date: September 6, 2018
255bd8deadSopenharmony_ci    Author Revision: 8
265bd8deadSopenharmony_ci
275bd8deadSopenharmony_ciNumber
285bd8deadSopenharmony_ci
295bd8deadSopenharmony_ci    OpenGL ES Extension #122
305bd8deadSopenharmony_ci    OpenGL Extension #520
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ciDependencies
335bd8deadSopenharmony_ci
345bd8deadSopenharmony_ci    OpenGL 2.0 or OpenGL ES 2.0 is required.
355bd8deadSopenharmony_ci    
365bd8deadSopenharmony_ci    This specification is written against the OpenGL ES 2.0.24 and OpenGL ES
375bd8deadSopenharmony_ci    3.0.4 specifications.  This extension is written against the OpenGL ES
385bd8deadSopenharmony_ci    Shading Language 1.0.17 and OpenGL ES Shading Language 3.00.3
395bd8deadSopenharmony_ci    specifications.
405bd8deadSopenharmony_ci    
415bd8deadSopenharmony_ci    OpenGL 2.0, OpenGL 3.0, OpenGL 4.0, OpenGL 4.5, OpenGL ES 2.0, OpenGL ES
425bd8deadSopenharmony_ci    3.0, OpenGL ES 3.1 and OpenGL ES 3.2 affect the definition of this
435bd8deadSopenharmony_ci    extension.
445bd8deadSopenharmony_ci
455bd8deadSopenharmony_ci    ARB_sample_shading and OES_sample_shading interact with this extension.
465bd8deadSopenharmony_ci
475bd8deadSopenharmony_ciOverview
485bd8deadSopenharmony_ci
495bd8deadSopenharmony_ci    Conventional OpenGL blending provides a configurable series of operations
505bd8deadSopenharmony_ci    that can be used to combine the output values from a fragment shader with
515bd8deadSopenharmony_ci    the values already in the framebuffer. While these operations are
525bd8deadSopenharmony_ci    suitable for basic image compositing, other compositing operations or
535bd8deadSopenharmony_ci    operations that treat fragment output as something other than a color
545bd8deadSopenharmony_ci    (normals, for instance) may not be expressible without multiple passes or
555bd8deadSopenharmony_ci    render-to-texture operations.
565bd8deadSopenharmony_ci
575bd8deadSopenharmony_ci    This extension provides a mechanism whereby a fragment shader may read
585bd8deadSopenharmony_ci    existing framebuffer data as input. This can be used to implement
595bd8deadSopenharmony_ci    compositing operations that would have been inconvenient or impossible with
605bd8deadSopenharmony_ci    fixed-function blending. It can also be used to apply a function to the
615bd8deadSopenharmony_ci    framebuffer color, by writing a shader which uses the existing framebuffer
625bd8deadSopenharmony_ci    color as its only input.
635bd8deadSopenharmony_ci
645bd8deadSopenharmony_ci    This extension provides two alternative name strings:
655bd8deadSopenharmony_ci
665bd8deadSopenharmony_ci     - GL_EXT_shader_framebuffer_fetch guarantees full coherency between
675bd8deadSopenharmony_ci       framebuffer reads and writes.  If this extension string is exposed, the
685bd8deadSopenharmony_ci       result of reading from the framebuffer from a fragment shader invocation
695bd8deadSopenharmony_ci       is guaranteed to reflect values written by any previous overlapping
705bd8deadSopenharmony_ci       samples in API primitive order, unless requested otherwise in the shader
715bd8deadSopenharmony_ci       source using the noncoherent layout qualifier.
725bd8deadSopenharmony_ci
735bd8deadSopenharmony_ci     - GL_EXT_shader_framebuffer_fetch_non_coherent provides limited implicit
745bd8deadSopenharmony_ci       coherency guarantees.  Instead, the application is expected to call the
755bd8deadSopenharmony_ci       FramebufferFetchBarrierEXT command for previous framebuffer writes to
765bd8deadSopenharmony_ci       become visible to subsequent fragment shader invocations.  For this
775bd8deadSopenharmony_ci       extension to give well-defined results applications may have to split
785bd8deadSopenharmony_ci       rendering into multiple passes separated with FramebufferFetchBarrierEXT
795bd8deadSopenharmony_ci       calls.  The functionality provided by this extension is requested in the
805bd8deadSopenharmony_ci       shader source using the noncoherent layout qualifier.
815bd8deadSopenharmony_ci
825bd8deadSopenharmony_ciIssues
835bd8deadSopenharmony_ci
845bd8deadSopenharmony_ci    1. How is framebuffer data treated during multisample rendering?
855bd8deadSopenharmony_ci    
865bd8deadSopenharmony_ci    RESOLVED: Reading the value of gl_LastFragData produces a different
875bd8deadSopenharmony_ci    result for each sample. This implies that all or part of the shader be
885bd8deadSopenharmony_ci    run once for each sample, but has no additional implications on fragment
895bd8deadSopenharmony_ci    shader input variables which may still be interpolated per pixel by the
905bd8deadSopenharmony_ci    implementation.
915bd8deadSopenharmony_ci    
925bd8deadSopenharmony_ci    2. How does the use of gl_LastFragData interact with fragment discard?
935bd8deadSopenharmony_ci    
945bd8deadSopenharmony_ci    RESOLVED: Hardware may not necessarily support discarding on sample
955bd8deadSopenharmony_ci    granularity depending on API version and extension support. Therefore,
965bd8deadSopenharmony_ci    three options were considered for this functionality:
975bd8deadSopenharmony_ci    
985bd8deadSopenharmony_ci        A) Allow discard based on variables calculated using the framebuffer
995bd8deadSopenharmony_ci           color when multisample rasterization is disabled, but disallow
1005bd8deadSopenharmony_ci           discard in this manner when multisample rasterization is enabled.
1015bd8deadSopenharmony_ci        
1025bd8deadSopenharmony_ci        B) Restrict usage of the framebuffer color until it is known whether
1035bd8deadSopenharmony_ci           or not the pixel will be discarded.
1045bd8deadSopenharmony_ci            
1055bd8deadSopenharmony_ci        C) Allow undefined results for fragment shaders that discard on a
1065bd8deadSopenharmony_ci           per-sample basis on hardware that doesn't support it.
1075bd8deadSopenharmony_ci    
1085bd8deadSopenharmony_ci    This extension has chosen option C where support for per-sample discard
1095bd8deadSopenharmony_ci    is not provided by the GL.  Restricting orthogonality of fragment shaders
1105bd8deadSopenharmony_ci    between single-sample and multisample rendering is undesirable, as is
1115bd8deadSopenharmony_ci    restricting usage of the framebuffer color, which can generally only be
1125bd8deadSopenharmony_ci    done with detailed flow-control analysis.
1135bd8deadSopenharmony_ci
1145bd8deadSopenharmony_ci    If an overlapping specification guarantees well-defined results for
1155bd8deadSopenharmony_ci    shaders that execute discard with sample granularity (e.g.
1165bd8deadSopenharmony_ci    ARB_sample_shading), this extension won't reverse that guarantee, instead
1175bd8deadSopenharmony_ci    the boolean query FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT defined by this
1185bd8deadSopenharmony_ci    extension will return TRUE for consistency with current specifications.
1195bd8deadSopenharmony_ci
1205bd8deadSopenharmony_ci    3. What is the precision of gl_LastFragData in practice?
1215bd8deadSopenharmony_ci    
1225bd8deadSopenharmony_ci    RESOLVED: Three options were considered for this functionality:
1235bd8deadSopenharmony_ci    
1245bd8deadSopenharmony_ci        A) gl_LastFragData is always mediump.
1255bd8deadSopenharmony_ci        
1265bd8deadSopenharmony_ci        B) gl_LastFragData takes the precision most closely matching the
1275bd8deadSopenharmony_ci           actual storage format of the framebuffer.
1285bd8deadSopenharmony_ci        
1295bd8deadSopenharmony_ci        C) Allow redeclaration of gl_LastFragData in order to change its
1305bd8deadSopenharmony_ci           precision.
1315bd8deadSopenharmony_ci    
1325bd8deadSopenharmony_ci    This extension has chosen option C. A fixed precision per option A
1335bd8deadSopenharmony_ci    increases the likelihood of redundant conversion operations in the shader,
1345bd8deadSopenharmony_ci    and option B does not provide for clear behavior with regard to the
1355bd8deadSopenharmony_ci    precision of intermediate results from calculations using the
1365bd8deadSopenharmony_ci    framebuffer color.
1375bd8deadSopenharmony_ci
1385bd8deadSopenharmony_ci    4. How does this extension iteract with conventional blending?
1395bd8deadSopenharmony_ci    
1405bd8deadSopenharmony_ci    RESOLVED: There is no interaction.  The two remain orthogonal.  The rest
1415bd8deadSopenharmony_ci    of the pipeline continues as usual after the fragment shader stage.
1425bd8deadSopenharmony_ci    
1435bd8deadSopenharmony_ci
1445bd8deadSopenharmony_ci    5. How does this extension work in ES 3.0?
1455bd8deadSopenharmony_ci
1465bd8deadSopenharmony_ci    RESOLVED: Differently than in ES 2.0.
1475bd8deadSopenharmony_ci
1485bd8deadSopenharmony_ci    The built-in fragment outputs of ES 2.0 are replaced in #version 300 es
1495bd8deadSopenharmony_ci    shaders by user-declared outputs, to accomodate integer and MRT 
1505bd8deadSopenharmony_ci    framebuffers.  Three options were considered:
1515bd8deadSopenharmony_ci
1525bd8deadSopenharmony_ci        A) Add built-ins similar to gl_LastFragData.
1535bd8deadSopenharmony_ci        
1545bd8deadSopenharmony_ci        B) Add a layout to mark user-declared fragment outputs as having
1555bd8deadSopenharmony_ci        defined content on entry to fragment shader.
1565bd8deadSopenharmony_ci            
1575bd8deadSopenharmony_ci        C) Allow marking user-declared fragment outputs as "inout".
1585bd8deadSopenharmony_ci
1595bd8deadSopenharmony_ci    This extension has chosen option C.  Adding built-ins per option A is
1605bd8deadSopenharmony_ci    unwieldy for MRT framebuffers with mixed attachment types and precisions.  
1615bd8deadSopenharmony_ci    Options B and C are semantically identical, but C requires fewer 
1625bd8deadSopenharmony_ci    modifications to the specification and to user shaders.  Note that the 
1635bd8deadSopenharmony_ci    inout qualifier is not allowed for re-declaring existing fragment outputs 
1645bd8deadSopenharmony_ci    such as gl_FragDepth.
1655bd8deadSopenharmony_ci
1665bd8deadSopenharmony_ci    6. How does this extension interact with sRGB rendering?
1675bd8deadSopenharmony_ci
1685bd8deadSopenharmony_ci    RESOLVED: If the current GL state would cause the corresponding destination
1695bd8deadSopenharmony_ci    color to be converted from sRGB to linear at input to blending,
1705bd8deadSopenharmony_ci    gl_LastFragData or fragment outputs with the inout storage qualifier will
1715bd8deadSopenharmony_ci    contain framebuffer values converted from sRGB to linear upon entry to the
1725bd8deadSopenharmony_ci    fragment shader.
1735bd8deadSopenharmony_ci
1745bd8deadSopenharmony_ci    7. How does this extension interact with derivative built-in functions?
1755bd8deadSopenharmony_ci
1765bd8deadSopenharmony_ci    RESOLVED: There is no direct interaction in principle, but because the
1775bd8deadSopenharmony_ci    result of framebuffer fetch is undefined for helper invocations, derivative
1785bd8deadSopenharmony_ci    functions may give non-deterministic results when the argument is dependent
1795bd8deadSopenharmony_ci    on values read from the framebuffer.
1805bd8deadSopenharmony_ci
1815bd8deadSopenharmony_ci    To overcome this limitation the application may be able to calculate the
1825bd8deadSopenharmony_ci    derivative of gl_HelperInvocation in order to determine whether any of the
1835bd8deadSopenharmony_ci    invocations involved in the calculation are helper invocations, which
1845bd8deadSopenharmony_ci    would invalidate the result of the same derivative applied to any
1855bd8deadSopenharmony_ci    expression dependent on values read from the framebuffer.  In particular,
1865bd8deadSopenharmony_ci    if either dFdx(float(gl_HelperInvocation)) or
1875bd8deadSopenharmony_ci    dFdy(float(gl_HelperInvocation)) is zero, the corresponding derivative of
1885bd8deadSopenharmony_ci    a value read from the framebuffer should be well-defined.
1895bd8deadSopenharmony_ci
1905bd8deadSopenharmony_ci    8. Should we require the behavior of framebuffer fetch to be well-defined
1915bd8deadSopenharmony_ci       for helper invocations in order to support calculating derivatives of
1925bd8deadSopenharmony_ci       color outputs without restrictions?
1935bd8deadSopenharmony_ci
1945bd8deadSopenharmony_ci    RESOLVED: Not in this extension.  It would be compelling from the
1955bd8deadSopenharmony_ci    perspective of the API, and likely more consistent with the current
1965bd8deadSopenharmony_ci    behavior of texture sampling and image loads for helper invocations, but
1975bd8deadSopenharmony_ci    hardware support may be limited.  With the non-coherent variant of this
1985bd8deadSopenharmony_ci    extension there is the additional difficulty that derivatives could still
1995bd8deadSopenharmony_ci    give non-deterministic results, because there is no way for the application
2005bd8deadSopenharmony_ci    to determine whether there will be overlap between helper invocations and
2015bd8deadSopenharmony_ci    previous rendering done in the same pass, since the set of helper
2025bd8deadSopenharmony_ci    invocations executed during rendering is fully defined by the
2035bd8deadSopenharmony_ci    implementation.
2045bd8deadSopenharmony_ci
2055bd8deadSopenharmony_ci    9. How should the implementation behave where framebuffer fetch coherency
2065bd8deadSopenharmony_ci       cannot be enabled selectively for each fragment output due to hardware
2075bd8deadSopenharmony_ci       or software limitations?
2085bd8deadSopenharmony_ci
2095bd8deadSopenharmony_ci    RESOLVED: Because the behavior specified for coherent framebuffer fetch
2105bd8deadSopenharmony_ci    outputs is a strict subset of the behavior of non-coherent outputs, the
2115bd8deadSopenharmony_ci    implementation is free to ignore any noncoherent layout qualifiers and
2125bd8deadSopenharmony_ci    enable coherency globally when the fragment shader bound to the pipeline
2135bd8deadSopenharmony_ci    has any color outputs requiring framebuffer fetch coherency.
2145bd8deadSopenharmony_ci
2155bd8deadSopenharmony_ci    10. Should the current coherent memory qualifier be reused to indicate
2165bd8deadSopenharmony_ci        whether the application requires framebuffer fetch coherency for a given
2175bd8deadSopenharmony_ci        fragment output?
2185bd8deadSopenharmony_ci
2195bd8deadSopenharmony_ci    RESOLVED: No, because that would imply breaking GLSL source-level
2205bd8deadSopenharmony_ci    compatibility with earlier versions of the EXT_shader_framebuffer_fetch
2215bd8deadSopenharmony_ci    extension.  That said, it may make sense to reconsider this syntactic
2225bd8deadSopenharmony_ci    compromise if this extension is used as starting point for another
2235bd8deadSopenharmony_ci    specification text (e.g. a derived ARB/KHR extension).
2245bd8deadSopenharmony_ci
2255bd8deadSopenharmony_ciNew Procedures and Functions
2265bd8deadSopenharmony_ci
2275bd8deadSopenharmony_ci    [[ The following applies if EXT_shader_framebuffer_fetch_non_coherent is
2285bd8deadSopenharmony_ci       supported. ]]
2295bd8deadSopenharmony_ci
2305bd8deadSopenharmony_ci    void FramebufferFetchBarrierEXT(void);
2315bd8deadSopenharmony_ci    
2325bd8deadSopenharmony_ciNew Tokens
2335bd8deadSopenharmony_ci
2345bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv,
2355bd8deadSopenharmony_ci    and GetDoublev:
2365bd8deadSopenharmony_ci    
2375bd8deadSopenharmony_ci        FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT            0x8A52
2385bd8deadSopenharmony_ci
2395bd8deadSopenharmony_ciNew Builtin Variables
2405bd8deadSopenharmony_ci
2415bd8deadSopenharmony_ci    [[ The following applies to OpenGL Shading Language 1.1 and 1.2 only. ]]
2425bd8deadSopenharmony_ci
2435bd8deadSopenharmony_ci    vec4 gl_LastFragData[gl_MaxDrawBuffers];
2445bd8deadSopenharmony_ci
2455bd8deadSopenharmony_ci    [[ The following applies to OpenGL ES Shading Language 1.0 only. ]]
2465bd8deadSopenharmony_ci
2475bd8deadSopenharmony_ci    mediump vec4 gl_LastFragData[gl_MaxDrawBuffers]
2485bd8deadSopenharmony_ci    
2495bd8deadSopenharmony_ciChanges to the OpenGL ES 2.0.24 Specification, Chapter 3
2505bd8deadSopenharmony_ci
2515bd8deadSopenharmony_ci    Remove the last sentence of Paragraph 2 of Section 3.8.1, page 84 ("These
2525bd8deadSopenharmony_ci    built-in varying variables include [...]" and add:
2535bd8deadSopenharmony_ci    
2545bd8deadSopenharmony_ci    These built-in varying variables include the fragment's position, eye z
2555bd8deadSopenharmony_ci    coordinate, and front-facing flag, as well as the last data or color value
2565bd8deadSopenharmony_ci    written to the framebuffer. When the value of SAMPLE_BUFFERS is 1 and the 
2575bd8deadSopenharmony_ci    current framebuffer color is accessed in the fragment shader, the fragment
2585bd8deadSopenharmony_ci    shader will be invoked separately for each covered sample and a separate 
2595bd8deadSopenharmony_ci    value for the previous framebuffer color will be provided for each sample."
2605bd8deadSopenharmony_ci    
2615bd8deadSopenharmony_ci    [[ The following applies if EXT_shader_framebuffer_fetch_non_coherent is
2625bd8deadSopenharmony_ci       supported. ]]
2635bd8deadSopenharmony_ci
2645bd8deadSopenharmony_ci    Append new paragraph at the end of section 3.8.2, page 197 ("Shader
2655bd8deadSopenharmony_ci    Execution"):
2665bd8deadSopenharmony_ci
2675bd8deadSopenharmony_ci    "The command
2685bd8deadSopenharmony_ci
2695bd8deadSopenharmony_ci        void FramebufferFetchBarrierEXT(void);
2705bd8deadSopenharmony_ci
2715bd8deadSopenharmony_ci    specifies a boundary between passes when reading existing framebuffer data
2725bd8deadSopenharmony_ci    from fragment shaders via the gl_LastFragData built-in variable.  Previous
2735bd8deadSopenharmony_ci    framebuffer object writes regardless of the mechanism (including clears,
2745bd8deadSopenharmony_ci    blits and primitive rendering) are guaranteed to be visible to subsequent
2755bd8deadSopenharmony_ci    fragment shader invocations that read from the framebuffer once
2765bd8deadSopenharmony_ci    FramebufferFetchBarrierEXT is executed."
2775bd8deadSopenharmony_ci
2785bd8deadSopenharmony_ci    [[ The following applies if both EXT_shader_framebuffer_fetch and
2795bd8deadSopenharmony_ci       EXT_shader_framebuffer_fetch_non_coherent are supported. ]]
2805bd8deadSopenharmony_ci
2815bd8deadSopenharmony_ci    "Because the implementation guarantees coherency of framebuffer reads and
2825bd8deadSopenharmony_ci    writes for color outputs not explicitly marked with the noncoherent layout
2835bd8deadSopenharmony_ci    qualifier, calling the FramebufferFetchBarrierEXT command is not required
2845bd8deadSopenharmony_ci    unless the application wishes to manage memory ordering of framebuffer
2855bd8deadSopenharmony_ci    reads and writes explicitly, which may provide better performance on some
2865bd8deadSopenharmony_ci    implementations in cases where rendering can be split into multiple passes
2875bd8deadSopenharmony_ci    with non-self-overlapping geometry."
2885bd8deadSopenharmony_ci
2895bd8deadSopenharmony_ci    [[ The following applies to either variant of the extension unless
2905bd8deadSopenharmony_ci       specified otherwise in the interactions sections. ]]
2915bd8deadSopenharmony_ci
2925bd8deadSopenharmony_ci    Add a new subsection to section 3.8.2, page 87 ("Shader Execution"):
2935bd8deadSopenharmony_ci    
2945bd8deadSopenharmony_ci    "Discard
2955bd8deadSopenharmony_ci    
2965bd8deadSopenharmony_ci    Fragment shaders may conditionally abandon operations using the discard
2975bd8deadSopenharmony_ci    keyword. However, the ability of hardware to support abandoning operations
2985bd8deadSopenharmony_ci    on a single sample when the shader is invoked once for each covered sample
2995bd8deadSopenharmony_ci    is implementation-dependent. This capability can be determined by calling
3005bd8deadSopenharmony_ci    GetBooleanv with the symbolic constant 
3015bd8deadSopenharmony_ci    FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT. If FALSE is returned, results from
3025bd8deadSopenharmony_ci    shaders which discard based on per-sample logic are undefined."
3035bd8deadSopenharmony_ci
3045bd8deadSopenharmony_ciChanges to the OpenGL ES 2.0.24 Specification, Chapter 4
3055bd8deadSopenharmony_ci
3065bd8deadSopenharmony_ci    Replace first element of Figure 4.1, page 90 ("Fragment + Associated Data"):
3075bd8deadSopenharmony_ci    
3085bd8deadSopenharmony_ci        "Fragment (or sample) + Associated Data"
3095bd8deadSopenharmony_ci
3105bd8deadSopenharmony_ci    Add a new section 4.1.lastfragcolor (Fragment Data Input) - immediately before section 4.1.4 (Stencil Test):
3115bd8deadSopenharmony_ci
3125bd8deadSopenharmony_ci        Prior to fragment shading, if GL_EXT_shader_framebuffer_fetch is enabled,
3135bd8deadSopenharmony_ci        gl_LastFragData[] is populated with the value last written to the
3145bd8deadSopenharmony_ci        framebuffer at the same (x,y,sample) position.
3155bd8deadSopenharmony_ci        
3165bd8deadSopenharmony_ci        If the framebuffer attachment corresponding to a given element of
3175bd8deadSopenharmony_ci        gl_LastFragData[] has a fixed-point format, each color component undergoes a
3185bd8deadSopenharmony_ci        conversion to floating-point first. This conversion must leave the values 0
3195bd8deadSopenharmony_ci        and 1 invariant.
3205bd8deadSopenharmony_ci
3215bd8deadSopenharmony_ci        [[If GL_EXT_sRGB is supported]]
3225bd8deadSopenharmony_ci
3235bd8deadSopenharmony_ci        If the value of FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING{_EXT} for the
3245bd8deadSopenharmony_ci        framebuffer attachment corresponding to a given element of gl_LastFragData[]
3255bd8deadSopenharmony_ci        is SRGB,
3265bd8deadSopenharmony_ci
3275bd8deadSopenharmony_ci        [[If GL_EXT_sRGB_write_control is supported]]
3285bd8deadSopenharmony_ci
3295bd8deadSopenharmony_ci
3305bd8deadSopenharmony_ci        and FRAMEBUFFER_SRGB_EXT is enabled,
3315bd8deadSopenharmony_ci
3325bd8deadSopenharmony_ci
3335bd8deadSopenharmony_ci        [[End GL_EXT_sRGB_write_control]]
3345bd8deadSopenharmony_ci
3355bd8deadSopenharmony_ci
3365bd8deadSopenharmony_ci        the R, G, and B destination color values
3375bd8deadSopenharmony_ci        (after conversion from fixedpoint to floating-point) are considered to be
3385bd8deadSopenharmony_ci        encoded for the sRGB color space and hence must be linearized first.
3395bd8deadSopenharmony_ci        Each R, G, and B component is converted in the same fashion described for
3405bd8deadSopenharmony_ci        sRGB texture components in section 3.8.16.
3415bd8deadSopenharmony_ci
3425bd8deadSopenharmony_ci        [[End GL_EXT_sRGB]]
3435bd8deadSopenharmony_ci
3445bd8deadSopenharmony_ciNew Implementation Dependent State
3455bd8deadSopenharmony_ci
3465bd8deadSopenharmony_ci    Add to table 6.19 (Implementation Dependent Values (cont.)):
3475bd8deadSopenharmony_ci
3485bd8deadSopenharmony_ci    Get Value                             Type  Get Command  Minimum Value  Description        Section
3495bd8deadSopenharmony_ci    ---------                             ----  -----------  -------------  --------------     -------
3505bd8deadSopenharmony_ci    FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT  B     GetBooleanv  -              Samples may be     3.8.2
3515bd8deadSopenharmony_ci                                                                            discarded 
3525bd8deadSopenharmony_ci                                                                            individually 
3535bd8deadSopenharmony_ci
3545bd8deadSopenharmony_ciChanges to the OpenGL ES 3.0.4 Specification, Chapter 3
3555bd8deadSopenharmony_ci
3565bd8deadSopenharmony_ci    Append new paragraphs at the end of the "Shader Outputs" subsection under
3575bd8deadSopenharmony_ci    section 3.9.2, Shader Execution, page 171:
3585bd8deadSopenharmony_ci
3595bd8deadSopenharmony_ci    "Prior to fragment shading, fragment outputs declared inout are populated
3605bd8deadSopenharmony_ci    with the value last written to the framebuffer at the same (x,y,sample)
3615bd8deadSopenharmony_ci    position.  If the framebuffer attachment corresponding to an inout fragment
3625bd8deadSopenharmony_ci    output has a fixed-point format, each color component undergoes a
3635bd8deadSopenharmony_ci    conversion to floating-point first.  This conversion must leave the values
3645bd8deadSopenharmony_ci    0 and 1 invariant.
3655bd8deadSopenharmony_ci
3665bd8deadSopenharmony_ci    Reading from a user-defined fragment output declared inout causes the
3675bd8deadSopenharmony_ci    shader to be evaluated per-sample, since the framebuffer potentially
3685bd8deadSopenharmony_ci    contains different color values for each sample.
3695bd8deadSopenharmony_ci
3705bd8deadSopenharmony_ci    If the value of FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING{_EXT} for the
3715bd8deadSopenharmony_ci    framebuffer attachment corresponding to a given inout fragment output is
3725bd8deadSopenharmony_ci    SRGB (see section 6.1.13),"
3735bd8deadSopenharmony_ci
3745bd8deadSopenharmony_ci    [[If GL_EXT_sRGB_write_control is supported]]
3755bd8deadSopenharmony_ci
3765bd8deadSopenharmony_ci    "and FRAMEBUFFER_SRGB_EXT is enabled,"
3775bd8deadSopenharmony_ci
3785bd8deadSopenharmony_ci    [[End GL_EXT_sRGB_write_control]]
3795bd8deadSopenharmony_ci
3805bd8deadSopenharmony_ci    "the R, G, and B destination color values (after conversion from
3815bd8deadSopenharmony_ci    fixed-point to floating-point) are considered to be encoded for the sRGB
3825bd8deadSopenharmony_ci    color space and hence must be linearized first.  Each R, G, and B component
3835bd8deadSopenharmony_ci    is converted in the same fashion described for sRGB texture components in
3845bd8deadSopenharmony_ci    section 3.8.16."
3855bd8deadSopenharmony_ci
3865bd8deadSopenharmony_ci    [[ The following applies if EXT_shader_framebuffer_fetch_non_coherent is
3875bd8deadSopenharmony_ci       supported. ]]
3885bd8deadSopenharmony_ci
3895bd8deadSopenharmony_ci    "The command
3905bd8deadSopenharmony_ci
3915bd8deadSopenharmony_ci        void FramebufferFetchBarrierEXT(void);
3925bd8deadSopenharmony_ci
3935bd8deadSopenharmony_ci    specifies a boundary between passes when reading existing framebuffer data
3945bd8deadSopenharmony_ci    from fragment shaders via inout fragment outputs.  Previous framebuffer
3955bd8deadSopenharmony_ci    object writes regardless of the mechanism (including clears, blits and
3965bd8deadSopenharmony_ci    primitive rendering) are guaranteed to be visible to subsequent fragment
3975bd8deadSopenharmony_ci    shader invocations that read from the framebuffer once
3985bd8deadSopenharmony_ci    FramebufferFetchBarrierEXT is executed."
3995bd8deadSopenharmony_ci
4005bd8deadSopenharmony_ci    [[ The following applies if both EXT_shader_framebuffer_fetch and
4015bd8deadSopenharmony_ci       EXT_shader_framebuffer_fetch_non_coherent are supported. ]]
4025bd8deadSopenharmony_ci
4035bd8deadSopenharmony_ci    "Because the implementation guarantees coherency of framebuffer reads and
4045bd8deadSopenharmony_ci    writes for color outputs not explicitly marked with the noncoherent layout
4055bd8deadSopenharmony_ci    qualifier, calling the FramebufferFetchBarrierEXT command is not required
4065bd8deadSopenharmony_ci    unless the application wishes to manage memory ordering of framebuffer
4075bd8deadSopenharmony_ci    reads and writes explicitly, which may provide better performance on some
4085bd8deadSopenharmony_ci    implementations in cases where rendering can be split into multiple passes
4095bd8deadSopenharmony_ci    with non-self-overlapping geometry."
4105bd8deadSopenharmony_ci
4115bd8deadSopenharmony_ciChanges to the OpenGL ES Shading Language 1.0.17 Specification, Chapter 3
4125bd8deadSopenharmony_ci
4135bd8deadSopenharmony_ci    Remove Paragraph 2 of section 3.8, page 17, Identifiers ("Identifiers
4145bd8deadSopenharmony_ci    starting with "gl_" are reserved [...]") and add:
4155bd8deadSopenharmony_ci
4165bd8deadSopenharmony_ci    "Identifiers starting with "gl_" are reserved for use by the Shading
4175bd8deadSopenharmony_ci    Language, and may not be declared in a shader as either a variable or a
4185bd8deadSopenharmony_ci    function.  However, as noted in the specification, certain predeclared
4195bd8deadSopenharmony_ci    "gl_" names are allowed to be redeclared in a shader for the specific
4205bd8deadSopenharmony_ci    purpose of changing their precision or layout qualifier."
4215bd8deadSopenharmony_ci
4225bd8deadSopenharmony_ciChanges to the OpenGL ES Shading Language 1.0.17 Specification, Chapter 4
4235bd8deadSopenharmony_ci
4245bd8deadSopenharmony_ci    [[ The following applies if EXT_shader_framebuffer_fetch_non_coherent is
4255bd8deadSopenharmony_ci       supported. ]]
4265bd8deadSopenharmony_ci
4275bd8deadSopenharmony_ci    Add a new Section 4.x (Layout Qualifiers) as follows:
4285bd8deadSopenharmony_ci
4295bd8deadSopenharmony_ci    "4.x Layout Qualifiers
4305bd8deadSopenharmony_ci
4315bd8deadSopenharmony_ci    Layout qualifiers can appear with an individual variable declaration:
4325bd8deadSopenharmony_ci
4335bd8deadSopenharmony_ci        <layout-qualifier> <declaration>;
4345bd8deadSopenharmony_ci
4355bd8deadSopenharmony_ci        <layout-qualifier>:
4365bd8deadSopenharmony_ci            layout( <layout-qualifier-id-list> )
4375bd8deadSopenharmony_ci
4385bd8deadSopenharmony_ci        <layout-qualifier-id-list>:
4395bd8deadSopenharmony_ci            comma separated list of <layout-qualifier-id>
4405bd8deadSopenharmony_ci
4415bd8deadSopenharmony_ci    Declarations of layouts can only be made at global scope, and only where
4425bd8deadSopenharmony_ci    indicated in the following subsection; their details are specific to what
4435bd8deadSopenharmony_ci    the declaration interface is, and are discussed individually.
4445bd8deadSopenharmony_ci
4455bd8deadSopenharmony_ci    The tokens in any <layout-qualifier-id-list> are identifiers, not
4465bd8deadSopenharmony_ci    keywords. Generally they can be listed in any order. Order-dependent
4475bd8deadSopenharmony_ci    meanings exist only if explicitly called out below. Similarly, these
4485bd8deadSopenharmony_ci    identifiers are not case-sensitive, unless explicitly noted otherwise.
4495bd8deadSopenharmony_ci
4505bd8deadSopenharmony_ci    4.x.1 Output Layout Qualifiers
4515bd8deadSopenharmony_ci
4525bd8deadSopenharmony_ci    Fragment shaders may specify the following layout qualifier only for
4535bd8deadSopenharmony_ci    redeclaring the built-in gl_LastFragData array.  The allowed layout
4545bd8deadSopenharmony_ci    qualifier identifiers for gl_LastFragData are:
4555bd8deadSopenharmony_ci
4565bd8deadSopenharmony_ci      <layout-qualifier-id>:
4575bd8deadSopenharmony_ci        noncoherent
4585bd8deadSopenharmony_ci
4595bd8deadSopenharmony_ci    Non-coherent framebuffer fetch outputs have relaxed memory ordering
4605bd8deadSopenharmony_ci    requirements and may provide better performance on some implementations,
4615bd8deadSopenharmony_ci    but they require FramebufferFetchBarrierEXT to be called explicitly for the
4625bd8deadSopenharmony_ci    contents rendered to a color attachment to be visible to subsequent
4635bd8deadSopenharmony_ci    fragment shader invocations.  Redeclarations are done as follows:
4645bd8deadSopenharmony_ci
4655bd8deadSopenharmony_ci      layout(noncoherent) mediump vec4 gl_LastFragData[gl_MaxDrawBuffers];"
4665bd8deadSopenharmony_ci
4675bd8deadSopenharmony_ciChanges to the OpenGL ES Shading Language 1.0.17 Specification, Chapter 7
4685bd8deadSopenharmony_ci
4695bd8deadSopenharmony_ci    Add after the last sentence of Paragraph 2 of Section 7.2, page 60,
4705bd8deadSopenharmony_ci    Fragment Shader Special Variables ("These variables may be written to
4715bd8deadSopenharmony_ci    more [...]"):
4725bd8deadSopenharmony_ci    
4735bd8deadSopenharmony_ci    "... To access the existing framebuffer values (e.g., to implement a
4745bd8deadSopenharmony_ci    complex blend operation inside the shader), fragment shaders should use
4755bd8deadSopenharmony_ci    the read-only input array gl_LastFragData."
4765bd8deadSopenharmony_ci
4775bd8deadSopenharmony_ci    [[ The following applies if EXT_shader_framebuffer_fetch is supported. ]]
4785bd8deadSopenharmony_ci
4795bd8deadSopenharmony_ci    "Unless it has been redeclared with the noncoherent layout qualifier,
4805bd8deadSopenharmony_ci    gl_LastFragData contains the most recent value written to the attachments
4815bd8deadSopenharmony_ci    bound to each color output at the current sample location.  Access to
4825bd8deadSopenharmony_ci    gl_LastFragData is optional and can be enabled by
4835bd8deadSopenharmony_ci
4845bd8deadSopenharmony_ci     #extension GL_EXT_shader_framebuffer_fetch : <behavior>
4855bd8deadSopenharmony_ci
4865bd8deadSopenharmony_ci    Where <behavior> is as specified in section 3.4.  A new preprocessor
4875bd8deadSopenharmony_ci    define is added to the Shading Language:
4885bd8deadSopenharmony_ci
4895bd8deadSopenharmony_ci     #define GL_EXT_shader_framebuffer_fetch                     1"
4905bd8deadSopenharmony_ci
4915bd8deadSopenharmony_ci    [[ The following applies if EXT_shader_framebuffer_fetch_non_coherent is
4925bd8deadSopenharmony_ci       supported. ]]
4935bd8deadSopenharmony_ci
4945bd8deadSopenharmony_ci    "If it has been redeclared with the noncoherent layout qualifier,
4955bd8deadSopenharmony_ci    gl_LastFragData contains the most recent value written to the attachments
4965bd8deadSopenharmony_ci    bound to each color output at the current sample location as long as
4975bd8deadSopenharmony_ci    FramebufferFetchBarrierEXT has been executed between the last command that
4985bd8deadSopenharmony_ci    updated the same location of the framebuffer attachment and the current
4995bd8deadSopenharmony_ci    draw call.  Its value is undefined for any outputs whose contents at the
5005bd8deadSopenharmony_ci    current sample location have been modified since the last
5015bd8deadSopenharmony_ci    FramebufferFetchBarrierEXT call.  Access to gl_LastFragData and the ability
5025bd8deadSopenharmony_ci    to use the layout(noncoherent) qualifier are optional and can be enabled by
5035bd8deadSopenharmony_ci
5045bd8deadSopenharmony_ci     #extension GL_EXT_shader_framebuffer_fetch_non_coherent : <behavior>
5055bd8deadSopenharmony_ci
5065bd8deadSopenharmony_ci    Where <behavior> is as specified in section 3.4.  A new preprocessor
5075bd8deadSopenharmony_ci    define is added to the Shading Language:
5085bd8deadSopenharmony_ci
5095bd8deadSopenharmony_ci     #define GL_EXT_shader_framebuffer_fetch_non_coherent        1"
5105bd8deadSopenharmony_ci
5115bd8deadSopenharmony_ci    [[ The following applies to either variant of the extension but shall be
5125bd8deadSopenharmony_ci       omitted where precision qualifiers are not supported. ]]
5135bd8deadSopenharmony_ci
5145bd8deadSopenharmony_ci    "By default, gl_LastFragData is declared with the mediump precision
5155bd8deadSopenharmony_ci    qualifier. This can be changed by redeclaring the corresponding variables
5165bd8deadSopenharmony_ci    with the desired precision qualifier.
5175bd8deadSopenharmony_ci    
5185bd8deadSopenharmony_ci    Redeclarations are done as follows
5195bd8deadSopenharmony_ci    
5205bd8deadSopenharmony_ci    // Redeclaration that changes nothing is allowed
5215bd8deadSopenharmony_ci    mediump vec4 gl_LastFragData[gl_MaxDrawBuffers]; 
5225bd8deadSopenharmony_ci    
5235bd8deadSopenharmony_ci    // All the following are allowed redeclaration that change behavior
5245bd8deadSopenharmony_ci    lowp vec4 gl_LastFragData[gl_MaxDrawBuffers];
5255bd8deadSopenharmony_ci    highp vec4 gl_LastFragData[gl_MaxDrawBuffers];
5265bd8deadSopenharmony_ci    
5275bd8deadSopenharmony_ci    Redeclarations must not otherwise alter the declared type or array size of
5285bd8deadSopenharmony_ci    gl_LastFragData."
5295bd8deadSopenharmony_ci
5305bd8deadSopenharmony_ci    [[ The following applies if EXT_shader_framebuffer_fetch_non_coherent is
5315bd8deadSopenharmony_ci       supported. ]]
5325bd8deadSopenharmony_ci
5335bd8deadSopenharmony_ci    "Unless the GL_EXT_shader_framebuffer_fetch extension has been enabled in
5345bd8deadSopenharmony_ci    addition, it's an error to use gl_LastFragData if it hasn't been
5355bd8deadSopenharmony_ci    explicitly redeclared with layout(noncoherent)."
5365bd8deadSopenharmony_ci
5375bd8deadSopenharmony_ciChanges to the OpenGL ES Shading Language 1.0.17 Specification, Chapter 8
5385bd8deadSopenharmony_ci
5395bd8deadSopenharmony_ci    Add after paragraph 2 of section 8.7, Texture Lookup Functions,
5405bd8deadSopenharmony_ci    page 57 ("Functions containing the bias parameter [...]"):
5415bd8deadSopenharmony_ci
5425bd8deadSopenharmony_ci    "Results are undefined if the coordinates passed to any of the built-in
5435bd8deadSopenharmony_ci    functions below that compute an implicit LOD value are calculated based on
5445bd8deadSopenharmony_ci    the result of reading from gl_LastFragData, and the texture bound to the
5455bd8deadSopenharmony_ci    specified sampler is mip-mapped."
5465bd8deadSopenharmony_ci
5475bd8deadSopenharmony_ciChanges to the OpenGL Shading Language 1.10 Specification, Chapter 8
5485bd8deadSopenharmony_ci
5495bd8deadSopenharmony_ci    [[ The following applies in addition to the changes given above for the
5505bd8deadSopenharmony_ci       same chapter of the OpenGL ES Shading Language 1.0.17 Specification. ]]
5515bd8deadSopenharmony_ci
5525bd8deadSopenharmony_ci    Append at the end of section 8.8, Fragment Processing Functions,
5535bd8deadSopenharmony_ci    page 59:
5545bd8deadSopenharmony_ci
5555bd8deadSopenharmony_ci    "The result of the built-in derivative functions dFdx, dFdy and
5565bd8deadSopenharmony_ci    fwidth is undefined if the value passed as argument was calculated
5575bd8deadSopenharmony_ci    based on the result of reading from gl_LastFragData."
5585bd8deadSopenharmony_ci
5595bd8deadSopenharmony_ciChanges to the OpenGL ES Shading Language 3.00.3 Specification, Chapter 4
5605bd8deadSopenharmony_ci
5615bd8deadSopenharmony_ci    Modify Paragraph 2 of section 4.3.6:
5625bd8deadSopenharmony_ci    "Except in the fragment stage, there is not an inout storage qualifier at
5635bd8deadSopenharmony_ci    global scope for declaring a single variable name as both input and output
5645bd8deadSopenharmony_ci    [...]"
5655bd8deadSopenharmony_ci
5665bd8deadSopenharmony_ci    Modify Paragraph 7 of section 4.3.6:
5675bd8deadSopenharmony_ci
5685bd8deadSopenharmony_ci    "Fragment outputs output per-fragment data and are declared using the out
5695bd8deadSopenharmony_ci    or inout storage qualifier.  It is a compile-time error to use auxiliary
5705bd8deadSopenharmony_ci    storage qualifiers or interpolation qualifiers on an output in a fragment
5715bd8deadSopenharmony_ci    shader [...]" and append new paragraphs at the end of the same section:
5725bd8deadSopenharmony_ci
5735bd8deadSopenharmony_ci    [[ The following applies if EXT_shader_framebuffer_fetch_non_coherent is
5745bd8deadSopenharmony_ci       supported. ]]
5755bd8deadSopenharmony_ci
5765bd8deadSopenharmony_ci    "Fragment outputs declared inout may specify the following layout
5775bd8deadSopenharmony_ci    qualifier:
5785bd8deadSopenharmony_ci
5795bd8deadSopenharmony_ci      <layout-qualifier-id>:
5805bd8deadSopenharmony_ci        noncoherent
5815bd8deadSopenharmony_ci
5825bd8deadSopenharmony_ci    Non-coherent framebuffer fetch outputs have relaxed memory ordering
5835bd8deadSopenharmony_ci    requirements and may provide better performance on some implementations,
5845bd8deadSopenharmony_ci    but they require FramebufferFetchBarrierEXT to be called explicitly for the
5855bd8deadSopenharmony_ci    contents rendered to a color attachment to be visible to subsequent
5865bd8deadSopenharmony_ci    fragment shader invocations."
5875bd8deadSopenharmony_ci
5885bd8deadSopenharmony_ci    [[ The following applies if EXT_shader_framebuffer_fetch is supported. ]]
5895bd8deadSopenharmony_ci
5905bd8deadSopenharmony_ci    "Upon entry to the fragment shader, fragment outputs declared inout not
5915bd8deadSopenharmony_ci    qualified with the noncoherent layout qualifier will contain the most
5925bd8deadSopenharmony_ci    recent value written to the same framebuffer attachment at the current
5935bd8deadSopenharmony_ci    sample location.  This behavior and the ability to use the inout qualifier
5945bd8deadSopenharmony_ci    at global scope in a fragment shader is optional and can be enabled by
5955bd8deadSopenharmony_ci
5965bd8deadSopenharmony_ci     #extension GL_EXT_shader_framebuffer_fetch : <behavior>
5975bd8deadSopenharmony_ci    
5985bd8deadSopenharmony_ci    Where <behavior> is as specified in section 3.4.  A new preprocessor
5995bd8deadSopenharmony_ci    define is added to the Shading Language:
6005bd8deadSopenharmony_ci
6015bd8deadSopenharmony_ci     #define GL_EXT_shader_framebuffer_fetch                     1"
6025bd8deadSopenharmony_ci
6035bd8deadSopenharmony_ci    [[ The following applies if EXT_shader_framebuffer_fetch_non_coherent is
6045bd8deadSopenharmony_ci       supported. ]]
6055bd8deadSopenharmony_ci
6065bd8deadSopenharmony_ci    "Upon entry to the fragment shader, fragment outputs declared inout
6075bd8deadSopenharmony_ci    qualified with the noncoherent layout qualifier will contain the most
6085bd8deadSopenharmony_ci    recent value written to the same framebuffer attachment at the current
6095bd8deadSopenharmony_ci    sample location, as long as FramebufferFetchBarrierEXT has been executed
6105bd8deadSopenharmony_ci    between the last command that updated the framebuffer location and the
6115bd8deadSopenharmony_ci    current draw call.  The initial value is undefined for any fragment outputs
6125bd8deadSopenharmony_ci    declared inout whose contents at the current sample location have been
6135bd8deadSopenharmony_ci    modified since the last FramebufferFetchBarrierEXT call.  This behavior and
6145bd8deadSopenharmony_ci    the ability to use the inout and layout(noncoherent) qualifiers at global
6155bd8deadSopenharmony_ci    scope in a fragment shader are optional and can be enabled by
6165bd8deadSopenharmony_ci
6175bd8deadSopenharmony_ci     #extension GL_EXT_shader_framebuffer_fetch_non_coherent : <behavior>
6185bd8deadSopenharmony_ci
6195bd8deadSopenharmony_ci    Where <behavior> is as specified in section 3.4.  A new preprocessor
6205bd8deadSopenharmony_ci    define is added to the Shading Language:
6215bd8deadSopenharmony_ci
6225bd8deadSopenharmony_ci     #define GL_EXT_shader_framebuffer_fetch_non_coherent        1"
6235bd8deadSopenharmony_ci
6245bd8deadSopenharmony_ci    [[ The following applies if EXT_shader_framebuffer_fetch_non_coherent is
6255bd8deadSopenharmony_ci       supported. ]]
6265bd8deadSopenharmony_ci
6275bd8deadSopenharmony_ci    "It is an error to declare an inout fragment output not qualified with
6285bd8deadSopenharmony_ci    layout(noncoherent) if the GL_EXT_shader_framebuffer_fetch extension hasn't
6295bd8deadSopenharmony_ci    been enabled."
6305bd8deadSopenharmony_ci
6315bd8deadSopenharmony_ciChanges to the OpenGL ES Shading Language 3.00.3 Specification, Chapter 7
6325bd8deadSopenharmony_ci
6335bd8deadSopenharmony_ci    [[ The following shall be omitted if the changes given below for the same
6345bd8deadSopenharmony_ci       chapter of the OpenGL ES Shading Language 3.10.4 Specification apply. ]]
6355bd8deadSopenharmony_ci
6365bd8deadSopenharmony_ci    Append at the end of section 7.2, Fragment Shader Special Variables, page
6375bd8deadSopenharmony_ci    82:
6385bd8deadSopenharmony_ci
6395bd8deadSopenharmony_ci    "A helper invocation is a fragment shader invocation that is created solely
6405bd8deadSopenharmony_ci    for the purposes of evaluating derivatives for the built-in functions
6415bd8deadSopenharmony_ci    texture() (section 8.9 "Texture Functions"), dFdx(), dFdy(), and fwidth()
6425bd8deadSopenharmony_ci    for other non-helper fragment shader invocations.
6435bd8deadSopenharmony_ci
6445bd8deadSopenharmony_ci    Fragment shader helper invocations execute the same shader code as
6455bd8deadSopenharmony_ci    non-helper invocations, but will not have side effects that modify the
6465bd8deadSopenharmony_ci    framebuffer or other shader-accessible memory.  In particular fragments
6475bd8deadSopenharmony_ci    corresponding to helper invocations are discarded when shader execution is
6485bd8deadSopenharmony_ci    complete, without updating the framebuffer.  The values returned when
6495bd8deadSopenharmony_ci    reading from the framebuffer via inout fragment outputs are undefined for
6505bd8deadSopenharmony_ci    helper invocations.
6515bd8deadSopenharmony_ci
6525bd8deadSopenharmony_ci    Helper invocations may be generated for pixels not covered by a primitive
6535bd8deadSopenharmony_ci    being rendered. While fragment shader inputs qualified with "centroid" are
6545bd8deadSopenharmony_ci    normally required to be sampled in the intersection of the pixel and the
6555bd8deadSopenharmony_ci    primitive, the requirement is ignored for such pixels since there is no
6565bd8deadSopenharmony_ci    intersection between the pixel and primitive.
6575bd8deadSopenharmony_ci
6585bd8deadSopenharmony_ci    Helper invocations may also be generated for fragments that are covered by
6595bd8deadSopenharmony_ci    a primitive being rendered when the fragment is killed by early fragment
6605bd8deadSopenharmony_ci    tests or where the implementation is able to determine that executing the
6615bd8deadSopenharmony_ci    fragment shader would have no effect other than assisting in computing
6625bd8deadSopenharmony_ci    derivatives for other fragment shader invocations.  The set of helper
6635bd8deadSopenharmony_ci    invocations generated when processing any set of primitives is
6645bd8deadSopenharmony_ci    implementation-dependent."
6655bd8deadSopenharmony_ci
6665bd8deadSopenharmony_ciChanges to the OpenGL ES Shading Language 3.10.4 Specification, Chapter 7
6675bd8deadSopenharmony_ci
6685bd8deadSopenharmony_ci    Modify the first bullet point of paragraph 11 of section 7.1.2, Fragment
6695bd8deadSopenharmony_ci    Shader Special Variables, page 96:
6705bd8deadSopenharmony_ci
6715bd8deadSopenharmony_ci    "* Fragments corresponding to helper invocations are discarded when shader
6725bd8deadSopenharmony_ci       execution is complete, without updating the framebuffer.  The values
6735bd8deadSopenharmony_ci       returned when reading from the framebuffer via inout fragment outputs
6745bd8deadSopenharmony_ci       are undefined for helper invocations."
6755bd8deadSopenharmony_ci
6765bd8deadSopenharmony_ciInteractions with OpenGL 2.0
6775bd8deadSopenharmony_ci
6785bd8deadSopenharmony_ci    If OpenGL 2.0 is supported, all changes given above for the OpenGL ES
6795bd8deadSopenharmony_ci    2.0.24 and OpenGL ES Shading Language 1.0.17 specifications shall be
6805bd8deadSopenharmony_ci    applied, in addition to any changes given specifically for the OpenGL
6815bd8deadSopenharmony_ci    Shading Language 1.10 Specification.  References to precision qualifiers
6825bd8deadSopenharmony_ci    shall be omitted.
6835bd8deadSopenharmony_ci
6845bd8deadSopenharmony_ciInteractions with OpenGL 3.0 and later
6855bd8deadSopenharmony_ci
6865bd8deadSopenharmony_ci    If OpenGL 3.0 is supported, all changes given above for the OpenGL ES 3.0.4
6875bd8deadSopenharmony_ci    and OpenGL ES Shading Language 3.00.3 specifications shall be applied.
6885bd8deadSopenharmony_ci    Changes given for earlier OpenGL ES and OpenGL ES Shading Language versions
6895bd8deadSopenharmony_ci    shall be ignored.  References to auxiliary storage qualifiers shall be
6905bd8deadSopenharmony_ci    omitted if they are not supported by the Shading Language.
6915bd8deadSopenharmony_ci
6925bd8deadSopenharmony_ciInteractions with OpenGL 4.0 and later
6935bd8deadSopenharmony_ci
6945bd8deadSopenharmony_ci    The interaction described below with ARB_sample_shading applies in
6955bd8deadSopenharmony_ci    addition to any interactions enumerated for OpenGL 3.0 and above.
6965bd8deadSopenharmony_ci
6975bd8deadSopenharmony_ciInteractions with OpenGL 4.5 and later
6985bd8deadSopenharmony_ci
6995bd8deadSopenharmony_ci    The changes given above for the OpenGL Shading Language 3.10.4
7005bd8deadSopenharmony_ci    Specification shall be applied in addition to any interactions enumerated
7015bd8deadSopenharmony_ci    for OpenGL 4.0 and above.
7025bd8deadSopenharmony_ci
7035bd8deadSopenharmony_ciInteractions with OpenGL ES 2.0
7045bd8deadSopenharmony_ci
7055bd8deadSopenharmony_ci    If OpenGL ES 2.0 is supported, apply all changes given above for the OpenGL
7065bd8deadSopenharmony_ci    ES 2.0.24 and OpenGL ES Shading Language 1.0.17 specifications.
7075bd8deadSopenharmony_ci
7085bd8deadSopenharmony_ciInteractions with OpenGL ES 3.0 and later
7095bd8deadSopenharmony_ci
7105bd8deadSopenharmony_ci    If OpenGL ES 3.0 is supported, all changes given above for the OpenGL ES
7115bd8deadSopenharmony_ci    3.0.4 and OpenGL ES Shading Language 3.00.3 specifications shall be
7125bd8deadSopenharmony_ci    applied.  Changes given for earlier OpenGL ES and OpenGL ES Shading
7135bd8deadSopenharmony_ci    Language versions shall be ignored.  References to auxiliary storage
7145bd8deadSopenharmony_ci    qualifiers shall be omitted if they are not supported by the Shading
7155bd8deadSopenharmony_ci    Language.
7165bd8deadSopenharmony_ci
7175bd8deadSopenharmony_ciInteractions with OpenGL ES 3.1 and later
7185bd8deadSopenharmony_ci
7195bd8deadSopenharmony_ci    The changes given above for the OpenGL Shading Language 3.10.4
7205bd8deadSopenharmony_ci    Specification shall be applied in addition to any interactions enumerated
7215bd8deadSopenharmony_ci    for OpenGL ES 3.0 and above.
7225bd8deadSopenharmony_ci
7235bd8deadSopenharmony_ciInteractions with OpenGL ES 3.2 and later
7245bd8deadSopenharmony_ci
7255bd8deadSopenharmony_ci    The interaction described below with OES_sample_shading applies in
7265bd8deadSopenharmony_ci    addition to any interactions enumerated for OpenGL ES 3.1 and above.
7275bd8deadSopenharmony_ci
7285bd8deadSopenharmony_ciInteractions with OES_standard_derivatives
7295bd8deadSopenharmony_ci
7305bd8deadSopenharmony_ci    Results from shaders which use the built-in derivative functions dFdx,
7315bd8deadSopenharmony_ci    dFdy, and fwidth on variables calculated using the current framebuffer 
7325bd8deadSopenharmony_ci    color are undefined.
7335bd8deadSopenharmony_ci
7345bd8deadSopenharmony_ciInteractions with ARB_sample_shading and OES_sample_shading
7355bd8deadSopenharmony_ci
7365bd8deadSopenharmony_ci    The FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT query defined above is guaranteed
7375bd8deadSopenharmony_ci    to return TRUE if any of these extensions is supported, since they
7385bd8deadSopenharmony_ci    already provide well-defined behavior for discard jumps with sample
7395bd8deadSopenharmony_ci    granularity.
7405bd8deadSopenharmony_ci
7415bd8deadSopenharmony_ciRevision History
7425bd8deadSopenharmony_ci
7435bd8deadSopenharmony_ci    Version 8, 2018/09/06 - Replace non-ASCII quote characters.
7445bd8deadSopenharmony_ci    Version 7, 2017/11/13 - Specify interactions with desktop OpenGL APIs.
7455bd8deadSopenharmony_ci                          - Specify interaction with ARB/OES_sample_shading
7465bd8deadSopenharmony_ci                            and unextended GL versions that provide the same
7475bd8deadSopenharmony_ci                            functionality.  Clarify resolution of
7485bd8deadSopenharmony_ci                            multisampling-related issues to avoid
7495bd8deadSopenharmony_ci                            contradicting recent versions of the spec.
7505bd8deadSopenharmony_ci                          - Explicitly require per-sample evaluation of the
7515bd8deadSopenharmony_ci                            fragment shader when an inout output is read in
7525bd8deadSopenharmony_ci                            OpenGL ES 3.0 and above.
7535bd8deadSopenharmony_ci                          - Specify undefined behavior of helper invocations
7545bd8deadSopenharmony_ci                            in OpenGL ES 3.0 and above.  Add discussion
7555bd8deadSopenharmony_ci                            related to derivative computations in the issues
7565bd8deadSopenharmony_ci                            section.
7575bd8deadSopenharmony_ci                          - Specify undefined behavior of texture lookup
7585bd8deadSopenharmony_ci                            functions that compute implicit derivatives in
7595bd8deadSopenharmony_ci                            OpenGL (ES) 2.0.
7605bd8deadSopenharmony_ci                          - Define EXT_shader_framebuffer_fetch_non_coherent
7615bd8deadSopenharmony_ci                            variant of the extension.  Add
7625bd8deadSopenharmony_ci                            FramebufferFetchBarrierEXT command.  Define
7635bd8deadSopenharmony_ci                            noncoherent layout qualifier for finer-grained
7645bd8deadSopenharmony_ci                            control of framebuffer fetch coherency.
7655bd8deadSopenharmony_ci    Version 6, 2017/10/04 - Clarified how gl_LastFragData is populated.
7665bd8deadSopenharmony_ci    Version 5, 2016/09/08 - Added preprocessor defines.
7675bd8deadSopenharmony_ci    Version 4, 2013/05/28 - Added ES3 interaction as requested in Bug 10236
7685bd8deadSopenharmony_ci    Version 3, 2012/09/24 - Remove obsolete issue 3 about derivatives
7695bd8deadSopenharmony_ci    Version 2, 2012/06/21 - Fix MULTISAMPLE enabled -> SAMPLE_BUFFERS = 1,
7705bd8deadSopenharmony_ci                            recast from APPLE to multivendor EXT, clarify that
7715bd8deadSopenharmony_ci                            gl_LastFragData reflects value written by previous
7725bd8deadSopenharmony_ci                            pixel at same coordinates.
7735bd8deadSopenharmony_ci    Version 1, 2012/06/01 - Conversion from ARB_sync to APPLE_sync for ES.
774