15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    EXT_blend_func_extended
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_EXT_blend_func_extended
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Mark Kilgard, NVIDIA Corporation (mjk 'at' nvidia.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciContributors
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    Daniel Koch, NVIDIA
165bd8deadSopenharmony_ci    Slawomir Grajewski, Intel
175bd8deadSopenharmony_ci    Chris Dalton, NVIDIA
185bd8deadSopenharmony_ci    Brian Salomon, Google
195bd8deadSopenharmony_ci
205bd8deadSopenharmony_ci    From ARB_blend_func_extended...
215bd8deadSopenharmony_ci
225bd8deadSopenharmony_ci    Graham Sellers, AMD
235bd8deadSopenharmony_ci    Mark Young, AMD
245bd8deadSopenharmony_ci    Nick Haemel, AMD
255bd8deadSopenharmony_ci    Pierre Boudier, AMD
265bd8deadSopenharmony_ci    Mais Alnasser, AMD
275bd8deadSopenharmony_ci    Jeff Bolz, NVIDIA
285bd8deadSopenharmony_ci    Pat Brown, NVIDIA
295bd8deadSopenharmony_ci    Ian Stewart, NVIDIA
305bd8deadSopenharmony_ci    Jon Leech, Khronos
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ciStatus
335bd8deadSopenharmony_ci
345bd8deadSopenharmony_ci    Complete
355bd8deadSopenharmony_ci
365bd8deadSopenharmony_ci    Exposed in ES contexts in NVIDIA drivers 358.00 (Septmeber 2015)
375bd8deadSopenharmony_ci    and later.
385bd8deadSopenharmony_ci
395bd8deadSopenharmony_ciVersion
405bd8deadSopenharmony_ci
415bd8deadSopenharmony_ci    Last Modified Date:         August 25, 2015
425bd8deadSopenharmony_ci    Revision:                   6
435bd8deadSopenharmony_ci
445bd8deadSopenharmony_ciNumber
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ci    OpenGL ES Extension #247
475bd8deadSopenharmony_ci
485bd8deadSopenharmony_ciDependencies
495bd8deadSopenharmony_ci
505bd8deadSopenharmony_ci    This extension is written against the OpenGL ES 3.1 (June 4, 2014)
515bd8deadSopenharmony_ci    specification, but can apply to earlier versions back to ES 2.0.
525bd8deadSopenharmony_ci
535bd8deadSopenharmony_ci    GLSL version 300 and 310 language is written against The OpenGL ES
545bd8deadSopenharmony_ci    Shading Language (July 11, 2012).
555bd8deadSopenharmony_ci
565bd8deadSopenharmony_ci    GLSL version 100 language is written against The OpenGL ES Shading
575bd8deadSopenharmony_ci    Language (May 12, 2009).
585bd8deadSopenharmony_ci
595bd8deadSopenharmony_ci    The NV_draw_buffers and EXT_draw_buffers extensions trivially affect
605bd8deadSopenharmony_ci    the definition of this extension.
615bd8deadSopenharmony_ci
625bd8deadSopenharmony_ci    The EXT_draw_buffers_indexed extension affects the definition of
635bd8deadSopenharmony_ci    this extension.
645bd8deadSopenharmony_ci
655bd8deadSopenharmony_ciOverview
665bd8deadSopenharmony_ci
675bd8deadSopenharmony_ci    This extension provides an ES version of the ARB_blend_func_extended
685bd8deadSopenharmony_ci    functionality.
695bd8deadSopenharmony_ci
705bd8deadSopenharmony_ci    Traditional OpenGL includes fixed-function blending that combines
715bd8deadSopenharmony_ci    source colors with the existing content of a render buffer in
725bd8deadSopenharmony_ci    a variety of ways.  A number of extensions have enhanced this
735bd8deadSopenharmony_ci    functionality by adding further sources of blending weights and
745bd8deadSopenharmony_ci    methods to combine them. However, the inputs to the fixed-function
755bd8deadSopenharmony_ci    blending units are constrained to a source color (as output from
765bd8deadSopenharmony_ci    fragment shading), destination color (as the current content of the
775bd8deadSopenharmony_ci    frame buffer) or constants that may be used in their place.
785bd8deadSopenharmony_ci
795bd8deadSopenharmony_ci    This extension adds new blending functions whereby a fragment
805bd8deadSopenharmony_ci    shader may output two colors, one of which is treated as the
815bd8deadSopenharmony_ci    source color, and the other used as a blending factor for either
825bd8deadSopenharmony_ci    source or destination colors.  Furthermore, this extension increases
835bd8deadSopenharmony_ci    orthogonality by allowing the SRC_ALPHA_SATURATE function to be used
845bd8deadSopenharmony_ci    as the destination weight.
855bd8deadSopenharmony_ci
865bd8deadSopenharmony_ci    Because of the limitations of the OpenGL ES 2.0 shading language,
875bd8deadSopenharmony_ci    new built-in variables (gl_SecondaryFragColorEXT,
885bd8deadSopenharmony_ci    gl_SecondaryFragDataEXT) are added to the ES 1.00 shading language
895bd8deadSopenharmony_ci    rather than introduce more complex features for user-defined fragment
905bd8deadSopenharmony_ci    outputs.  Because such built-in variable are deprecated in ES 3.0,
915bd8deadSopenharmony_ci    these variables are NOT available in the OpenGL ES 3.xx shading
925bd8deadSopenharmony_ci    language verisons.
935bd8deadSopenharmony_ci
945bd8deadSopenharmony_ciIP Status
955bd8deadSopenharmony_ci
965bd8deadSopenharmony_ci    No known IP claims.
975bd8deadSopenharmony_ci
985bd8deadSopenharmony_ciNew Procedures and Functions
995bd8deadSopenharmony_ci
1005bd8deadSopenharmony_ci    void BindFragDataLocationIndexedEXT(uint program, uint colorNumber,
1015bd8deadSopenharmony_ci                                        uint index, const char * name);
1025bd8deadSopenharmony_ci
1035bd8deadSopenharmony_ci    int GetFragDataIndexEXT(uint program, const char * name);
1045bd8deadSopenharmony_ci
1055bd8deadSopenharmony_ci    void BindFragDataLocationEXT(uint program, uint colorNumber, const char * name)
1065bd8deadSopenharmony_ci
1075bd8deadSopenharmony_ci    int GetProgramResourceLocationIndexEXT(uint program, enum programInterface, const char *name);
1085bd8deadSopenharmony_ci
1095bd8deadSopenharmony_ciNew Tokens
1105bd8deadSopenharmony_ci
1115bd8deadSopenharmony_ci    Accepted by the <src> and <dst> parameters of BlendFunc and
1125bd8deadSopenharmony_ci    BlendFunciEXT, and by the <srcRGB>, <dstRGB>, <srcAlpha> and <dstAlpha>
1135bd8deadSopenharmony_ci    parameters of BlendFuncSeparate and BlendFuncSeparateiEXT:
1145bd8deadSopenharmony_ci
1155bd8deadSopenharmony_ci        SRC1_COLOR_EXT                                  0x88F9
1165bd8deadSopenharmony_ci        SRC1_ALPHA_EXT                                  0x8589  // OpenGL 1.5 token value
1175bd8deadSopenharmony_ci        ONE_MINUS_SRC1_COLOR_EXT                        0x88FA
1185bd8deadSopenharmony_ci        ONE_MINUS_SRC1_ALPHA_EXT                        0x88FB
1195bd8deadSopenharmony_ci        SRC_ALPHA_SATURATE_EXT                          0x0308
1205bd8deadSopenharmony_ci
1215bd8deadSopenharmony_ci    Accepted in the <props> array of GetProgramResourceiv:
1225bd8deadSopenharmony_ci
1235bd8deadSopenharmony_ci        LOCATION_INDEX_EXT                              0x930F
1245bd8deadSopenharmony_ci
1255bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
1265bd8deadSopenharmony_ci    and GetFloatv:
1275bd8deadSopenharmony_ci
1285bd8deadSopenharmony_ci        MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT                0x88FC
1295bd8deadSopenharmony_ci
1305bd8deadSopenharmony_ciAdditions to Chapter 7 of the OpenGL ES 3.1 Specification (Programs and
1315bd8deadSopenharmony_ciShaders)
1325bd8deadSopenharmony_ci
1335bd8deadSopenharmony_ci   Add a row to table 7.2 "GetProgramResourceiv properties and supported
1345bd8deadSopenharmony_ci   interfaces" (page 82):
1355bd8deadSopenharmony_ci
1365bd8deadSopenharmony_ci   Property            Supported Interfaces
1375bd8deadSopenharmony_ci   ------------------  --------------------
1385bd8deadSopenharmony_ci   LOCATION_INDEX_EXT  PROGRAM_OUTPUT
1395bd8deadSopenharmony_ci
1405bd8deadSopenharmony_ci   Modify section 7.3.1.1 "Naming Active Resources" subsection to include
1415bd8deadSopenharmony_ci   after the LOCATION paragraph (page 84):
1425bd8deadSopenharmony_ci
1435bd8deadSopenharmony_ci   "For the property LOCATION_INDEX_EXT, a single integer identifying the
1445bd8deadSopenharmony_ci   fragment color index of an active fragment shader output variable
1455bd8deadSopenharmony_ci   is written to params. If the active variable is not an output for a
1465bd8deadSopenharmony_ci   fragment shader, the value -1 will be written to params."
1475bd8deadSopenharmony_ci
1485bd8deadSopenharmony_ci   Modify (page 87) the paragraph introducing GetProgramResourceLocation
1495bd8deadSopenharmony_ci   to begin:
1505bd8deadSopenharmony_ci
1515bd8deadSopenharmony_ci   "The commands
1525bd8deadSopenharmony_ci
1535bd8deadSopenharmony_ci        int GetProgramResourceLocation( uint program,
1545bd8deadSopenharmony_ci            enum programInterface, const char *name );
1555bd8deadSopenharmony_ci        int GetProgramResourceLocationIndexEXT( uint program,
1565bd8deadSopenharmony_ci            enum programInterface, const char *name );
1575bd8deadSopenharmony_ci
1585bd8deadSopenharmony_ci    return the location or the fragment color index, respectively,
1595bd8deadSopenharmony_ci    assigned to the variable named name in interface programInterface
1605bd8deadSopenharmony_ci    of program object program."
1615bd8deadSopenharmony_ci
1625bd8deadSopenharmony_ci    Change the ending of the same paragraph to read:
1635bd8deadSopenharmony_ci
1645bd8deadSopenharmony_ci    "For GetProgramResourceLocationIndexEXT, programInterface must be
1655bd8deadSopenharmony_ci    PROGRAM_OUTPUT. The value -1 will be returned by either command if
1665bd8deadSopenharmony_ci    an error occurs, if name does not identify an active variable on
1675bd8deadSopenharmony_ci    programInterface, or if name identifies an active variable that
1685bd8deadSopenharmony_ci    does not have a valid location assigned, as described above. The
1695bd8deadSopenharmony_ci    locations returned by these commands are the same locations returned
1705bd8deadSopenharmony_ci    when querying the LOCATION and LOCATION_INDEX resource properties."
1715bd8deadSopenharmony_ci
1725bd8deadSopenharmony_ci    Change the next paragaph to begin:
1735bd8deadSopenharmony_ci
1745bd8deadSopenharmony_ci    "A string provided to GetProgramResourceLocation or
1755bd8deadSopenharmony_ci    GetProgramResourceLocationIndexEXT is considered to match an active
1765bd8deadSopenharmony_ci    variable if ..."
1775bd8deadSopenharmony_ci
1785bd8deadSopenharmony_ci    Change the last paragraph of the section (page 88) to read:
1795bd8deadSopenharmony_ci
1805bd8deadSopenharmony_ci    ... "If the string specifies an element of an array variable,
1815bd8deadSopenharmony_ci    GetProgramResourceLocation and GetProgramResourceLocationIndexEXT
1825bd8deadSopenharmony_ci    return the location or fragment color index assigned to that
1835bd8deadSopenharmony_ci    element. If it specifies the base name of an array, it identifies
1845bd8deadSopenharmony_ci    the resources associated with the first element of the array."
1855bd8deadSopenharmony_ci
1865bd8deadSopenharmony_ciAdditions to Chapter 14 of the OpenGL ES 3.1 Specification (Programmable
1875bd8deadSopenharmony_ciFragment Processing)
1885bd8deadSopenharmony_ci
1895bd8deadSopenharmony_ci    Modify section 14.2.3 "Shader Outputs" subsection to include:
1905bd8deadSopenharmony_ci
1915bd8deadSopenharmony_ci    "The binding of a user-defined varying out variable to a fragment color number
1925bd8deadSopenharmony_ci    can be specified explicitly. The command
1935bd8deadSopenharmony_ci
1945bd8deadSopenharmony_ci        void BindFragDataLocationIndexedEXT(uint program, uint colorNumber,
1955bd8deadSopenharmony_ci                                            uint index, const char * name);
1965bd8deadSopenharmony_ci
1975bd8deadSopenharmony_ci    specifies that the varying out variable name in <program> should
1985bd8deadSopenharmony_ci    be bound to fragment color <colorNumber> when the program is next
1995bd8deadSopenharmony_ci    linked. <index> may be zero or one to specify that the color
2005bd8deadSopenharmony_ci    be used as either the first or second color input to the blend
2015bd8deadSopenharmony_ci    equation, respectively, as described in Section 15.1.5 (Blending).
2025bd8deadSopenharmony_ci    If <name> was bound previously, its assigned binding is replaced
2035bd8deadSopenharmony_ci    with colorNumber. <name> must be a null-terminated string. The error
2045bd8deadSopenharmony_ci    INVALID_VALUE is generated if <colorNumber> is equal or greater
2055bd8deadSopenharmony_ci    than the value of MAX_DRAW_BUFFERS and <index> is zero,
2065bd8deadSopenharmony_ci    or if <colorNumber> is equal or greater than the value of
2075bd8deadSopenharmony_ci    MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT and <index> is greater than or
2085bd8deadSopenharmony_ci    equal to one.  The command
2095bd8deadSopenharmony_ci
2105bd8deadSopenharmony_ci        void BindFragDataLocationEXT(uint program, uint colorNumber,
2115bd8deadSopenharmony_ci                                     const char * name)
2125bd8deadSopenharmony_ci
2135bd8deadSopenharmony_ci    is equivalent to calling BindFragDataLocationIndexedEXT with the
2145bd8deadSopenharmony_ci    same values for <program>, <colorNumber> and <name>, and with <index>
2155bd8deadSopenharmony_ci    set to zero.
2165bd8deadSopenharmony_ci
2175bd8deadSopenharmony_ci    When a program is linked, any varying out variables without
2185bd8deadSopenharmony_ci    a binding specified through BindFragDataLocationIndexedEXT or
2195bd8deadSopenharmony_ci    BindFragDataLocationEXT will automatically be bound to fragment
2205bd8deadSopenharmony_ci    colors and indices by the GL.  All such assignments will use color
2215bd8deadSopenharmony_ci    indices of zero.  Such bindings can be queried using the commands
2225bd8deadSopenharmony_ci    GetFragDataLocation and GetFragDataIndexEXT.  Output binding
2235bd8deadSopenharmony_ci    assignments will cause LinkProgram to fail:
2245bd8deadSopenharmony_ci
2255bd8deadSopenharmony_ci      * if the number of active outputs is greater than the value of
2265bd8deadSopenharmony_ci        MAX_DRAW_BUFFERS_EXT;
2275bd8deadSopenharmony_ci
2285bd8deadSopenharmony_ci      * if the program has an active output assigned to a location greater
2295bd8deadSopenharmony_ci        than or equal to the value of MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT
2305bd8deadSopenharmony_ci        and has an active output assigned an index greater than or equal
2315bd8deadSopenharmony_ci        to one;
2325bd8deadSopenharmony_ci
2335bd8deadSopenharmony_ci      * if more than one varying out variable is bound to the same number
2345bd8deadSopenharmony_ci        and index; or
2355bd8deadSopenharmony_ci
2365bd8deadSopenharmony_ci      * if the explicit binding assignments do not leave enough space
2375bd8deadSopenharmony_ci        for the linker to automatically assign a location for a varying
2385bd8deadSopenharmony_ci        out array, which requires multiple contiguous locations.
2395bd8deadSopenharmony_ci
2405bd8deadSopenharmony_ci    BindFragDataLocationIndexedEXT may be issued before any shader objects
2415bd8deadSopenharmony_ci    are attached to a program object. Hence it is allowed to bind any
2425bd8deadSopenharmony_ci    name (except a name starting with gl_) to a color number and index,
2435bd8deadSopenharmony_ci    including a name that is never used as a varying out variable in
2445bd8deadSopenharmony_ci    any fragment shader object.  Assigned bindings for variables that
2455bd8deadSopenharmony_ci    do not exist are ignored."
2465bd8deadSopenharmony_ci
2475bd8deadSopenharmony_ci    Add to end of section:
2485bd8deadSopenharmony_ci
2495bd8deadSopenharmony_ci    "The command
2505bd8deadSopenharmony_ci
2515bd8deadSopenharmony_ci        int GetFragDataIndexEXT(uint program, const char * name);
2525bd8deadSopenharmony_ci
2535bd8deadSopenharmony_ci    returns the index of the fragment color to which the variable <name>
2545bd8deadSopenharmony_ci    was bound when the program object <program> was last linked. If
2555bd8deadSopenharmony_ci    program has not been successfully linked, the error INVALID_OPERATION
2565bd8deadSopenharmony_ci    is generated. If name is not a varying out variable, or if an error
2575bd8deadSopenharmony_ci    occurs, -1 will be returned.  The command is equivalent to
2585bd8deadSopenharmony_ci
2595bd8deadSopenharmony_ci        GetProgramResourceLocationIndex(program, PROGRAM_OUTPUT, name);"
2605bd8deadSopenharmony_ci
2615bd8deadSopenharmony_ciAdditions to Chapter 15 of the OpenGL ES 3.1 Specification (Writing
2625bd8deadSopenharmony_ciFragments and Samples to the Framebuffer)
2635bd8deadSopenharmony_ci
2645bd8deadSopenharmony_ci    Modify section 15.1.5.2 "Blend Functions":
2655bd8deadSopenharmony_ci
2665bd8deadSopenharmony_ci    Change the first paragraph to read:
2675bd8deadSopenharmony_ci
2685bd8deadSopenharmony_ci    "The weighting factors used by the blend equation are determined by
2695bd8deadSopenharmony_ci    the blend functions. There are four possible sources for weighting
2705bd8deadSopenharmony_ci    factors. These are the constant color (Rc, Gc, Bc, Ac) (see
2715bd8deadSopenharmony_ci    BlendColor, p. 211), the first source color (Rs0, Gs0, Bs0, As0),
2725bd8deadSopenharmony_ci    the second source color (Rs1, Gs1, Bs1, As1), and the destination
2735bd8deadSopenharmony_ci    color (the existing content of the draw buffer). Additionally the
2745bd8deadSopenharmony_ci    special constants ZERO and ONE are available as weighting factors."
2755bd8deadSopenharmony_ci
2765bd8deadSopenharmony_ci    Modify Table 15.2 (RGB and ALPHA source and destination blend
2775bd8deadSopenharmony_ci    functions ...) as follows
2785bd8deadSopenharmony_ci
2795bd8deadSopenharmony_ci                                                            RGB Blend Factors                   Alpha Blend Factors
2805bd8deadSopenharmony_ci        Value                                               (Sr, Sg, Sb) or (Dr, Dg, Db)        Sa or Da
2815bd8deadSopenharmony_ci        -----                                               ----------------------------        -------------------
2825bd8deadSopenharmony_ci        ZERO                                                (0, 0, 0)                           0
2835bd8deadSopenharmony_ci        ONE                                                 (1, 1, 1)                           1
2845bd8deadSopenharmony_ci        SRC_COLOR                                           (Rs0, Gs0, Bs0)                     As0
2855bd8deadSopenharmony_ci        ONE_MINUS_SRC_COLOR                                 (1, 1, 1) - (Rs0, Gs0, Bs0)         1 - As0
2865bd8deadSopenharmony_ci        DST_COLOR                                           (Rd, Gd, Bd)                        Ad
2875bd8deadSopenharmony_ci        ONE_MINUS_DST_COLOR                                 (1, 1, 1) - (Rd, Gd, Bd)            1 - Ad
2885bd8deadSopenharmony_ci        SRC_ALPHA                                           (As0, As0, As0)                     As0
2895bd8deadSopenharmony_ci        ONE_MINUS_SRC_ALPHA                                 (1, 1, 1) - (As0, As0, As0)         1 - As0
2905bd8deadSopenharmony_ci        DST_ALPHA                                           (Ad, Ad, Ad)                        Ad
2915bd8deadSopenharmony_ci        ONE_MINUS_DST_ALPHA                                 (1, 1, 1) - (Ad, Ad, Ad)            1 - Ad
2925bd8deadSopenharmony_ci        CONSTANT_COLOR                                      (Rc, Gc, Bc)                        Ac
2935bd8deadSopenharmony_ci        ONE_MINUS_CONSTANT_COLOR                            (1, 1, 1) - (Rc, Gc, Bc)            1 - Ac
2945bd8deadSopenharmony_ci        CONSTANT_ALPHA                                      (Ac, Ac, Ac)                        Ac
2955bd8deadSopenharmony_ci        ONE_MINUS_CONSTANT_ALPHA                            (1, 1, 1) - (Ac, Ac, Ac)            1 - Ac
2965bd8deadSopenharmony_ci        SRC_ALPHA_SATURATE                                  (f, f, f)                           1                       New (for ES 2.x)
2975bd8deadSopenharmony_ci        SRC1_COLOR_EXT                                      (Rs1, Gs1, Bs1)                     As1                     New
2985bd8deadSopenharmony_ci        ONE_MINUS_SRC1_COLOR_EXT                            (1, 1, 1) - (Rs1, Gs1, Bs1)         1 - As1                 New
2995bd8deadSopenharmony_ci        SRC1_ALPHA_EXT                                      (As1, As1, As1)                     As1                     New
3005bd8deadSopenharmony_ci        ONE_MINUS_SRC1_ALPHA_EXT                            (1, 1, 1) - (As1, As1, As1)         1 - As1                 New
3015bd8deadSopenharmony_ci
3025bd8deadSopenharmony_ci    For ES 2.0, remove table's footnote saying (ES 3.x already has this
3035bd8deadSopenharmony_ci    removed):
3045bd8deadSopenharmony_ci
3055bd8deadSopenharmony_ci        SRC_ALPHA_SATURATE is valid only for source RGB and alpha
3065bd8deadSopenharmony_ci        blending functions.
3075bd8deadSopenharmony_ci
3085bd8deadSopenharmony_ci    Add the following subsections to Section 5.1.5 Blending, at the end
3095bd8deadSopenharmony_ci    of the subsection 15.1.5.2 "Blend Functions":
3105bd8deadSopenharmony_ci
3115bd8deadSopenharmony_ci    "15.1.5.X  Dual Source Blending and Multiple Draw Buffers
3125bd8deadSopenharmony_ci
3135bd8deadSopenharmony_ci    Blend functions that require the second color input, <Rs1, Gs1, Bs1,
3145bd8deadSopenharmony_ci    As1> (SRC1_COLOR_EXT, SRC1_ALPHA_EXT, ONE_MINUS_SRC1_COLOR_EXT, or
3155bd8deadSopenharmony_ci    ONE_MINUS_SRC1_ALPHA_EXT) may consume hardware resources that could
3165bd8deadSopenharmony_ci    otherwise be used for rendering to multiple draw buffers. Therefore,
3175bd8deadSopenharmony_ci    the number of draw buffers that can be attached to a frame buffer
3185bd8deadSopenharmony_ci    may be lower when using dual-source blending.
3195bd8deadSopenharmony_ci
3205bd8deadSopenharmony_ci    The maximum number of draw buffers that may be attached to a
3215bd8deadSopenharmony_ci    single frame buffer when using dual-source blending functions is
3225bd8deadSopenharmony_ci    implementation dependent and can be queried by calling GetIntegerv
3235bd8deadSopenharmony_ci    with the symbolic constant MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT. When
3245bd8deadSopenharmony_ci    using dual-source blending, MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT should be
3255bd8deadSopenharmony_ci    used in place of MAX_DRAW_BUFFERS_EXT to determine the maximum number
3265bd8deadSopenharmony_ci    of draw buffers that may be attached to a single frame buffer. The
3275bd8deadSopenharmony_ci    value of MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT must be at least 1. If
3285bd8deadSopenharmony_ci    the value of MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT is 1, then dual-source
3295bd8deadSopenharmony_ci    blending and multiple draw buffers cannot be used simultaneously.
3305bd8deadSopenharmony_ci
3315bd8deadSopenharmony_ci    If either blend function is set to one of the second source factors
3325bd8deadSopenharmony_ci    (SRC1_COLOR_EXT, SRC1_ALPHA_EXT, ONE_MINUS_SRC1_COLOR_EXT, or
3335bd8deadSopenharmony_ci    ONE_MINUS_SRC1_ALPHA_EXT) for any draw buffer and any draw buffers
3345bd8deadSopenharmony_ci    equal to or greater than the value of MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT
3355bd8deadSopenharmony_ci    have values other than NONE, the error INVALID_OPERATION is generated
3365bd8deadSopenharmony_ci    by drawing commands.
3375bd8deadSopenharmony_ci
3385bd8deadSopenharmony_ci    15.1.5.Y  Generation of Second Color Source for Blending
3395bd8deadSopenharmony_ci
3405bd8deadSopenharmony_ci    Rendering using any of the blend functions that consume the second
3415bd8deadSopenharmony_ci    input color (SRC1_COLOR_EXT, ONE_MINUS_SRC1_COLOR_EXT, SRC1_ALPHA_EXT
3425bd8deadSopenharmony_ci    or ONE_MINUS_SRC1_ALPHA_EXT) using a shader that does not output
3435bd8deadSopenharmony_ci    a second source color will produce undefined results.  To produce
3445bd8deadSopenharmony_ci    input for the second source color, a shader must be used that outputs
3455bd8deadSopenharmony_ci    a second source color.
3465bd8deadSopenharmony_ci
3475bd8deadSopenharmony_ci    When using a GLSL version 300 es or higher fragment shader with
3485bd8deadSopenharmony_ci    dual-source blending functions, the color output varyings are bound
3495bd8deadSopenharmony_ci    to the first (index 0) and second (index 1) inputs of a draw buffer
3505bd8deadSopenharmony_ci    using BindFragDataLocationIndexedEXT as described in the "Shader
3515bd8deadSopenharmony_ci    Outputs" subsection of Section 3.12.2 or by layout qualifiers for
3525bd8deadSopenharmony_ci    location=/n/ and index=/m/. Data written to the first of these outputs
3535bd8deadSopenharmony_ci    becomes the first source color input to the blender (corresponding
3545bd8deadSopenharmony_ci    to SRC_COLOR and SRC_ALPHA). Data written to the second of these
3555bd8deadSopenharmony_ci    outputs generates the second source color input to the blender
3565bd8deadSopenharmony_ci    (corresponding to SRC1_COLOR_EXT and SRC1_ALPHA_EXT).
3575bd8deadSopenharmony_ci
3585bd8deadSopenharmony_ci    Alternatively if the GLSL version 100 fragment shader is used (where
3595bd8deadSopenharmony_ci    user-defined color outputs are unsupported, hence a user-defined
3605bd8deadSopenharmony_ci    color output is not available for BindFragDataLocationIndexEXT), the
3615bd8deadSopenharmony_ci    gl_FragColor and gl_SecondaryFragColorEXT fragment outputs correspond
3625bd8deadSopenharmony_ci    to the first and second source color respectively.  Similarly the
3635bd8deadSopenharmony_ci    gl_FragData and gl_SecondaryFragDataEXT fragment output arrays
3645bd8deadSopenharmony_ci    correspond to the first and second source color respectively of each
3655bd8deadSopenharmony_ci    color buffer output.
3665bd8deadSopenharmony_ci
3675bd8deadSopenharmony_ci    If the second color input to the blender is not written in the
3685bd8deadSopenharmony_ci    shader, or if no output is bound to the second input of a blender,
3695bd8deadSopenharmony_ci    the result of the blending operation is not defined.
3705bd8deadSopenharmony_ci
3715bd8deadSopenharmony_ci    Other shading languages may define similar methods for producing
3725bd8deadSopenharmony_ci    the first and second color inputs to blending equations."
3735bd8deadSopenharmony_ci
3745bd8deadSopenharmony_ciAdditions to the OpenGL ES Shading Language 1.00 Specification
3755bd8deadSopenharmony_ci
3765bd8deadSopenharmony_ci    Including the following line in a shader can be used to control the
3775bd8deadSopenharmony_ci    language features described in this extension:
3785bd8deadSopenharmony_ci
3795bd8deadSopenharmony_ci      #extension GL_EXT_blend_func_extended : <behavior>
3805bd8deadSopenharmony_ci
3815bd8deadSopenharmony_ci    where <behavior> is as specified in section 3.4.
3825bd8deadSopenharmony_ci
3835bd8deadSopenharmony_ci    A new preprocessor #define is added to the OpenGL ES Shading Language:
3845bd8deadSopenharmony_ci
3855bd8deadSopenharmony_ci      #define GL_EXT_blend_func_extended 1
3865bd8deadSopenharmony_ci
3875bd8deadSopenharmony_ci    Modify paragraphs in section 7.2 "Fragment Shader Special Variables" as follows:
3885bd8deadSopenharmony_ci
3895bd8deadSopenharmony_ci    First paragraph, second sentence:
3905bd8deadSopenharmony_ci
3915bd8deadSopenharmony_ci    "Fragment shaders output values to the OpenGL ES pipeline using
3925bd8deadSopenharmony_ci    the built-in variables gl_FragColor, gl_SecondaryFragColorEXT,
3935bd8deadSopenharmony_ci    gl_FragData, and gl_SecondaryFragDataEXT, unless the discard keyword
3945bd8deadSopenharmony_ci    is executed."
3955bd8deadSopenharmony_ci
3965bd8deadSopenharmony_ci    Second paragraph, first sentence:
3975bd8deadSopenharmony_ci
3985bd8deadSopenharmony_ci    "It is not a requirement for the fragment shader to write to
3995bd8deadSopenharmony_ci    either gl_FragColor, gl_SecondaryFragColorEXT, gl_FragData, or
4005bd8deadSopenharmony_ci    gl_SecondaryFragDataEXT."
4015bd8deadSopenharmony_ci
4025bd8deadSopenharmony_ci    Add after the fourth paragraph:
4035bd8deadSopenharmony_ci
4045bd8deadSopenharmony_ci    "Writing to gl_SecondaryFragColorEXT specifies a second fragment color
4055bd8deadSopenharmony_ci    that will be used by the subsequent fixed functionality pipeline for
4065bd8deadSopenharmony_ci    dual source blending. If subsequent fixed functionality consumes the
4075bd8deadSopenharmony_ci    second fragment color and an execution of a fragment shader does
4085bd8deadSopenharmony_ci    not write a value to gl_SecondaryFragColorEXT then the secondary
4095bd8deadSopenharmony_ci    fragment color consumed is undefined."
4105bd8deadSopenharmony_ci
4115bd8deadSopenharmony_ci    Add after the fifth paragraph:
4125bd8deadSopenharmony_ci
4135bd8deadSopenharmony_ci    "The variable gl_SecondaryFragDataEXT is an array. Writing to
4145bd8deadSopenharmony_ci    gl_SecondaryFragDataEXT[n] specifies the secondary fragment data that
4155bd8deadSopenharmony_ci    will be used by the subsequent fixed functionality pipeline for data n
4165bd8deadSopenharmony_ci    for dual source blending. If subsequent fixed functionality consumes
4175bd8deadSopenharmony_ci    secondary fragment data and an execution of a fragment shader does
4185bd8deadSopenharmony_ci    not write a value to it, then the secondary fragment data consumed
4195bd8deadSopenharmony_ci    is undefined."
4205bd8deadSopenharmony_ci
4215bd8deadSopenharmony_ci    Modify the sixth paragraph to read:
4225bd8deadSopenharmony_ci
4235bd8deadSopenharmony_ci    "If a shader statically assigns a value to gl_FragColor or
4245bd8deadSopenharmony_ci    gl_SecondaryFragColorEXT, it may not assign a value to any
4255bd8deadSopenharmony_ci    element of gl_FragData or gl_SecondaryFragDataEXT. If a shader
4265bd8deadSopenharmony_ci    statically writes a value to any element of gl_FragData or
4275bd8deadSopenharmony_ci    gl_SecondaryFragDataEXT, it may not assign a value to gl_FragColor
4285bd8deadSopenharmony_ci    or gl_SecondaryFragColorEXT. That is, a shader may assign values to
4295bd8deadSopenharmony_ci    either the set of gl_FragColor and gl_SecondaryFragColorEXT or the
4305bd8deadSopenharmony_ci    set of gl_FragData and gl_SecondaryFragDataEXT, but not both."
4315bd8deadSopenharmony_ci
4325bd8deadSopenharmony_ci    Modify the eighth paragraph to read:
4335bd8deadSopenharmony_ci
4345bd8deadSopenharmony_ci    "If a shader executes the discard keyword, the fragment is discarded,
4355bd8deadSopenharmony_ci    and the values of gl_FragColor, gl_SecondaryFragColorEXT, gl_FragData,
4365bd8deadSopenharmony_ci    and gl_SecondaryFragDataEXT become irrelevant."
4375bd8deadSopenharmony_ci
4385bd8deadSopenharmony_ci    Add these built-in variable to the list "accessible from a fragment shader":
4395bd8deadSopenharmony_ci
4405bd8deadSopenharmony_ci        mediump vec4 gl_SecondaryFragColorEXT;
4415bd8deadSopenharmony_ci        mediump vec4 gl_SecondaryFragDataEXT[gl_MaxDualSourceDrawBuffersEXT];
4425bd8deadSopenharmony_ci
4435bd8deadSopenharmony_ci    Add to section 7.4 "Built-In Constants" the following constant:
4445bd8deadSopenharmony_ci
4455bd8deadSopenharmony_ci        const mediump int gl_MaxDualSourceDrawBuffersEXT = 1;
4465bd8deadSopenharmony_ci
4475bd8deadSopenharmony_ciAdditions to the OpenGL ES Shading Language 3.00 and 3.10 Specification
4485bd8deadSopenharmony_ci
4495bd8deadSopenharmony_ci    Including the following line in a shader can be used to control the
4505bd8deadSopenharmony_ci    language features described in this extension:
4515bd8deadSopenharmony_ci
4525bd8deadSopenharmony_ci      #extension GL_EXT_blend_func_extended : <behavior>
4535bd8deadSopenharmony_ci
4545bd8deadSopenharmony_ci    where <behavior> is as specified in section 3.4.
4555bd8deadSopenharmony_ci
4565bd8deadSopenharmony_ci    A new preprocessor #define is added to the OpenGL ES Shading Language:
4575bd8deadSopenharmony_ci
4585bd8deadSopenharmony_ci      #define GL_EXT_blend_func_extended 1
4595bd8deadSopenharmony_ci
4605bd8deadSopenharmony_ci    Modify section 4.4.2 "Output Layout Qualifiers":
4615bd8deadSopenharmony_ci
4625bd8deadSopenharmony_ci    Change the second paragraph to read:
4635bd8deadSopenharmony_ci
4645bd8deadSopenharmony_ci    "Fragment shaders allow output layout qualifiers only on the interface
4655bd8deadSopenharmony_ci    qualifier out. The layout qualifier identifier for fragment shader
4665bd8deadSopenharmony_ci    outputs is:
4675bd8deadSopenharmony_ci
4685bd8deadSopenharmony_ci        layout-qualifier-id
4695bd8deadSopenharmony_ci            location = integer-constant
4705bd8deadSopenharmony_ci            index = integer-constant
4715bd8deadSopenharmony_ci
4725bd8deadSopenharmony_ci    Each of these qualifiers may appear at most once. If index is
4735bd8deadSopenharmony_ci    specified, location must also be specified.  If index is not
4745bd8deadSopenharmony_ci    specified, the value 0 is used."
4755bd8deadSopenharmony_ci
4765bd8deadSopenharmony_ci    Add an additional example to the end of the fourth paragraph's example:
4775bd8deadSopenharmony_ci
4785bd8deadSopenharmony_ci    "And,
4795bd8deadSopenharmony_ci
4805bd8deadSopenharmony_ci        layout(location = 3, index = 1) out vec4 factor;
4815bd8deadSopenharmony_ci
4825bd8deadSopenharmony_ci    will establish that the fragment shader output factor is copied out
4835bd8deadSopenharmony_ci    to fragment color 3 as the second (index one) input to the blend
4845bd8deadSopenharmony_ci    equation."
4855bd8deadSopenharmony_ci
4865bd8deadSopenharmony_ci    Change the first sentence of the second to last paragraph to read:
4875bd8deadSopenharmony_ci
4885bd8deadSopenharmony_ci    "If there is more than one fragment output, the location must
4895bd8deadSopenharmony_ci    be specified for all outputs unless the EXT_blend_func_extended
4905bd8deadSopenharmony_ci    extension is enabled in which case more than one unassigned fragment
4915bd8deadSopenharmony_ci    output locations are allowed though they must be assigned to unique
4925bd8deadSopenharmony_ci    locations assigned with glBindFragDataLocationIndexedEXT prior to
4935bd8deadSopenharmony_ci    linking."
4945bd8deadSopenharmony_ci
4955bd8deadSopenharmony_ci    Add to section 7.4 "Built-In Constants" the following constant:
4965bd8deadSopenharmony_ci
4975bd8deadSopenharmony_ci        const mediump int gl_MaxDualSourceDrawBuffersEXT = 1;
4985bd8deadSopenharmony_ci
4995bd8deadSopenharmony_ciDependencies on OpenGL ES 3.0
5005bd8deadSopenharmony_ci
5015bd8deadSopenharmony_ci    If OpenGL ES 3.0 or higher is not supported (meaning OpenGL ES 2.0
5025bd8deadSopenharmony_ci    support only), remove all references to the functions:
5035bd8deadSopenharmony_ci
5045bd8deadSopenharmony_ci        BindFragDataLocationIndexedEXT
5055bd8deadSopenharmony_ci        GetFragDataIndexEXT
5065bd8deadSopenharmony_ci        BindFragDataLocationEXT
5075bd8deadSopenharmony_ci        GetProgramResourceLocationIndexEXT
5085bd8deadSopenharmony_ci
5095bd8deadSopenharmony_ci    Also ignore the additions to chapters 7 and 14 and the paragraph in
5105bd8deadSopenharmony_ci    section 15.1.5.Y related to GLSL version 300 es or higher.
5115bd8deadSopenharmony_ci
5125bd8deadSopenharmony_ci    When OpenGL ES 3.0 or higher, the "Additions to the OpenGL ES
5135bd8deadSopenharmony_ci    Shading Language 1.00 Specification" applies to the version 100
5145bd8deadSopenharmony_ci    shading language, but not later versions.
5155bd8deadSopenharmony_ci
5165bd8deadSopenharmony_ciDependencies on OpenGL ES 3.1
5175bd8deadSopenharmony_ci
5185bd8deadSopenharmony_ci    If OpenGL ES 3.1 or higher is not supported (meaning OpenGL ES 3.0
5195bd8deadSopenharmony_ci    or earlier), remove all references to the function
5205bd8deadSopenharmony_ci
5215bd8deadSopenharmony_ci        GetProgramResourceLocationIndexEXT
5225bd8deadSopenharmony_ci
5235bd8deadSopenharmony_ci    because program resource queries are added by ES 3.1.
5245bd8deadSopenharmony_ci
5255bd8deadSopenharmony_ci    Also ignore the additions to chapter 7.
5265bd8deadSopenharmony_ci
5275bd8deadSopenharmony_ciDependencies on EXT_draw_buffers or NV_draw_buffers
5285bd8deadSopenharmony_ci
5295bd8deadSopenharmony_ci    Using dual-source blending functions may consume additional outputs
5305bd8deadSopenharmony_ci    from hardware shading units and therefore can reduce the number
5315bd8deadSopenharmony_ci    of draw buffers that may be attached to a single frame buffer when
5325bd8deadSopenharmony_ci    dual-source blending functions are enabled. In this case, the value
5335bd8deadSopenharmony_ci    of MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT may be less than the value of
5345bd8deadSopenharmony_ci    MAX_DRAW_BUFFERS_EXT. If EXT_draw_buffers or NV_draw_buffers is not
5355bd8deadSopenharmony_ci    supported then the value of MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT must
5365bd8deadSopenharmony_ci    be 1. Furthermore, the discussion in the subsection entitled "Dual
5375bd8deadSopenharmony_ci    Source Blending and Multiple Draw Buffers" may be discarded.
5385bd8deadSopenharmony_ci
5395bd8deadSopenharmony_ciDependencies on EXT_draw_buffers_indexed
5405bd8deadSopenharmony_ci
5415bd8deadSopenharmony_ci    If EXT_draw_buffers_indexed is not supported, all references to
5425bd8deadSopenharmony_ci    BlendFunciEXT and BlendFuncSeparateiEXT should be removed. In this
5435bd8deadSopenharmony_ci    case, the blend functions for all attached draw buffers will be the
5445bd8deadSopenharmony_ci    same.
5455bd8deadSopenharmony_ci
5465bd8deadSopenharmony_ciErrors
5475bd8deadSopenharmony_ci
5485bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated by Begin or any
5495bd8deadSopenharmony_ci    procedure that implicitly calls Begin if any draw buffer has a
5505bd8deadSopenharmony_ci    blend function requiring the second color input (SRC1_COLOR_EXT,
5515bd8deadSopenharmony_ci    ONE_MINUS_SRC1_COLOR_EXT, SRC1_ALPHA_EXT or ONE_MINUS_SRC1_ALPHA_EXT),
5525bd8deadSopenharmony_ci    and a framebuffer is bound that has more than the value of
5535bd8deadSopenharmony_ci    MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT-1 active color attachments.
5545bd8deadSopenharmony_ci
5555bd8deadSopenharmony_ciNew State
5565bd8deadSopenharmony_ci
5575bd8deadSopenharmony_ci    None
5585bd8deadSopenharmony_ci
5595bd8deadSopenharmony_ci    While no changes to table 20.12 (Pixel Operations) are strictly
5605bd8deadSopenharmony_ci    necessary, new enumerations are supported for the BLEND_SRC_RGB,
5615bd8deadSopenharmony_ci    BLEND_SRC_ALPHA, BLEND_DST_RGB, and BLEND_DST_ALPHA state to support
5625bd8deadSopenharmony_ci    SRC1_COLOR_EXT, SRC1_ALPHA_EXT, ONE_MINUS_SRC1_COLOR_EXT, and
5635bd8deadSopenharmony_ci    ONE_MINUS_SRC1_ALPHA_EXT (and for ES 2.0, SRC_ALPHA_SATURATE_EXT).
5645bd8deadSopenharmony_ci
5655bd8deadSopenharmony_ciNew Implementation Dependent State
5665bd8deadSopenharmony_ci
5675bd8deadSopenharmony_ci    Get Value                        Type  Get Command     Minimum Value    Description             Sec.
5685bd8deadSopenharmony_ci    ---------                        ----  -----------     -------------    -------------------     ------
5695bd8deadSopenharmony_ci    MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT Z+    GetIntegerv     1                Maximum number of       15.1.5
5705bd8deadSopenharmony_ci                                                                            active draw buffers
5715bd8deadSopenharmony_ci                                                                            when using dual-source
5725bd8deadSopenharmony_ci                                                                            blending
5735bd8deadSopenharmony_ci
5745bd8deadSopenharmony_ciExample Use Cases
5755bd8deadSopenharmony_ci
5765bd8deadSopenharmony_ci    There are several potential uses for this functionality. A first
5775bd8deadSopenharmony_ci    example is in the implementation of sub-pixel accurate font rendering
5785bd8deadSopenharmony_ci    algorithms.  Given a known layout of pixel elements (red, green
5795bd8deadSopenharmony_ci    and blue components), coverage may be calculated independently for
5805bd8deadSopenharmony_ci    each element and passed to the blender in the second source color
5815bd8deadSopenharmony_ci    as a per-channel opacity. To use this mode, use the following blend
5825bd8deadSopenharmony_ci    functions:
5835bd8deadSopenharmony_ci
5845bd8deadSopenharmony_ci        glBlendFunc(GL_SRC1_COLOR_EXT, GL_ONE_MINUS_SRC1_COLOR_EXT);
5855bd8deadSopenharmony_ci
5865bd8deadSopenharmony_ci    As a second example, consider a partially reflective colored glass
5875bd8deadSopenharmony_ci    window.  It will attenuate light passing through it, and reflect
5885bd8deadSopenharmony_ci    some of the light that strikes it. Using an appropriate combination
5895bd8deadSopenharmony_ci    of functions, this effect may be simulated in a single pass using
5905bd8deadSopenharmony_ci    only fixed-function blending hardware. In this case, the following
5915bd8deadSopenharmony_ci    blend functions may be used:
5925bd8deadSopenharmony_ci
5935bd8deadSopenharmony_ci        glBlendFunc(GL_SRC_ALPHA, GL_SRC1_COLOR_EXT);
5945bd8deadSopenharmony_ci
5955bd8deadSopenharmony_ciIssues
5965bd8deadSopenharmony_ci
5975bd8deadSopenharmony_ci    0.  What should this extension be named?
5985bd8deadSopenharmony_ci
5995bd8deadSopenharmony_ci    RESOLVED:  EXT_blend_func_extended, matching the name of
6005bd8deadSopenharmony_ci    ARB_blend_func_extended upon which this extension is based but
6015bd8deadSopenharmony_ci    providing a multi-vendor extension for ES implementations.
6025bd8deadSopenharmony_ci
6035bd8deadSopenharmony_ci    1.  Is this extension compatible with the ARB_blend_func_extended
6045bd8deadSopenharmony_ci    version?
6055bd8deadSopenharmony_ci
6065bd8deadSopenharmony_ci    RESOLVED:  Yes.  This extension is 100% functionally identical to
6075bd8deadSopenharmony_ci    ARB_blend_func_extended but for the ES 2.x and 3.x APIs.
6085bd8deadSopenharmony_ci
6095bd8deadSopenharmony_ci    The token values are _EXT suffixed but have the same values as
6105bd8deadSopenharmony_ci    the ARB_blend_func_extended tokens.
6115bd8deadSopenharmony_ci
6125bd8deadSopenharmony_ci    Philosophically if this extension is going for 100% parity and
6135bd8deadSopenharmony_ci    functionality with ARB_blend_func_extended, it should simply add
6145bd8deadSopenharmony_ci    all the stuff in ARB_blend_func_extended...
6155bd8deadSopenharmony_ci
6165bd8deadSopenharmony_ci    2.  Should the next commands be EXT suffixed?
6175bd8deadSopenharmony_ci
6185bd8deadSopenharmony_ci    RESOLVED:  Yes.  This is not an OES extension.
6195bd8deadSopenharmony_ci
6205bd8deadSopenharmony_ci    This means source code coming from a desktop environment should
6215bd8deadSopenharmony_ci    call eglGetProcAddress on function names with the EXT suffix.
6225bd8deadSopenharmony_ci    However because extension functions are called through function
6235bd8deadSopenharmony_ci    pointers, this is only a minor change isolated to function pointer
6245bd8deadSopenharmony_ci    initialization.
6255bd8deadSopenharmony_ci
6265bd8deadSopenharmony_ci    2.  Should this extension allow ES 2.0 contexts to use
6275bd8deadSopenharmony_ci    GL_SRC_ALPHA_SATURATE for the destination blend function?
6285bd8deadSopenharmony_ci
6295bd8deadSopenharmony_ci    RESOLVED:  Yes, the ARB_blend_func_extended extension adds support
6305bd8deadSopenharmony_ci    for using GL_SRC_ALPHA_SATURATE as the destination factor as "bonus"
6315bd8deadSopenharmony_ci    functionality.
6325bd8deadSopenharmony_ci
6335bd8deadSopenharmony_ci    ES 3.x already allows GL_SRC_ALPHA_SATURATE for the destination
6345bd8deadSopenharmony_ci    factor so this additional functionality is new only to ES 2.0 contexts
6355bd8deadSopenharmony_ci    supporting this extension.
6365bd8deadSopenharmony_ci
6375bd8deadSopenharmony_ci    We expect no GPU hardware capable of dual-source blending to not
6385bd8deadSopenharmony_ci    also support GL_SRC_ALPHA_SATURATE as the destination factor.
6395bd8deadSopenharmony_ci
6405bd8deadSopenharmony_ci    3.  Should this extension provide the glBindFragDataLocation and
6415bd8deadSopenharmony_ci    glBindFragDataLocationIndexed functionality?
6425bd8deadSopenharmony_ci
6435bd8deadSopenharmony_ci    RESOLVED:  Yes.  With EXT suffixes.
6445bd8deadSopenharmony_ci
6455bd8deadSopenharmony_ci    4.  Should this really be OES_blend_func_extended?
6465bd8deadSopenharmony_ci
6475bd8deadSopenharmony_ci    RESOLVED:  Go with EXT is for expediency.
6485bd8deadSopenharmony_ci
6495bd8deadSopenharmony_ci    Additionally this extension supports functionality such
6505bd8deadSopenharmony_ci    GL_SRC_ALPHA_SATURATE that all desktop GPU hardware is assumed to
6515bd8deadSopenharmony_ci    have.  ES-only vendors might not want this in an OES extension.
6525bd8deadSopenharmony_ci
6535bd8deadSopenharmony_ci    The same could be said for the glBindFragDataLocation* functionality.
6545bd8deadSopenharmony_ci
6555bd8deadSopenharmony_ci    5.  Does this extension need an interaction with
6565bd8deadSopenharmony_ci    OES_blend_equation_separate?
6575bd8deadSopenharmony_ci
6585bd8deadSopenharmony_ci    RESOLVED:  No, that's an ES 1.1 extension.  ES 2.0 and on all support
6595bd8deadSopenharmony_ci    separate blend functions.
6605bd8deadSopenharmony_ci
6615bd8deadSopenharmony_ci    6.  Are there any OpenGL ES Shading Language interactions?
6625bd8deadSopenharmony_ci
6635bd8deadSopenharmony_ci    RESOLVED: Yes, to use this extension, a #extension line will be needed
6645bd8deadSopenharmony_ci    in the shader requesting the EXT_blend_func_extended functionality.
6655bd8deadSopenharmony_ci    Example:
6665bd8deadSopenharmony_ci
6675bd8deadSopenharmony_ci        #extension GL_EXT_blend_func_extended : require
6685bd8deadSopenharmony_ci
6695bd8deadSopenharmony_ci    The ARB_blend_func_extended functionality does NOT require a special
6705bd8deadSopenharmony_ci    #extension line to use its functionality because the ARB version
6715bd8deadSopenharmony_ci    relies on existing GLSL functionality that allows for multiple
6725bd8deadSopenharmony_ci    fragment outputs as part of supporting multiple render targets.
6735bd8deadSopenharmony_ci    In the ARB version, then glBindFragDataLocationIndexed can bind
6745bd8deadSopenharmony_ci    these unassigned locations to different source output colors.
6755bd8deadSopenharmony_ci    But GLSL OpenGL ES 3.00 and 3.10 both explicitly preclude more than
6765bd8deadSopenharmony_ci    one fragment shader output with an unassigned location.  Hence a
6775bd8deadSopenharmony_ci    #extension is needed to relax this error condition.  And then this
6785bd8deadSopenharmony_ci    extension's glBindFragDataLocationIndexedEXT must be used to assign
6795bd8deadSopenharmony_ci    locations as necessary.
6805bd8deadSopenharmony_ci
6815bd8deadSopenharmony_ci    7.  Can the indexed location be assigned explicitly in the shader?
6825bd8deadSopenharmony_ci
6835bd8deadSopenharmony_ci    RESOLVED:  Yes, for ES 3.x shaders where the GLSL ES 3.x supports
6845bd8deadSopenharmony_ci    layout qualifiers.  ES 2.0 does not support the layout qualifier or
6855bd8deadSopenharmony_ci    user-defined fragment outputs.
6865bd8deadSopenharmony_ci
6875bd8deadSopenharmony_ci    8.  Should both the layout qualifier mechanism and the
6885bd8deadSopenharmony_ci    glBindFragDataLocationIndexed-style API for specifying the index of
6895bd8deadSopenharmony_ci    a user-defined fragment shader output be supported?
6905bd8deadSopenharmony_ci
6915bd8deadSopenharmony_ci    RESOLVED:  Yes, both should be supported.  This makes it easier
6925bd8deadSopenharmony_ci    for existing applications to port to ES 3.0 as both mechanisms are
6935bd8deadSopenharmony_ci    available.
6945bd8deadSopenharmony_ci
6955bd8deadSopenharmony_ci    FYI: The "layout(location=0,index=1)" type syntax for dual-source
6965bd8deadSopenharmony_ci    blending was introduced to OpenGL in GLSL 3.30 and 4.00 in
6975bd8deadSopenharmony_ci    conjunction with OpenGL 3.3 and 4.0 respectively.  The original
6985bd8deadSopenharmony_ci    ARB_blend_func_extended was written with respect to OpenGL 3.2 and
6995bd8deadSopenharmony_ci    intended to support dual-source blending without the need to extend
7005bd8deadSopenharmony_ci    the GLSL language by instead supporting assignment if the fragment
7015bd8deadSopenharmony_ci    output index via glBindFragDataLocationIndexed.
7025bd8deadSopenharmony_ci
7035bd8deadSopenharmony_ci    9.  How to support OpenGL ES 2.0 where user-defined fragment shader
7045bd8deadSopenharmony_ci    outputs are not supported?
7055bd8deadSopenharmony_ci
7065bd8deadSopenharmony_ci    RESOLVED:  Introduce new gl_SecondaryFragColorEXT and
7075bd8deadSopenharmony_ci    gl_SecondaryFragDataEXT built-in variables for specifying the second
7085bd8deadSopenharmony_ci    source color.
7095bd8deadSopenharmony_ci
7105bd8deadSopenharmony_ci    These built-ins are only available in the ES 1.00 shader language
7115bd8deadSopenharmony_ci    version.
7125bd8deadSopenharmony_ci
7135bd8deadSopenharmony_ci    It is important to provide an ES 2.0 mechanism because WebGL 1.0 is
7145bd8deadSopenharmony_ci    based on ES 2.0.  Chrome's internal command buffer mechanism is also
7155bd8deadSopenharmony_ci    based around ES 2.0 and Skia intends to use this extension.
7165bd8deadSopenharmony_ci
7175bd8deadSopenharmony_ci    This includes adding a gl_MaxDualSourceDrawBuffersEXT
7185bd8deadSopenharmony_ci    implementation-dependent constant.
7195bd8deadSopenharmony_ci
7205bd8deadSopenharmony_ci    10. Does the version 100 syntax (gl_SecondaryFragColorEXT,
7215bd8deadSopenharmony_ci    gl_SecondaryFragDataEXT) work in an ES 3.0 context?
7225bd8deadSopenharmony_ci
7235bd8deadSopenharmony_ci    RESOLVED:  Yes.  For compatibility reasons, an ES 3.0 context
7245bd8deadSopenharmony_ci    advertising EXT_blend_func_extended must support the built-ins for
7255bd8deadSopenharmony_ci    the fragment shader secondary color outputs.
7265bd8deadSopenharmony_ci
7275bd8deadSopenharmony_ci    11. How many elements should be in the gl_SecondaryFragDataEXT array?
7285bd8deadSopenharmony_ci
7295bd8deadSopenharmony_ci    RESOLVED: The gl_SecondaryFragDataEXT array should have as
7305bd8deadSopenharmony_ci    many elements as the GLSL built-in implementation constant
7315bd8deadSopenharmony_ci    gl_MaxDualSourceDrawBuffersEXT which should be the value of the
7325bd8deadSopenharmony_ci    context's GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT implementation-dependent
7335bd8deadSopenharmony_ci    constant.
7345bd8deadSopenharmony_ci
7355bd8deadSopenharmony_ci    This means the number of elements in gl_SecondaryFragDataEXT is
7365bd8deadSopenharmony_ci    different than the number of gl_FragData elements.
7375bd8deadSopenharmony_ci
7385bd8deadSopenharmony_ci    12. What precision should the gl_SecondaryFragColorEXT and
7395bd8deadSopenharmony_ci    gl_SecondaryFragDataEXT be?
7405bd8deadSopenharmony_ci
7415bd8deadSopenharmony_ci    RESOLVED:  mediump.  This is consistent with gl_FragColor and
7425bd8deadSopenharmony_ci    gl_FragData.
7435bd8deadSopenharmony_ci
7445bd8deadSopenharmony_ci    13. Should gl_MaxDualSourceDrawBuffersEXT be exposed in both ES 2.0
7455bd8deadSopenharmony_ci    (where it sizes the gl_SecondaryFragDataEXT array) and also 3.x
7465bd8deadSopenharmony_ci    contexts (where there is no fixed-function array)?
7475bd8deadSopenharmony_ci
7485bd8deadSopenharmony_ci    RESOLVED:  Implementation-wise, it is easiest to expose this
7495bd8deadSopenharmony_ci    implementation-dependent constant for all ES contexts.
7505bd8deadSopenharmony_ci
7515bd8deadSopenharmony_ci    As a practical matter, we don't expect any implementations will
7525bd8deadSopenharmony_ci    advertise any value other than 1 for this constant.
7535bd8deadSopenharmony_ci
7545bd8deadSopenharmony_ci    Note:  There is no implementation-dependent GLSL constant comparable
7555bd8deadSopenharmony_ci    to gl_MaxDualSourceDrawBuffersEXT in ARB_blend_func_extended
7565bd8deadSopenharmony_ci    (or OpenGL 3.3/4.0 introducing the ARB_blend_func_extended
7575bd8deadSopenharmony_ci    functionality).
7585bd8deadSopenharmony_ci
7595bd8deadSopenharmony_ci    14. Any more issues?
7605bd8deadSopenharmony_ci
7615bd8deadSopenharmony_ci    RESOLVED:  See the issues in the ARB_blend_func_extended
7625bd8deadSopenharmony_ci    specification.  This extension resolves those issues to match the
7635bd8deadSopenharmony_ci    ARB extension version.
7645bd8deadSopenharmony_ci
7655bd8deadSopenharmony_ciRevision History
7665bd8deadSopenharmony_ci
7675bd8deadSopenharmony_ci    Rev.    Date    Author     Changes
7685bd8deadSopenharmony_ci    ----  --------  ---------  -----------------------------------------
7695bd8deadSopenharmony_ci     1    05/22/15  mjk        Initial revision.
7705bd8deadSopenharmony_ci     2    07/06/15  mjk        Proper ES 2.0 interactions; complete.
7715bd8deadSopenharmony_ci     3    07/08/15  mjk        Feedback from Brian
7725bd8deadSopenharmony_ci     4    07/08/15  mjk        Feedback from Daniel
7735bd8deadSopenharmony_ci     5    07/29/15  mjk        ES 3.x contexts (as well as 2.0) expose
7745bd8deadSopenharmony_ci                               gl_MaxDualSourceDrawBuffersEXT
7755bd8deadSopenharmony_ci     6    08/25/15  mjk        Update status
776