15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    ARB_draw_buffers_blend
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_ARB_draw_buffers_blend
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Jeff Bolz, NVIDIA Corporation (jbolz 'at' nvidia.com)
125bd8deadSopenharmony_ci    Mark Young, AMD (mark.young 'at' amd.com)
135bd8deadSopenharmony_ci
145bd8deadSopenharmony_ciContributors
155bd8deadSopenharmony_ci
165bd8deadSopenharmony_ci    Jeff Bolz, NVIDIA
175bd8deadSopenharmony_ci    Pierre Boudier, AMD
185bd8deadSopenharmony_ci    Nick Haemel, AMD
195bd8deadSopenharmony_ci    Timothy Lamb, AMD
205bd8deadSopenharmony_ci    Greg Roth, NVIDIA
215bd8deadSopenharmony_ci    Graham Sellers, AMD
225bd8deadSopenharmony_ci    Mike Strauss, NVIDIA
235bd8deadSopenharmony_ci    Mark Young, AMD
245bd8deadSopenharmony_ci
255bd8deadSopenharmony_ciNotice
265bd8deadSopenharmony_ci
275bd8deadSopenharmony_ci    Copyright (c) 2009-2013 The Khronos Group Inc. Copyright terms at
285bd8deadSopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
295bd8deadSopenharmony_ci
305bd8deadSopenharmony_ciSpecification Update Policy
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ci    Khronos-approved extension specifications are updated in response to
335bd8deadSopenharmony_ci    issues and bugs prioritized by the Khronos OpenGL Working Group. For
345bd8deadSopenharmony_ci    extensions which have been promoted to a core Specification, fixes will
355bd8deadSopenharmony_ci    first appear in the latest version of that core Specification, and will
365bd8deadSopenharmony_ci    eventually be backported to the extension document. This policy is
375bd8deadSopenharmony_ci    described in more detail at
385bd8deadSopenharmony_ci        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
395bd8deadSopenharmony_ci
405bd8deadSopenharmony_ciStatus
415bd8deadSopenharmony_ci
425bd8deadSopenharmony_ci    Complete. Approved by the ARB on July 3, 2009.
435bd8deadSopenharmony_ci
445bd8deadSopenharmony_ciVersion
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ci    Last Modified Date:         01/19/2011
475bd8deadSopenharmony_ci    Revision:                   4
485bd8deadSopenharmony_ci
495bd8deadSopenharmony_ciNumber
505bd8deadSopenharmony_ci
515bd8deadSopenharmony_ci    ARB Extension #69
525bd8deadSopenharmony_ci
535bd8deadSopenharmony_ciDependencies
545bd8deadSopenharmony_ci
555bd8deadSopenharmony_ci    The extension is written against the OpenGL 2.0 Specification.
565bd8deadSopenharmony_ci
575bd8deadSopenharmony_ci    OpenGL 2.0 is required.
585bd8deadSopenharmony_ci
595bd8deadSopenharmony_ci    EXT_draw_buffers2 is required.
605bd8deadSopenharmony_ci
615bd8deadSopenharmony_ciOverview
625bd8deadSopenharmony_ci
635bd8deadSopenharmony_ci    This extension builds upon the ARB_draw_buffers and
645bd8deadSopenharmony_ci    EXT_draw_buffers2 extensions. In ARB_draw_buffers (part of OpenGL
655bd8deadSopenharmony_ci    2.0), separate values could be written to each color buffer. This
665bd8deadSopenharmony_ci    was further enhanced by EXT_draw_buffers2 by adding in the ability
675bd8deadSopenharmony_ci    to enable blending and to set color write masks independently per
685bd8deadSopenharmony_ci    color output.
695bd8deadSopenharmony_ci
705bd8deadSopenharmony_ci    This extension provides the ability to set individual blend
715bd8deadSopenharmony_ci    equations and blend functions for each color output.
725bd8deadSopenharmony_ci
735bd8deadSopenharmony_ciNew Procedures and Functions
745bd8deadSopenharmony_ci
755bd8deadSopenharmony_ci    void BlendEquationiARB(uint buf, enum mode);
765bd8deadSopenharmony_ci
775bd8deadSopenharmony_ci    void BlendEquationSeparateiARB(uint buf, enum modeRGB,
785bd8deadSopenharmony_ci                                   enum modeAlpha);
795bd8deadSopenharmony_ci
805bd8deadSopenharmony_ci    void BlendFunciARB(uint buf, enum src, enum dst);
815bd8deadSopenharmony_ci
825bd8deadSopenharmony_ci    void BlendFuncSeparateiARB(uint buf, enum srcRGB, enum dstRGB,
835bd8deadSopenharmony_ci                               enum srcAlpha, enum dstAlpha);
845bd8deadSopenharmony_ci
855bd8deadSopenharmony_ciNew Tokens
865bd8deadSopenharmony_ci
875bd8deadSopenharmony_ci    None.
885bd8deadSopenharmony_ci
895bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 2.0 Specification (OpenGL Operation)
905bd8deadSopenharmony_ci
915bd8deadSopenharmony_ci    None.
925bd8deadSopenharmony_ci
935bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization)
945bd8deadSopenharmony_ci
955bd8deadSopenharmony_ci    None.
965bd8deadSopenharmony_ci
975bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 2.0 Specification (Per-Fragment
985bd8deadSopenharmony_ciOperations and the Frame Buffer)
995bd8deadSopenharmony_ci
1005bd8deadSopenharmony_ci    Modify Section 4.1.8, Blending p. 205
1015bd8deadSopenharmony_ci
1025bd8deadSopenharmony_ci    (modify section Blend Equation starting with the first paragraph)
1035bd8deadSopenharmony_ci
1045bd8deadSopenharmony_ci   "Blending is controlled by the blend equation. This equation can be
1055bd8deadSopenharmony_ci    simultaneously set to the same value for all draw buffers using the
1065bd8deadSopenharmony_ci    commands:
1075bd8deadSopenharmony_ci
1085bd8deadSopenharmony_ci       void BlendEquation(enum mode);
1095bd8deadSopenharmony_ci       void BlendEquationSeparate(enum modeRGB, enum modeAlpha);
1105bd8deadSopenharmony_ci
1115bd8deadSopenharmony_ci    or for an individual draw buffer using the indexed versions of the
1125bd8deadSopenharmony_ci    same commands:
1135bd8deadSopenharmony_ci
1145bd8deadSopenharmony_ci        void BlendEquationiARB(uint buf, enum mode);
1155bd8deadSopenharmony_ci        void BlendEquationSeparateiARB(uint buf
1165bd8deadSopenharmony_ci                                       enum modeRGB,
1175bd8deadSopenharmony_ci                                       enum modeAlpha);
1185bd8deadSopenharmony_ci
1195bd8deadSopenharmony_ci    BlendEquationSeparate and BlendEquationSeparateiARB argument
1205bd8deadSopenharmony_ci    <modeRGB> determines the RGB blend equation while <modeAlpha>
1215bd8deadSopenharmony_ci    determines the alpha blend equation. BlendEquation and
1225bd8deadSopenharmony_ci    BlendEquationiARB argument <mode> determines both the RGB and alpha
1235bd8deadSopenharmony_ci    blend equations. <mode>, <modeRGB>, and <modeAlpha> must be one of
1245bd8deadSopenharmony_ci    FUNC_ADD, FUNC_SUBTRACT, FUNC_REVERSE_SUBTRACT, MIN, MAX.
1255bd8deadSopenharmony_ci    BlendEquation and BlendEquationSeparate modify the blend equations
1265bd8deadSopenharmony_ci    for all draw buffers. BlendEquationiARB and
1275bd8deadSopenharmony_ci    BlendEquationSeparateiARB modify the blend equations associated with
1285bd8deadSopenharmony_ci    an individual draw buffer. The <buf> argument is an integer i that
1295bd8deadSopenharmony_ci    indicates that the blend equations should be modified for
1305bd8deadSopenharmony_ci    DRAW_BUFFERi.
1315bd8deadSopenharmony_ci
1325bd8deadSopenharmony_ci    (modify section Blend Functions starting with the first paragraph)
1335bd8deadSopenharmony_ci
1345bd8deadSopenharmony_ci    The weighting factors used by the blend equation are determined by
1355bd8deadSopenharmony_ci    the blend functions. Blend functions are simultaneously specified
1365bd8deadSopenharmony_ci    for all draw buffers using the commands:
1375bd8deadSopenharmony_ci
1385bd8deadSopenharmony_ci        void BlendFunc(enum src, enum dst);
1395bd8deadSopenharmony_ci        void BlendFuncSeparate(enum srcRGB, enum dstRGB,
1405bd8deadSopenharmony_ci                               enum srcAlpha, enum dstAlpha);
1415bd8deadSopenharmony_ci
1425bd8deadSopenharmony_ci    or for an individual draw buffer using the indexed versions of the
1435bd8deadSopenharmony_ci    same commands:
1445bd8deadSopenharmony_ci
1455bd8deadSopenharmony_ci        void BlendFunciARB(uint buf, enum src, enum dst);
1465bd8deadSopenharmony_ci        void BlendFuncSeparateiARB(uint buf, enum srcRGB,
1475bd8deadSopenharmony_ci                                   enum dstRGB, enum srcAlpha,
1485bd8deadSopenharmony_ci                                   enum dstAlpha);
1495bd8deadSopenharmony_ci
1505bd8deadSopenharmony_ci    BlendFuncSeparate and BlendFuncSeparateiARB arguments <srcRGB> and
1515bd8deadSopenharmony_ci    <dstRGB> determine the source and destination RGB blend functions,
1525bd8deadSopenharmony_ci    respectively, while <srcAlpha> and <dstAlpha> determine the source
1535bd8deadSopenharmony_ci    and destination alpha blend functions. BlendFunc and BlendFunciARB
1545bd8deadSopenharmony_ci    argument <src> determines both RGB and alpha source functions, while
1555bd8deadSopenharmony_ci    <dst> determines both RGB and alpha destination functions.
1565bd8deadSopenharmony_ci    BlendFuncSeparate and BlendFunc modify the blend functions for all
1575bd8deadSopenharmony_ci    draw buffers. BlendFuncSeparateiARB and BlendFunciARB modify the
1585bd8deadSopenharmony_ci    blend functions associated with an individual draw buffer. The <buf>
1595bd8deadSopenharmony_ci    argument is an integer i that indicates that the blend equations
1605bd8deadSopenharmony_ci    should be modified for DRAW_BUFFER<i>."
1615bd8deadSopenharmony_ci
1625bd8deadSopenharmony_ci
1635bd8deadSopenharmony_ci    (modify section Blending State)
1645bd8deadSopenharmony_ci
1655bd8deadSopenharmony_ci   "The state required for blending, for each draw buffer, is two
1665bd8deadSopenharmony_ci    integers for the RGB and alpha blend equations, four integers
1675bd8deadSopenharmony_ci    indicating the source and destination RGB and alpha blending
1685bd8deadSopenharmony_ci    functions, and a bit indicating whether blending is enabled or
1695bd8deadSopenharmony_ci    disabled. Additionally, four floating-point values to store the RGBA
1705bd8deadSopenharmony_ci    constant blend color are required.
1715bd8deadSopenharmony_ci
1725bd8deadSopenharmony_ci    For all draw buffers, the initial blend equations for RGB and alpha
1735bd8deadSopenharmony_ci    are both FUNC_ADD, and the initial blending functions are ONE for
1745bd8deadSopenharmony_ci    the source RGB and alpha functions, and ZERO for the destination RGB
1755bd8deadSopenharmony_ci    and alpha functions. Initially, blending is disabled for all draw
1765bd8deadSopenharmony_ci    buffers. The initial constant blend color is (R,G,B,A) = (0,0,0,0).
1775bd8deadSopenharmony_ci
1785bd8deadSopenharmony_ci    The value of the blend enable for draw buffer <i> can be queried by
1795bd8deadSopenharmony_ci    calling IsEnabledi with <target> BLEND and <index> <i>, and the
1805bd8deadSopenharmony_ci    values of the blend equations and functions can be queried by caling
1815bd8deadSopenharmony_ci    GetIntegerIndexedvEXT with the corresponding <target> as shown in
1825bd8deadSopenharmony_ci    table 6.20 and <index> $i$.
1835bd8deadSopenharmony_ci    
1845bd8deadSopenharmony_ci    The value of the blend enable, or the blend equations and functions
1855bd8deadSopenharmony_ci    for draw buffer zero may also be queried by calling IsEnabled, or
1865bd8deadSopenharmony_ci    GetInteger, respectively, with the same symbolic constants but no
1875bd8deadSopenharmony_ci    <index> parameter."
1885bd8deadSopenharmony_ci
1895bd8deadSopenharmony_ci
1905bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 2.0 Specification (Special Functions)
1915bd8deadSopenharmony_ci
1925bd8deadSopenharmony_ci    None.
1935bd8deadSopenharmony_ci
1945bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 2.0 Specification (State and
1955bd8deadSopenharmony_ciState Requests)
1965bd8deadSopenharmony_ci
1975bd8deadSopenharmony_ci    None.
1985bd8deadSopenharmony_ci
1995bd8deadSopenharmony_ciAdditions to Appendix A of the OpenGL 2.0 Specification (Invariance)
2005bd8deadSopenharmony_ci
2015bd8deadSopenharmony_ci    None.
2025bd8deadSopenharmony_ci
2035bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications
2045bd8deadSopenharmony_ci
2055bd8deadSopenharmony_ci    None.
2065bd8deadSopenharmony_ci
2075bd8deadSopenharmony_ciErrors
2085bd8deadSopenharmony_ci
2095bd8deadSopenharmony_ci    The error INVALID_ENUM is generated by BlendEquationiARB,
2105bd8deadSopenharmony_ci    BlendEquationSeparateiARB, BlendFuncSeparateiARB, and
2115bd8deadSopenharmony_ci    BlendFunciARB if the <buf> parameter is outside the range
2125bd8deadSopenharmony_ci    [0, MAX_DRAW_BUFFERS-1].
2135bd8deadSopenharmony_ci
2145bd8deadSopenharmony_ci    The error INVALID_ENUM is generated by GetIntegerIndexedvEXT
2155bd8deadSopenharmony_ci    if <target> is BLEND_EQUATION, BLEND_EQUATION_RGB,
2165bd8deadSopenharmony_ci    BLEND_EQUATION_ALPHA, BLEND_SRC, BLEND_SRC_RGB, BLEND_SRC_ALPHA,
2175bd8deadSopenharmony_ci    BLEND_DST, BLEND_DST_RGB, BLEND_DST_ALPHA, and <index> is outside
2185bd8deadSopenharmony_ci    the range [0, MAX_DRAW_BUFFERS-1].
2195bd8deadSopenharmony_ci
2205bd8deadSopenharmony_ci    The error INVALID_ENUM is generated by BlendFunciARB
2215bd8deadSopenharmony_ci    if either <src>, or <dst> is not an accepted value.
2225bd8deadSopenharmony_ci
2235bd8deadSopenharmony_ci    The error INVALID_ENUM is generated by BlendFuncSeparateiARB
2245bd8deadSopenharmony_ci    if either <srcRGB>, <dstRGB>, <srcAlpha>, or <dstAlpha> is not
2255bd8deadSopenharmony_ci    an accepted value.
2265bd8deadSopenharmony_ci
2275bd8deadSopenharmony_ci    The error INVALID_ENUM is generated if the <mode> parameter of
2285bd8deadSopenharmony_ci    BlendEquationiARB is not one of FUNC_ADD, FUNC_SUBTRACT,
2295bd8deadSopenharmony_ci    FUNC_REVERSE_SUBTRACT, MAX, or MIN.
2305bd8deadSopenharmony_ci
2315bd8deadSopenharmony_ci    The error INVALID_ENUM is generated if either the <modeRGB> or
2325bd8deadSopenharmony_ci    <modeAlpha> parameter of BlendEquationSeparateiARB is not one of
2335bd8deadSopenharmony_ci    FUNC_ADD, FUNC_SUBTRACT, FUNC_REVERSE_SUBTRACT, MAX, or MIN.
2345bd8deadSopenharmony_ci
2355bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if any of these new
2365bd8deadSopenharmony_ci    entry-points are executed between the execution of glBegin and the
2375bd8deadSopenharmony_ci    corresponding execution of glEnd.
2385bd8deadSopenharmony_ci
2395bd8deadSopenharmony_ci
2405bd8deadSopenharmony_ciNew State
2415bd8deadSopenharmony_ci
2425bd8deadSopenharmony_ci    Modify Table 6.20, p. 281
2435bd8deadSopenharmony_ci
2445bd8deadSopenharmony_ci    (modify the entries for the blend functions and equations and add
2455bd8deadSopenharmony_ci    new entries for indexed access to the per draw buffer functions
2465bd8deadSopenharmony_ci    and equations)
2475bd8deadSopenharmony_ci
2485bd8deadSopenharmony_ci
2495bd8deadSopenharmony_ci                                                                         Initial
2505bd8deadSopenharmony_ci    Get Target                           Type      Get Command           Value    Description                                          Section Attribute
2515bd8deadSopenharmony_ci    -----------------------------------  --------- --------------------- -------- ---------------------------------------------------- ------- -------------
2525bd8deadSopenharmony_ci    BLEND_SRC_RGB (BLEND_SRC)            1* x Z_15 GetIntegerIndexedvEXT ONE      Blending source RGB function for draw buffer i       4.2.2   color-buffer
2535bd8deadSopenharmony_ci                                                                                  where i is specified as <index>
2545bd8deadSopenharmony_ci    BLEND_SRC_ALPHA                      1* x Z_15 GetIntegerIndexedvEXT ONE      Blending source A function for draw buffer i         4.2.2   color-buffer
2555bd8deadSopenharmony_ci                                                                                  where i is specified as <index>
2565bd8deadSopenharmony_ci    BLEND_DST_RGB (BLEND_DST)            1* x Z_14 GetIntegerIndexedvEXT ZERO     Blending destination RGB function for draw buffer i  4.2.2   color-buffer
2575bd8deadSopenharmony_ci                                                                                  where i is specified as <index>
2585bd8deadSopenharmony_ci    BLEND_DST_ALPHA                      1* x Z_14 GetIntegerIndexedvEXT ZERO     Blending destination A function for draw buffer i    4.2.2   color-buffer
2595bd8deadSopenharmony_ci                                                                                  where i is specified as <index>
2605bd8deadSopenharmony_ci    BLEND_EQUATION_RGB (BLEND_EQUATION)  1* x Z    GetIntegerIndexedvEXT FUNC_ADD RGB blending equation for draw buffer i              4.2.2   color-buffer
2615bd8deadSopenharmony_ci                                                                                  where i is specified as <index>
2625bd8deadSopenharmony_ci    BLEND_EQUATION_ALPHA                 1* x Z    GetIntegerIndexedvEXT FUNC_ADD Alpha blending equation for draw buffer i            4.2.2   color-buffer
2635bd8deadSopenharmony_ci                                                                                  where i is specified as <index>
2645bd8deadSopenharmony_ci
2655bd8deadSopenharmony_ciIssues
2665bd8deadSopenharmony_ci
2675bd8deadSopenharmony_ci    1.  What should we call this?
2685bd8deadSopenharmony_ci
2695bd8deadSopenharmony_ci        RESOLVED: ARB_draw_buffers_blend.
2705bd8deadSopenharmony_ci
2715bd8deadSopenharmony_ci        Other suggestions were ARB_drawbuffers_blend and ARB_mrt_blend.
2725bd8deadSopenharmony_ci
2735bd8deadSopenharmony_ci    2. What effect does using the non-indexed versions of the blend
2745bd8deadSopenharmony_ci       function or equation entry-points have upon the new indexed per
2755bd8deadSopenharmony_ci       draw buffer versions?
2765bd8deadSopenharmony_ci
2775bd8deadSopenharmony_ci        RESOLVED: Similar to the way EXT_draw_buffers2 handles the
2785bd8deadSopenharmony_ci        indexed and non-indexed ColorMask interaction in issue 3. The
2795bd8deadSopenharmony_ci        non-indexed versions of the functions will set all buffers to
2805bd8deadSopenharmony_ci        the passed in parameters.
2815bd8deadSopenharmony_ci
2825bd8deadSopenharmony_ci        For example, BlendFunc will set all color buffer blend functions
2835bd8deadSopenharmony_ci        to the values passed in.
2845bd8deadSopenharmony_ci
2855bd8deadSopenharmony_ci    3. Should the new functions be ---Indexed (as in EXT_draw_buffers2)
2865bd8deadSopenharmony_ci       or ---i (as in OpenGL 3.0 core)?
2875bd8deadSopenharmony_ci
2885bd8deadSopenharmony_ci        RESOLVED: Because this is to be promoted to core, the i index is
2895bd8deadSopenharmony_ci        used
2905bd8deadSopenharmony_ci
2915bd8deadSopenharmony_ciRevision History
2925bd8deadSopenharmony_ci
2935bd8deadSopenharmony_ci    Rev.    Date    Author     Changes
2945bd8deadSopenharmony_ci    ----  -------- ---------  -----------------------------------------
2955bd8deadSopenharmony_ci      4   1/19/11  Jon Leech  Fix GetIntegeri_v -> GetIntegerIndexedi_v
2965bd8deadSopenharmony_ci                              (Bug 7229).
2975bd8deadSopenharmony_ci      3   2/11/10  Jon Leech  Clarify in required state section that
2985bd8deadSopenharmony_ci                              the constant blend color is global,
2995bd8deadSopenharmony_ci                              not per-draw-buffer. Remove duplicate
3005bd8deadSopenharmony_ci                              state for draw buffer zero from state
3015bd8deadSopenharmony_ci                              tables and describe how non-indexed
3025bd8deadSopenharmony_ci                              queries access it from required state
3035bd8deadSopenharmony_ci                              section (Bug 5920).
3045bd8deadSopenharmony_ci      2   8/02/09  Jon Leech  Reformat to 80 columns and assign
3055bd8deadSopenharmony_ci                              ARB extension number.
3065bd8deadSopenharmony_ci      1   5/14/09  jbolz      copy & rename from EXT version rev 5.
3075bd8deadSopenharmony_ci
308