15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci EXT_blend_equation_separate 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_EXT_blend_equation_separate 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Mark Kilgard, NVIDIA Corporation (mjk 'at' nvidia.com) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciNotice 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci Copyright NVIDIA Corporation, 2003. 165bd8deadSopenharmony_ci 175bd8deadSopenharmony_ciVersion 185bd8deadSopenharmony_ci 195bd8deadSopenharmony_ci Date: 12/23/2003 Version 1.0 205bd8deadSopenharmony_ci 215bd8deadSopenharmony_ciStatus 225bd8deadSopenharmony_ci 235bd8deadSopenharmony_ci Shipping as of May 2004 for GeForce6. 245bd8deadSopenharmony_ci 255bd8deadSopenharmony_ciNumber 265bd8deadSopenharmony_ci 275bd8deadSopenharmony_ci 299 285bd8deadSopenharmony_ci 295bd8deadSopenharmony_ciDependencies 305bd8deadSopenharmony_ci 315bd8deadSopenharmony_ci Written based on the wording of the OpenGL 1.5 specification. 325bd8deadSopenharmony_ci 335bd8deadSopenharmony_ci OpenGL 1.4 (or ARB_imaging, or EXT_blend_minmax and/or 345bd8deadSopenharmony_ci EXT_blend_subtract) is required for blend equation support. 355bd8deadSopenharmony_ci 365bd8deadSopenharmony_ci EXT_blend_func_separate is presumed but not required. 375bd8deadSopenharmony_ci 385bd8deadSopenharmony_ci EXT_blend_logic_op interacts with this extension. 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ciOverview 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ci EXT_blend_func_separate introduced separate RGB and alpha blend 435bd8deadSopenharmony_ci factors. EXT_blend_minmax introduced a distinct blend equation for 445bd8deadSopenharmony_ci combining source and destination blend terms. (EXT_blend_subtract & 455bd8deadSopenharmony_ci EXT_blend_logic_op added other blend equation modes.) OpenGL 1.4 465bd8deadSopenharmony_ci integrated both functionalities into the core standard. 475bd8deadSopenharmony_ci 485bd8deadSopenharmony_ci While there are separate blend functions for the RGB and alpha blend 495bd8deadSopenharmony_ci factors, OpenGL 1.4 provides a single blend equation that applies 505bd8deadSopenharmony_ci to both RGB and alpha portions of blending. 515bd8deadSopenharmony_ci 525bd8deadSopenharmony_ci This extension provides a separate blend equation for RGB and alpha 535bd8deadSopenharmony_ci to match the generality available for blend factors. 545bd8deadSopenharmony_ci 555bd8deadSopenharmony_ciIP Status 565bd8deadSopenharmony_ci 575bd8deadSopenharmony_ci No known IP issues. 585bd8deadSopenharmony_ci 595bd8deadSopenharmony_ciIssues 605bd8deadSopenharmony_ci 615bd8deadSopenharmony_ci Why not use ATI_blend_equation_separate? 625bd8deadSopenharmony_ci 635bd8deadSopenharmony_ci Apple supports this extension in OS X 10.2 but the extension 645bd8deadSopenharmony_ci lacks a specification and, as explained in subsequent issues, 655bd8deadSopenharmony_ci the token naming is inconsistent with OpenGL conventions. 665bd8deadSopenharmony_ci 675bd8deadSopenharmony_ci What should the token names be? 685bd8deadSopenharmony_ci 695bd8deadSopenharmony_ci RESOLVED: Follow the precedent of EXT_blend_equation_separate. 705bd8deadSopenharmony_ci For example, GL_BLEND_DST becomes GL_BLEND_DST_RGB 715bd8deadSopenharmony_ci and GL_BLEND_DST_ALPHA. So GL_BLEND_EQUATION becomes 725bd8deadSopenharmony_ci GL_BLEND_EQUATION_RGB (same value as GL_BLEND_EQUATION) and 735bd8deadSopenharmony_ci GL_BLEND_EQUATION_ALPHA. 745bd8deadSopenharmony_ci 755bd8deadSopenharmony_ci This is different from the ATI_blend_equation_separate approach 765bd8deadSopenharmony_ci which introduces the single name GL_ALPHA_BLEND_EQUATION_ATI 775bd8deadSopenharmony_ci (no RGB name is introduced). The existing OpenGL convention 785bd8deadSopenharmony_ci (example: ARB_texture_env_combine) is to use _RGB and _ALPHA as 795bd8deadSopenharmony_ci a suffix for enumerants, not a prefix. 805bd8deadSopenharmony_ci 815bd8deadSopenharmony_ci How should get token values be assigned? 825bd8deadSopenharmony_ci 835bd8deadSopenharmony_ci RESOLVED: GL_BLEND_EQUATION_RGB_EXT has the same value as 845bd8deadSopenharmony_ci GL_BLEND_EQUATION. See "Compatibility" section. 855bd8deadSopenharmony_ci 865bd8deadSopenharmony_ci For compatibility with ATI_blend_equation_separate, 875bd8deadSopenharmony_ci GL_BLEND_EQUATION_ALPHA_EXT shares the same value (0x883D) 885bd8deadSopenharmony_ci with the ATI_blend_equation_separate's GL_ALPHA_BLEND_EQUATION_ATI 895bd8deadSopenharmony_ci token. The GL_BLEND_EQUATION_ALPHA_EXT name uses the suffixing 905bd8deadSopenharmony_ci convention (rather than prefixing) for adding _ALPHA addition 915bd8deadSopenharmony_ci as done by ARB_texture_env_combine and EXT_blend_func_separate. 925bd8deadSopenharmony_ci 935bd8deadSopenharmony_ciNew Procedures and Functions 945bd8deadSopenharmony_ci 955bd8deadSopenharmony_ci void BlendEquationSeparateEXT(enum modeRGB, 965bd8deadSopenharmony_ci enum modeAlpha); 975bd8deadSopenharmony_ci 985bd8deadSopenharmony_ciNew Tokens 995bd8deadSopenharmony_ci 1005bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, 1015bd8deadSopenharmony_ci GetFloatv, and GetDoublev: 1025bd8deadSopenharmony_ci 1035bd8deadSopenharmony_ci BLEND_EQUATION_RGB_EXT 0x8009 (same as BLEND_EQUATION) 1045bd8deadSopenharmony_ci BLEND_EQUATION_ALPHA_EXT 0x883D 1055bd8deadSopenharmony_ci 1065bd8deadSopenharmony_ciAdditions to Chapter 2 of the 1.5 GL Specification (OpenGL Operation) 1075bd8deadSopenharmony_ci 1085bd8deadSopenharmony_ci None 1095bd8deadSopenharmony_ci 1105bd8deadSopenharmony_ciAdditions to Chapter 3 of the 1.5 GL Specification (Rasterization) 1115bd8deadSopenharmony_ci 1125bd8deadSopenharmony_ci None 1135bd8deadSopenharmony_ci 1145bd8deadSopenharmony_ciAdditions to Chapter 4 of the 1.5 GL Specification (Per-Fragment Operations 1155bd8deadSopenharmony_ciand the Framebuffer) 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ci Replace the "Blend Equation" discussion in section 4.1.7 (Blending) 1185bd8deadSopenharmony_ci with the following: 1195bd8deadSopenharmony_ci 1205bd8deadSopenharmony_ci "The equations used to control blending are determined by the blend 1215bd8deadSopenharmony_ci equations. Blend equations are specified with the commands: 1225bd8deadSopenharmony_ci 1235bd8deadSopenharmony_ci void BlendEquation(enum mode); 1245bd8deadSopenharmony_ci void BlendEquationSeparateEXT(enum modeRGB, enum modeAlpha); 1255bd8deadSopenharmony_ci 1265bd8deadSopenharmony_ci BlendEquationSeparateEXT arguments modeRGB determines the RGB blend 1275bd8deadSopenharmony_ci function while modeAlpha determines the alpha blend equation. 1285bd8deadSopenharmony_ci BlendEquation argument mode determines both the RGB and alpha blend 1295bd8deadSopenharmony_ci equations. modeRGB and modeAlpha must each be one of FUNC_ADD, 1305bd8deadSopenharmony_ci FUNC_SUBTRACT, FUNC_REVERSE_SUBTRACT, MIN, or MAX. 1315bd8deadSopenharmony_ci 1325bd8deadSopenharmony_ci Destination (framebuffer) components are taken to be fixed-point 1335bd8deadSopenharmony_ci values represented according to the scheme in section 2.13.9 1345bd8deadSopenharmony_ci (Final Color Processing), as are source (fragment) components. 1355bd8deadSopenharmony_ci Constant color components are taken to be floating point values. 1365bd8deadSopenharmony_ci [ed: paragraph unchanged except that floating-point is hyphenated.] 1375bd8deadSopenharmony_ci 1385bd8deadSopenharmony_ci Prior to blending, each fixed-point color component undergoes an 1395bd8deadSopenharmony_ci implied conversion to floating-point. This conversion must leave 1405bd8deadSopenharmony_ci the values 0 and 1 invariant. Blending components are treated as 1415bd8deadSopenharmony_ci if carried out in floating-point. [ed: paragraph unchanged except 1425bd8deadSopenharmony_ci that floating-point is hyphenated.] 1435bd8deadSopenharmony_ci 1445bd8deadSopenharmony_ci Table 4.blendeq provides the corresponding per-component blend 1455bd8deadSopenharmony_ci equations for each mode, whether acting on RGB components for modeRGB 1465bd8deadSopenharmony_ci or the alpha component for modeAlpha. 1475bd8deadSopenharmony_ci 1485bd8deadSopenharmony_ci In the table, the "s" subscript on a color component abbreviation 1495bd8deadSopenharmony_ci (R, G, B, or A) refers to the source color component for an incoming 1505bd8deadSopenharmony_ci fragment, the "d" subscript on a color component abbreviation refers 1515bd8deadSopenharmony_ci to the destination color component at the corresponding framebuffer 1525bd8deadSopenharmony_ci location, and the "c" subscript on a color component abbreviation 1535bd8deadSopenharmony_ci refers to the constant blend color component. A color component 1545bd8deadSopenharmony_ci abbreviation without a subscript refers to the new color component 1555bd8deadSopenharmony_ci resulting from blending. Additionally, Sr, Sg, Sb, and Sa are 1565bd8deadSopenharmony_ci the red, green, blue, and alpha components of the source weighting 1575bd8deadSopenharmony_ci factors determined by the source blend function, and Dr, Dg, Db, and 1585bd8deadSopenharmony_ci Da are the red, green, blue, and alpha components of the destination 1595bd8deadSopenharmony_ci weighting factors determined by the destination blend function. 1605bd8deadSopenharmony_ci Blend functions are described below. 1615bd8deadSopenharmony_ci 1625bd8deadSopenharmony_ci Mode RGB components Alpha component 1635bd8deadSopenharmony_ci --------------------- ---------------------- ---------------------- 1645bd8deadSopenharmony_ci FUNC_ADD Rc = Rs * Sr + Rd * Dr Ac = As * Sa + Ad * Da 1655bd8deadSopenharmony_ci Gc = Gs * Sg + Gd * Dg 1665bd8deadSopenharmony_ci Bc = Bs * Sb + Bd * Db 1675bd8deadSopenharmony_ci --------------------- ---------------------- ---------------------- 1685bd8deadSopenharmony_ci FUNC_SUBTRACT Rc = Rs * Sr - Rd * Dr Ac = As * Sa - Ad * Da 1695bd8deadSopenharmony_ci Gc = Gs * Sg - Gd * Dg 1705bd8deadSopenharmony_ci Bc = Bs * Sb - Bd * Db 1715bd8deadSopenharmony_ci --------------------- ---------------------- ---------------------- 1725bd8deadSopenharmony_ci FUNC_REVERSE_SUBTRACT Rc = Rd * Sr - Rs * Dr Ac = Ad * Sa - As * Da 1735bd8deadSopenharmony_ci Gc = Gd * Sg - Gs * Dg 1745bd8deadSopenharmony_ci Bc = Bd * Sb - Bs * Db 1755bd8deadSopenharmony_ci --------------------- ---------------------- ---------------------- 1765bd8deadSopenharmony_ci MIN Rc = min(Rs, Rd) Ac = min(As, Ad) 1775bd8deadSopenharmony_ci Gc = min(Gs, Gd) 1785bd8deadSopenharmony_ci Bc = min(Bs, Bd) 1795bd8deadSopenharmony_ci --------------------- ---------------------- ---------------------- 1805bd8deadSopenharmony_ci MAX Rc = max(Rs, Rd) Ac = max(As, Ad) 1815bd8deadSopenharmony_ci Gc = max(Gs, Gd) 1825bd8deadSopenharmony_ci Bc = max(Bs, Bd) 1835bd8deadSopenharmony_ci --------------------- ---------------------- ---------------------- 1845bd8deadSopenharmony_ci 1855bd8deadSopenharmony_ci Table 4.blendeq: RGB and alpha blend equations are their 1865bd8deadSopenharmony_ci per-component equations controlling the color components resulting 1875bd8deadSopenharmony_ci from blending for each mode." 1885bd8deadSopenharmony_ci 1895bd8deadSopenharmony_ci In the "Blending State" paragraph, replace the initial lines with... 1905bd8deadSopenharmony_ci 1915bd8deadSopenharmony_ci "The state required for blending is two integers for the RGB and alpha 1925bd8deadSopenharmony_ci blend equations, four integer indicating the source and destination 1935bd8deadSopenharmony_ci RGB and alpha blending functions, four floating-point values to store 1945bd8deadSopenharmony_ci the RGBA constant blend color, and a bit indicating whether blending 1955bd8deadSopenharmony_ci is enabled or disabled. The initial blending equations for RGB and 1965bd8deadSopenharmony_ci alpha are FUNC_ADD. ..." 1975bd8deadSopenharmony_ci 1985bd8deadSopenharmony_ciAdditions to Chapter 5 of the 1.5 GL Specification (Special Functions) 1995bd8deadSopenharmony_ci 2005bd8deadSopenharmony_ci None 2015bd8deadSopenharmony_ci 2025bd8deadSopenharmony_ciAdditions to Chapter 6 of the 1.5 GL Specification (State and State Requests) 2035bd8deadSopenharmony_ci 2045bd8deadSopenharmony_ci None 2055bd8deadSopenharmony_ci 2065bd8deadSopenharmony_ciAdditions to the GLX Specification 2075bd8deadSopenharmony_ci 2085bd8deadSopenharmony_ci None 2095bd8deadSopenharmony_ci 2105bd8deadSopenharmony_ciGLX Protocol 2115bd8deadSopenharmony_ci 2125bd8deadSopenharmony_ci A new GL rendering command is added. The following command is sent 2135bd8deadSopenharmony_ci to the server as part of a glXRender request: 2145bd8deadSopenharmony_ci 2155bd8deadSopenharmony_ci BlendEquationSeparateEXT 2165bd8deadSopenharmony_ci 2 12 rendering command length 2175bd8deadSopenharmony_ci 2 4228 rendering command opcode 2185bd8deadSopenharmony_ci 4 ENUM modeRGB 2195bd8deadSopenharmony_ci 4 ENUM modeAlpha 2205bd8deadSopenharmony_ci 2215bd8deadSopenharmony_ciDependencies on EXT_blend_logic_op 2225bd8deadSopenharmony_ci 2235bd8deadSopenharmony_ci If EXT_blend_logic_op and EXT_blend_equation_separate are both 2245bd8deadSopenharmony_ci supported, the logic op blend equation should be supported separately 2255bd8deadSopenharmony_ci for RGB and alpha as with the other blend equation modes. 2265bd8deadSopenharmony_ci 2275bd8deadSopenharmony_ci And add to the table 4.blendeq this line: 2285bd8deadSopenharmony_ci 2295bd8deadSopenharmony_ci Mode RGB components Alpha component 2305bd8deadSopenharmony_ci --------------------- ---------------------- ---------------------- 2315bd8deadSopenharmony_ci LOGIC_OP Rc = Rs OP Rd Ac = As OP Ad 2325bd8deadSopenharmony_ci Gc = Gs OP Gd 2335bd8deadSopenharmony_ci Bc = Bs OP Bd 2345bd8deadSopenharmony_ci --------------------- ---------------------- ---------------------- 2355bd8deadSopenharmony_ci 2365bd8deadSopenharmony_ci where OP denotes the logical operation controlled by LogicOp (see 2375bd8deadSopenharmony_ci table 4.2). 2385bd8deadSopenharmony_ci 2395bd8deadSopenharmony_ci Note: there is no support for a distinct RGB logical operation 2405bd8deadSopenharmony_ci and alpha logical operation (that could be provided by another 2415bd8deadSopenharmony_ci extension). 2425bd8deadSopenharmony_ci 2435bd8deadSopenharmony_ciErrors 2445bd8deadSopenharmony_ci 2455bd8deadSopenharmony_ci INVALID_ENUM is generated if either the modeRGB or modeAlpha 2465bd8deadSopenharmony_ci parameter of BlendEquationSeparateEXT is not one of FUNC_ADD, 2475bd8deadSopenharmony_ci FUNC_SUBTRACT, FUNC_REVERSE_SUBTRACT, MAX, or MIN. 2485bd8deadSopenharmony_ci 2495bd8deadSopenharmony_ci INVALID_OPERATION is generated if BlendEquationSeparateEXT 2505bd8deadSopenharmony_ci is executed between the execution of Begin and the corresponding 2515bd8deadSopenharmony_ci execution of End. 2525bd8deadSopenharmony_ci 2535bd8deadSopenharmony_ciNew State 2545bd8deadSopenharmony_ci 2555bd8deadSopenharmony_ci Initial 2565bd8deadSopenharmony_ci Get Value Get Command Type Value Attribute 2575bd8deadSopenharmony_ci ------------------------ ----------- ---- -------- ------------ 2585bd8deadSopenharmony_ci BLEND_EQUATION_RGB_EXT GetIntegerv Z FUNC_ADD color-buffer 2595bd8deadSopenharmony_ci BLEND_EQUATION_ALPHA_EXT GetIntegerv Z FUNC_ADD color-buffer 2605bd8deadSopenharmony_ci 2615bd8deadSopenharmony_ci [remove BLEND_EQUATION from the table, add a note "v1.5 BLEND_EQUATON" 2625bd8deadSopenharmony_ci beside BLEND_EQUATION_RGB_EXT to note the legacy name.] 2635bd8deadSopenharmony_ci 2645bd8deadSopenharmony_ciNew Implementation Dependent State 2655bd8deadSopenharmony_ci 2665bd8deadSopenharmony_ci None 2675bd8deadSopenharmony_ci 2685bd8deadSopenharmony_ciCompatibility 2695bd8deadSopenharmony_ci 2705bd8deadSopenharmony_ci The BLEND_EQUATION_RGB_EXT query token has the same value as the 2715bd8deadSopenharmony_ci legacy BLEND_EQUATION query token. This means querying the legacy 2725bd8deadSopenharmony_ci BLEND_EQUATION state is identical to querying the RGB blend equation 2735bd8deadSopenharmony_ci state. 2745bd8deadSopenharmony_ci 2755bd8deadSopenharmony_ci This is a different approach than taken by the EXT_blend_func_separate 2765bd8deadSopenharmony_ci extension, but matches the approach taken by other "split" OpenGL 2775bd8deadSopenharmony_ci state such as the SMOOTH_POINT_SIZE_RANGE and ALIASED_POINT_SIZE_RANGE 2785bd8deadSopenharmony_ci values split from POINT_SIZE_RANGE. 2795bd8deadSopenharmony_ci 2805bd8deadSopenharmony_ci In the EXT_blend_func_separate case, four new token names 2815bd8deadSopenharmony_ci (BLEND_DST_RGB, BLEND_SRC_RGB, BLEND_DST_ALPHA, and BLEND_DST_RGB) 2825bd8deadSopenharmony_ci with four new token values (0x80C8, 0x80C9, 0x80CA, and 0x80CB 2835bd8deadSopenharmony_ci respectively) were added. Querying the legacy BLEND_DST (0x0BE0) and 2845bd8deadSopenharmony_ci BLEND_RGB (0x0BE1) returns the same value as querying BLEND_SRC_RGB 2855bd8deadSopenharmony_ci and BLEND_DST_RGB respectively but this was never explicitly 2865bd8deadSopenharmony_ci documented. 2875bd8deadSopenharmony_ci 2885bd8deadSopenharmony_ci In the case of the point size ranges, SMOOTH_POINT_SIZE_RANGE was 2895bd8deadSopenharmony_ci given the same value as POINT_SIZE_RANGE (0x0B12) and a single new 2905bd8deadSopenharmony_ci token ALIASED_POINT_SIZE_RANGE (0x846D). 2915bd8deadSopenharmony_ci 2925bd8deadSopenharmony_ci The point size ranges approach is preferable because it minimizes 2935bd8deadSopenharmony_ci the confusion about how the legacy name should be treated by 2945bd8deadSopenharmony_ci implementations because the legacy name shares its value with 2955bd8deadSopenharmony_ci the new name. This is less prone to confusion by developers and 2965bd8deadSopenharmony_ci implementers and less effort to implement. 2975bd8deadSopenharmony_ci 2985bd8deadSopenharmony_ci For token value compatibility with ATI_blend_equation_separate, 2995bd8deadSopenharmony_ci GL_BLEND_EQUATION_ALPHA_EXT shares the same value (0x883D) with the 3005bd8deadSopenharmony_ci ATI_blend_equation_separate's GL_ALPHA_BLEND_EQUATION_ATI token. 301