1Name 2 3 ARB_draw_buffers_blend 4 5Name Strings 6 7 GL_ARB_draw_buffers_blend 8 9Contact 10 11 Jeff Bolz, NVIDIA Corporation (jbolz 'at' nvidia.com) 12 Mark Young, AMD (mark.young 'at' amd.com) 13 14Contributors 15 16 Jeff Bolz, NVIDIA 17 Pierre Boudier, AMD 18 Nick Haemel, AMD 19 Timothy Lamb, AMD 20 Greg Roth, NVIDIA 21 Graham Sellers, AMD 22 Mike Strauss, NVIDIA 23 Mark Young, AMD 24 25Notice 26 27 Copyright (c) 2009-2013 The Khronos Group Inc. Copyright terms at 28 http://www.khronos.org/registry/speccopyright.html 29 30Specification Update Policy 31 32 Khronos-approved extension specifications are updated in response to 33 issues and bugs prioritized by the Khronos OpenGL Working Group. For 34 extensions which have been promoted to a core Specification, fixes will 35 first appear in the latest version of that core Specification, and will 36 eventually be backported to the extension document. This policy is 37 described in more detail at 38 https://www.khronos.org/registry/OpenGL/docs/update_policy.php 39 40Status 41 42 Complete. Approved by the ARB on July 3, 2009. 43 44Version 45 46 Last Modified Date: 01/19/2011 47 Revision: 4 48 49Number 50 51 ARB Extension #69 52 53Dependencies 54 55 The extension is written against the OpenGL 2.0 Specification. 56 57 OpenGL 2.0 is required. 58 59 EXT_draw_buffers2 is required. 60 61Overview 62 63 This extension builds upon the ARB_draw_buffers and 64 EXT_draw_buffers2 extensions. In ARB_draw_buffers (part of OpenGL 65 2.0), separate values could be written to each color buffer. This 66 was further enhanced by EXT_draw_buffers2 by adding in the ability 67 to enable blending and to set color write masks independently per 68 color output. 69 70 This extension provides the ability to set individual blend 71 equations and blend functions for each color output. 72 73New Procedures and Functions 74 75 void BlendEquationiARB(uint buf, enum mode); 76 77 void BlendEquationSeparateiARB(uint buf, enum modeRGB, 78 enum modeAlpha); 79 80 void BlendFunciARB(uint buf, enum src, enum dst); 81 82 void BlendFuncSeparateiARB(uint buf, enum srcRGB, enum dstRGB, 83 enum srcAlpha, enum dstAlpha); 84 85New Tokens 86 87 None. 88 89Additions to Chapter 2 of the OpenGL 2.0 Specification (OpenGL Operation) 90 91 None. 92 93Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization) 94 95 None. 96 97Additions to Chapter 4 of the OpenGL 2.0 Specification (Per-Fragment 98Operations and the Frame Buffer) 99 100 Modify Section 4.1.8, Blending p. 205 101 102 (modify section Blend Equation starting with the first paragraph) 103 104 "Blending is controlled by the blend equation. This equation can be 105 simultaneously set to the same value for all draw buffers using the 106 commands: 107 108 void BlendEquation(enum mode); 109 void BlendEquationSeparate(enum modeRGB, enum modeAlpha); 110 111 or for an individual draw buffer using the indexed versions of the 112 same commands: 113 114 void BlendEquationiARB(uint buf, enum mode); 115 void BlendEquationSeparateiARB(uint buf 116 enum modeRGB, 117 enum modeAlpha); 118 119 BlendEquationSeparate and BlendEquationSeparateiARB argument 120 <modeRGB> determines the RGB blend equation while <modeAlpha> 121 determines the alpha blend equation. BlendEquation and 122 BlendEquationiARB argument <mode> determines both the RGB and alpha 123 blend equations. <mode>, <modeRGB>, and <modeAlpha> must be one of 124 FUNC_ADD, FUNC_SUBTRACT, FUNC_REVERSE_SUBTRACT, MIN, MAX. 125 BlendEquation and BlendEquationSeparate modify the blend equations 126 for all draw buffers. BlendEquationiARB and 127 BlendEquationSeparateiARB modify the blend equations associated with 128 an individual draw buffer. The <buf> argument is an integer i that 129 indicates that the blend equations should be modified for 130 DRAW_BUFFERi. 131 132 (modify section Blend Functions starting with the first paragraph) 133 134 The weighting factors used by the blend equation are determined by 135 the blend functions. Blend functions are simultaneously specified 136 for all draw buffers using the commands: 137 138 void BlendFunc(enum src, enum dst); 139 void BlendFuncSeparate(enum srcRGB, enum dstRGB, 140 enum srcAlpha, enum dstAlpha); 141 142 or for an individual draw buffer using the indexed versions of the 143 same commands: 144 145 void BlendFunciARB(uint buf, enum src, enum dst); 146 void BlendFuncSeparateiARB(uint buf, enum srcRGB, 147 enum dstRGB, enum srcAlpha, 148 enum dstAlpha); 149 150 BlendFuncSeparate and BlendFuncSeparateiARB arguments <srcRGB> and 151 <dstRGB> determine the source and destination RGB blend functions, 152 respectively, while <srcAlpha> and <dstAlpha> determine the source 153 and destination alpha blend functions. BlendFunc and BlendFunciARB 154 argument <src> determines both RGB and alpha source functions, while 155 <dst> determines both RGB and alpha destination functions. 156 BlendFuncSeparate and BlendFunc modify the blend functions for all 157 draw buffers. BlendFuncSeparateiARB and BlendFunciARB modify the 158 blend functions associated with an individual draw buffer. The <buf> 159 argument is an integer i that indicates that the blend equations 160 should be modified for DRAW_BUFFER<i>." 161 162 163 (modify section Blending State) 164 165 "The state required for blending, for each draw buffer, is two 166 integers for the RGB and alpha blend equations, four integers 167 indicating the source and destination RGB and alpha blending 168 functions, and a bit indicating whether blending is enabled or 169 disabled. Additionally, four floating-point values to store the RGBA 170 constant blend color are required. 171 172 For all draw buffers, the initial blend equations for RGB and alpha 173 are both FUNC_ADD, and the initial blending functions are ONE for 174 the source RGB and alpha functions, and ZERO for the destination RGB 175 and alpha functions. Initially, blending is disabled for all draw 176 buffers. The initial constant blend color is (R,G,B,A) = (0,0,0,0). 177 178 The value of the blend enable for draw buffer <i> can be queried by 179 calling IsEnabledi with <target> BLEND and <index> <i>, and the 180 values of the blend equations and functions can be queried by caling 181 GetIntegerIndexedvEXT with the corresponding <target> as shown in 182 table 6.20 and <index> $i$. 183 184 The value of the blend enable, or the blend equations and functions 185 for draw buffer zero may also be queried by calling IsEnabled, or 186 GetInteger, respectively, with the same symbolic constants but no 187 <index> parameter." 188 189 190Additions to Chapter 5 of the OpenGL 2.0 Specification (Special Functions) 191 192 None. 193 194Additions to Chapter 6 of the OpenGL 2.0 Specification (State and 195State Requests) 196 197 None. 198 199Additions to Appendix A of the OpenGL 2.0 Specification (Invariance) 200 201 None. 202 203Additions to the AGL/GLX/WGL Specifications 204 205 None. 206 207Errors 208 209 The error INVALID_ENUM is generated by BlendEquationiARB, 210 BlendEquationSeparateiARB, BlendFuncSeparateiARB, and 211 BlendFunciARB if the <buf> parameter is outside the range 212 [0, MAX_DRAW_BUFFERS-1]. 213 214 The error INVALID_ENUM is generated by GetIntegerIndexedvEXT 215 if <target> is BLEND_EQUATION, BLEND_EQUATION_RGB, 216 BLEND_EQUATION_ALPHA, BLEND_SRC, BLEND_SRC_RGB, BLEND_SRC_ALPHA, 217 BLEND_DST, BLEND_DST_RGB, BLEND_DST_ALPHA, and <index> is outside 218 the range [0, MAX_DRAW_BUFFERS-1]. 219 220 The error INVALID_ENUM is generated by BlendFunciARB 221 if either <src>, or <dst> is not an accepted value. 222 223 The error INVALID_ENUM is generated by BlendFuncSeparateiARB 224 if either <srcRGB>, <dstRGB>, <srcAlpha>, or <dstAlpha> is not 225 an accepted value. 226 227 The error INVALID_ENUM is generated if the <mode> parameter of 228 BlendEquationiARB is not one of FUNC_ADD, FUNC_SUBTRACT, 229 FUNC_REVERSE_SUBTRACT, MAX, or MIN. 230 231 The error INVALID_ENUM is generated if either the <modeRGB> or 232 <modeAlpha> parameter of BlendEquationSeparateiARB is not one of 233 FUNC_ADD, FUNC_SUBTRACT, FUNC_REVERSE_SUBTRACT, MAX, or MIN. 234 235 The error INVALID_OPERATION is generated if any of these new 236 entry-points are executed between the execution of glBegin and the 237 corresponding execution of glEnd. 238 239 240New State 241 242 Modify Table 6.20, p. 281 243 244 (modify the entries for the blend functions and equations and add 245 new entries for indexed access to the per draw buffer functions 246 and equations) 247 248 249 Initial 250 Get Target Type Get Command Value Description Section Attribute 251 ----------------------------------- --------- --------------------- -------- ---------------------------------------------------- ------- ------------- 252 BLEND_SRC_RGB (BLEND_SRC) 1* x Z_15 GetIntegerIndexedvEXT ONE Blending source RGB function for draw buffer i 4.2.2 color-buffer 253 where i is specified as <index> 254 BLEND_SRC_ALPHA 1* x Z_15 GetIntegerIndexedvEXT ONE Blending source A function for draw buffer i 4.2.2 color-buffer 255 where i is specified as <index> 256 BLEND_DST_RGB (BLEND_DST) 1* x Z_14 GetIntegerIndexedvEXT ZERO Blending destination RGB function for draw buffer i 4.2.2 color-buffer 257 where i is specified as <index> 258 BLEND_DST_ALPHA 1* x Z_14 GetIntegerIndexedvEXT ZERO Blending destination A function for draw buffer i 4.2.2 color-buffer 259 where i is specified as <index> 260 BLEND_EQUATION_RGB (BLEND_EQUATION) 1* x Z GetIntegerIndexedvEXT FUNC_ADD RGB blending equation for draw buffer i 4.2.2 color-buffer 261 where i is specified as <index> 262 BLEND_EQUATION_ALPHA 1* x Z GetIntegerIndexedvEXT FUNC_ADD Alpha blending equation for draw buffer i 4.2.2 color-buffer 263 where i is specified as <index> 264 265Issues 266 267 1. What should we call this? 268 269 RESOLVED: ARB_draw_buffers_blend. 270 271 Other suggestions were ARB_drawbuffers_blend and ARB_mrt_blend. 272 273 2. What effect does using the non-indexed versions of the blend 274 function or equation entry-points have upon the new indexed per 275 draw buffer versions? 276 277 RESOLVED: Similar to the way EXT_draw_buffers2 handles the 278 indexed and non-indexed ColorMask interaction in issue 3. The 279 non-indexed versions of the functions will set all buffers to 280 the passed in parameters. 281 282 For example, BlendFunc will set all color buffer blend functions 283 to the values passed in. 284 285 3. Should the new functions be ---Indexed (as in EXT_draw_buffers2) 286 or ---i (as in OpenGL 3.0 core)? 287 288 RESOLVED: Because this is to be promoted to core, the i index is 289 used 290 291Revision History 292 293 Rev. Date Author Changes 294 ---- -------- --------- ----------------------------------------- 295 4 1/19/11 Jon Leech Fix GetIntegeri_v -> GetIntegerIndexedi_v 296 (Bug 7229). 297 3 2/11/10 Jon Leech Clarify in required state section that 298 the constant blend color is global, 299 not per-draw-buffer. Remove duplicate 300 state for draw buffer zero from state 301 tables and describe how non-indexed 302 queries access it from required state 303 section (Bug 5920). 304 2 8/02/09 Jon Leech Reformat to 80 columns and assign 305 ARB extension number. 306 1 5/14/09 jbolz copy & rename from EXT version rev 5. 307 308