1Name 2 3 EXT_blend_equation_separate 4 5Name Strings 6 7 GL_EXT_blend_equation_separate 8 9Contact 10 11 Mark Kilgard, NVIDIA Corporation (mjk 'at' nvidia.com) 12 13Notice 14 15 Copyright NVIDIA Corporation, 2003. 16 17Version 18 19 Date: 12/23/2003 Version 1.0 20 21Status 22 23 Shipping as of May 2004 for GeForce6. 24 25Number 26 27 299 28 29Dependencies 30 31 Written based on the wording of the OpenGL 1.5 specification. 32 33 OpenGL 1.4 (or ARB_imaging, or EXT_blend_minmax and/or 34 EXT_blend_subtract) is required for blend equation support. 35 36 EXT_blend_func_separate is presumed but not required. 37 38 EXT_blend_logic_op interacts with this extension. 39 40Overview 41 42 EXT_blend_func_separate introduced separate RGB and alpha blend 43 factors. EXT_blend_minmax introduced a distinct blend equation for 44 combining source and destination blend terms. (EXT_blend_subtract & 45 EXT_blend_logic_op added other blend equation modes.) OpenGL 1.4 46 integrated both functionalities into the core standard. 47 48 While there are separate blend functions for the RGB and alpha blend 49 factors, OpenGL 1.4 provides a single blend equation that applies 50 to both RGB and alpha portions of blending. 51 52 This extension provides a separate blend equation for RGB and alpha 53 to match the generality available for blend factors. 54 55IP Status 56 57 No known IP issues. 58 59Issues 60 61 Why not use ATI_blend_equation_separate? 62 63 Apple supports this extension in OS X 10.2 but the extension 64 lacks a specification and, as explained in subsequent issues, 65 the token naming is inconsistent with OpenGL conventions. 66 67 What should the token names be? 68 69 RESOLVED: Follow the precedent of EXT_blend_equation_separate. 70 For example, GL_BLEND_DST becomes GL_BLEND_DST_RGB 71 and GL_BLEND_DST_ALPHA. So GL_BLEND_EQUATION becomes 72 GL_BLEND_EQUATION_RGB (same value as GL_BLEND_EQUATION) and 73 GL_BLEND_EQUATION_ALPHA. 74 75 This is different from the ATI_blend_equation_separate approach 76 which introduces the single name GL_ALPHA_BLEND_EQUATION_ATI 77 (no RGB name is introduced). The existing OpenGL convention 78 (example: ARB_texture_env_combine) is to use _RGB and _ALPHA as 79 a suffix for enumerants, not a prefix. 80 81 How should get token values be assigned? 82 83 RESOLVED: GL_BLEND_EQUATION_RGB_EXT has the same value as 84 GL_BLEND_EQUATION. See "Compatibility" section. 85 86 For compatibility with ATI_blend_equation_separate, 87 GL_BLEND_EQUATION_ALPHA_EXT shares the same value (0x883D) 88 with the ATI_blend_equation_separate's GL_ALPHA_BLEND_EQUATION_ATI 89 token. The GL_BLEND_EQUATION_ALPHA_EXT name uses the suffixing 90 convention (rather than prefixing) for adding _ALPHA addition 91 as done by ARB_texture_env_combine and EXT_blend_func_separate. 92 93New Procedures and Functions 94 95 void BlendEquationSeparateEXT(enum modeRGB, 96 enum modeAlpha); 97 98New Tokens 99 100 Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, 101 GetFloatv, and GetDoublev: 102 103 BLEND_EQUATION_RGB_EXT 0x8009 (same as BLEND_EQUATION) 104 BLEND_EQUATION_ALPHA_EXT 0x883D 105 106Additions to Chapter 2 of the 1.5 GL Specification (OpenGL Operation) 107 108 None 109 110Additions to Chapter 3 of the 1.5 GL Specification (Rasterization) 111 112 None 113 114Additions to Chapter 4 of the 1.5 GL Specification (Per-Fragment Operations 115and the Framebuffer) 116 117 Replace the "Blend Equation" discussion in section 4.1.7 (Blending) 118 with the following: 119 120 "The equations used to control blending are determined by the blend 121 equations. Blend equations are specified with the commands: 122 123 void BlendEquation(enum mode); 124 void BlendEquationSeparateEXT(enum modeRGB, enum modeAlpha); 125 126 BlendEquationSeparateEXT arguments modeRGB determines the RGB blend 127 function while modeAlpha determines the alpha blend equation. 128 BlendEquation argument mode determines both the RGB and alpha blend 129 equations. modeRGB and modeAlpha must each be one of FUNC_ADD, 130 FUNC_SUBTRACT, FUNC_REVERSE_SUBTRACT, MIN, or MAX. 131 132 Destination (framebuffer) components are taken to be fixed-point 133 values represented according to the scheme in section 2.13.9 134 (Final Color Processing), as are source (fragment) components. 135 Constant color components are taken to be floating point values. 136 [ed: paragraph unchanged except that floating-point is hyphenated.] 137 138 Prior to blending, each fixed-point color component undergoes an 139 implied conversion to floating-point. This conversion must leave 140 the values 0 and 1 invariant. Blending components are treated as 141 if carried out in floating-point. [ed: paragraph unchanged except 142 that floating-point is hyphenated.] 143 144 Table 4.blendeq provides the corresponding per-component blend 145 equations for each mode, whether acting on RGB components for modeRGB 146 or the alpha component for modeAlpha. 147 148 In the table, the "s" subscript on a color component abbreviation 149 (R, G, B, or A) refers to the source color component for an incoming 150 fragment, the "d" subscript on a color component abbreviation refers 151 to the destination color component at the corresponding framebuffer 152 location, and the "c" subscript on a color component abbreviation 153 refers to the constant blend color component. A color component 154 abbreviation without a subscript refers to the new color component 155 resulting from blending. Additionally, Sr, Sg, Sb, and Sa are 156 the red, green, blue, and alpha components of the source weighting 157 factors determined by the source blend function, and Dr, Dg, Db, and 158 Da are the red, green, blue, and alpha components of the destination 159 weighting factors determined by the destination blend function. 160 Blend functions are described below. 161 162 Mode RGB components Alpha component 163 --------------------- ---------------------- ---------------------- 164 FUNC_ADD Rc = Rs * Sr + Rd * Dr Ac = As * Sa + Ad * Da 165 Gc = Gs * Sg + Gd * Dg 166 Bc = Bs * Sb + Bd * Db 167 --------------------- ---------------------- ---------------------- 168 FUNC_SUBTRACT Rc = Rs * Sr - Rd * Dr Ac = As * Sa - Ad * Da 169 Gc = Gs * Sg - Gd * Dg 170 Bc = Bs * Sb - Bd * Db 171 --------------------- ---------------------- ---------------------- 172 FUNC_REVERSE_SUBTRACT Rc = Rd * Sr - Rs * Dr Ac = Ad * Sa - As * Da 173 Gc = Gd * Sg - Gs * Dg 174 Bc = Bd * Sb - Bs * Db 175 --------------------- ---------------------- ---------------------- 176 MIN Rc = min(Rs, Rd) Ac = min(As, Ad) 177 Gc = min(Gs, Gd) 178 Bc = min(Bs, Bd) 179 --------------------- ---------------------- ---------------------- 180 MAX Rc = max(Rs, Rd) Ac = max(As, Ad) 181 Gc = max(Gs, Gd) 182 Bc = max(Bs, Bd) 183 --------------------- ---------------------- ---------------------- 184 185 Table 4.blendeq: RGB and alpha blend equations are their 186 per-component equations controlling the color components resulting 187 from blending for each mode." 188 189 In the "Blending State" paragraph, replace the initial lines with... 190 191 "The state required for blending is two integers for the RGB and alpha 192 blend equations, four integer indicating the source and destination 193 RGB and alpha blending functions, four floating-point values to store 194 the RGBA constant blend color, and a bit indicating whether blending 195 is enabled or disabled. The initial blending equations for RGB and 196 alpha are FUNC_ADD. ..." 197 198Additions to Chapter 5 of the 1.5 GL Specification (Special Functions) 199 200 None 201 202Additions to Chapter 6 of the 1.5 GL Specification (State and State Requests) 203 204 None 205 206Additions to the GLX Specification 207 208 None 209 210GLX Protocol 211 212 A new GL rendering command is added. The following command is sent 213 to the server as part of a glXRender request: 214 215 BlendEquationSeparateEXT 216 2 12 rendering command length 217 2 4228 rendering command opcode 218 4 ENUM modeRGB 219 4 ENUM modeAlpha 220 221Dependencies on EXT_blend_logic_op 222 223 If EXT_blend_logic_op and EXT_blend_equation_separate are both 224 supported, the logic op blend equation should be supported separately 225 for RGB and alpha as with the other blend equation modes. 226 227 And add to the table 4.blendeq this line: 228 229 Mode RGB components Alpha component 230 --------------------- ---------------------- ---------------------- 231 LOGIC_OP Rc = Rs OP Rd Ac = As OP Ad 232 Gc = Gs OP Gd 233 Bc = Bs OP Bd 234 --------------------- ---------------------- ---------------------- 235 236 where OP denotes the logical operation controlled by LogicOp (see 237 table 4.2). 238 239 Note: there is no support for a distinct RGB logical operation 240 and alpha logical operation (that could be provided by another 241 extension). 242 243Errors 244 245 INVALID_ENUM is generated if either the modeRGB or modeAlpha 246 parameter of BlendEquationSeparateEXT is not one of FUNC_ADD, 247 FUNC_SUBTRACT, FUNC_REVERSE_SUBTRACT, MAX, or MIN. 248 249 INVALID_OPERATION is generated if BlendEquationSeparateEXT 250 is executed between the execution of Begin and the corresponding 251 execution of End. 252 253New State 254 255 Initial 256 Get Value Get Command Type Value Attribute 257 ------------------------ ----------- ---- -------- ------------ 258 BLEND_EQUATION_RGB_EXT GetIntegerv Z FUNC_ADD color-buffer 259 BLEND_EQUATION_ALPHA_EXT GetIntegerv Z FUNC_ADD color-buffer 260 261 [remove BLEND_EQUATION from the table, add a note "v1.5 BLEND_EQUATON" 262 beside BLEND_EQUATION_RGB_EXT to note the legacy name.] 263 264New Implementation Dependent State 265 266 None 267 268Compatibility 269 270 The BLEND_EQUATION_RGB_EXT query token has the same value as the 271 legacy BLEND_EQUATION query token. This means querying the legacy 272 BLEND_EQUATION state is identical to querying the RGB blend equation 273 state. 274 275 This is a different approach than taken by the EXT_blend_func_separate 276 extension, but matches the approach taken by other "split" OpenGL 277 state such as the SMOOTH_POINT_SIZE_RANGE and ALIASED_POINT_SIZE_RANGE 278 values split from POINT_SIZE_RANGE. 279 280 In the EXT_blend_func_separate case, four new token names 281 (BLEND_DST_RGB, BLEND_SRC_RGB, BLEND_DST_ALPHA, and BLEND_DST_RGB) 282 with four new token values (0x80C8, 0x80C9, 0x80CA, and 0x80CB 283 respectively) were added. Querying the legacy BLEND_DST (0x0BE0) and 284 BLEND_RGB (0x0BE1) returns the same value as querying BLEND_SRC_RGB 285 and BLEND_DST_RGB respectively but this was never explicitly 286 documented. 287 288 In the case of the point size ranges, SMOOTH_POINT_SIZE_RANGE was 289 given the same value as POINT_SIZE_RANGE (0x0B12) and a single new 290 token ALIASED_POINT_SIZE_RANGE (0x846D). 291 292 The point size ranges approach is preferable because it minimizes 293 the confusion about how the legacy name should be treated by 294 implementations because the legacy name shares its value with 295 the new name. This is less prone to confusion by developers and 296 implementers and less effort to implement. 297 298 For token value compatibility with ATI_blend_equation_separate, 299 GL_BLEND_EQUATION_ALPHA_EXT shares the same value (0x883D) with the 300 ATI_blend_equation_separate's GL_ALPHA_BLEND_EQUATION_ATI token. 301