1Name 2 3 AMD_draw_buffers_blend 4 5Name Strings 6 7 GL_AMD_draw_buffers_blend 8 9Contributors 10 11 Mark Young 12 Graham Sellers 13 Timothy Lamb 14 Pierre Boudier 15 Nick Haemel 16 17Contact 18 19 Mark Young, AMD (mark.young 'at' amd.com) 20 21Status 22 23 In progress 24 25Version 26 27 Last Modified Date: July 10, 2009 28 Author Revision: 3 29 30Number 31 32 366 33 34Dependencies 35 36 The extension is written against the OpenGL 2.0 Specification. 37 38 OpenGL 2.0 is required. 39 40 EXT_draw_buffers2 is required. 41 42Overview 43 44 This extension builds upon the ARB_draw_buffers and EXT_draw_buffers2 45 extensions. In ARB_draw_buffers (part of OpenGL 2.0), separate values 46 could be written to each color buffer. This was further enhanced by 47 EXT_draw_buffers2 by adding in the ability to enable blending and to set 48 color write masks independently per color output. 49 50 This extension provides the ability to set individual blend equations and 51 blend functions for each color output. 52 53New Procedures and Functions 54 55 void BlendFuncIndexedAMD(uint buf, enum src, enum dst); 56 57 void BlendFuncSeparateIndexedAMD(uint buf, enum srcRGB, enum dstRGB, 58 enum srcAlpha, enum dstAlpha); 59 60 void BlendEquationIndexedAMD(uint buf, enum mode); 61 62 void BlendEquationSeparateIndexedAMD(uint buf, enum modeRGB, 63 enum modeAlpha); 64 65New Tokens 66 67 None. 68 69Additions to Chapter 2 of the OpenGL 2.0 Specification (OpenGL Operation) 70 71 None. 72 73Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization) 74 75 None. 76 77Additions to Chapter 4 of the OpenGL 2.0 Specification (Per-Fragment 78Operations and the Frame Buffer) 79 80 Modify the first two paragraphs of section 4.1.8 (Blending - Blending 81 Equation), p206, to read as follows: 82 83 "Blending is controlled by the blend equation. This equation can be 84 simultaneously set to the same value for all draw buffers using the 85 commands: 86 87 void BlendEquation(enum mode); 88 89 void BlendEquationSeparate(enum modeRGB, enum modeAlpha); 90 91 or for an individual draw buffer using the indexed versions of the 92 same commands: 93 94 void BlendEquationIndexedAMD(uint buf, enum mode); 95 96 void BlendEquationSeparateIndexedAMD(uint buf 97 enum modeRGB, 98 enum modeAlpha); 99 100 BlendEquationSeparate and BlendEquationSeparateIndexedAMD separate 101 out the blend equations into an RGB argument and an Alpha argument. 102 <modeRGB> determine the RGB blend function while <modeAlpha> 103 determines the alpha equation. BlendEquation and 104 BlendEquationIndexedAMD control both the RGB and Alpha blend 105 equations with a single argument <mode>. <modeRGB> and <modeAlpha> 106 must each be one of FUNC_ADD, FUNC_SUBTRACT, FUNC_REVERSE_SUBTRACT, 107 MIN_MAX, or LOGIC_OP. BlendEquationIndexedAMD and 108 BlendEquationSeparateIndexedAMD argument <buf> sets the blend 109 equations for an individual draw buffer. The blend equations for 110 DRAW_BUFFERi are modified by passing i as the parameter <buf>." 111 112 113 Modify the first two paragraphs of section 4.1.8 (Blending - Blending 114 Functions), p207, to read as follows: 115 116 "The weighting factors used by the blend equation are determined by 117 the blend functions. Blend functions are simultaneously specified for 118 all draw buffers using the commands: 119 120 void BlendFunc(enum src, enum dst); 121 122 void BlendFuncSeparate(enum srcRGB, enum dstRGB, 123 enum srcAlpha, enum dstAlpha); 124 125 or for an individual draw buffer using the indexed versions of the 126 same commands: 127 128 void BlendFuncIndexedAMD(uint buf, enum src, enum dst); 129 130 void BlendFuncSeparateIndexedAMD(uint buf, enum srcRGB, 131 enum dstRGB, enum srcAlpha, 132 enum dstAlpha); 133 134 BlendFuncSeparate and BlendFuncSeparateIndexedAMD arguments <srcRGB> 135 and <dstRGB> determine the source and destination RGB blend functions, 136 respectively, while <srcAlpha> and <dstAlpha> determine the source and 137 destination alpha blend functions. BlendFunc and BlendFuncIndexedAMD 138 arguments <src> determines both RGB and alpha source functions, while 139 <dst> determines both RGB and alpha destination functions. 140 BlendFuncSeparateIndexedAMD and BlendFuncIndexedAMD argument <buf> 141 sets the blend functions for an indivual draw buffer. The blend 142 functions for DRAW_BUFFERi are modified by passing i as the parameter 143 <buf>." 144 145 146 Modify the first paragraph of section 4.1.8 (Blending - Blending 147 State), p209, to read as follows: 148 149 "For each of n draw buffers, the state required for blending is two 150 integers for the RGB and alpha blend equations, four integers 151 indicating the source and destination RGB and alpha blending functions, 152 four floating-point values to store the RGBA constant blend color, and 153 a bit indicating whether blending is enabled or disabled. For all draw 154 buffers, the initial blend equations for RGB and alpha are both 155 FUNC_ADD. The initial blending functions for all draw buffers are ONE 156 for the source RGB and alpha functions, and ZERO for the destination 157 RGB and alpha functions. For all draw buffers initial constant blend 158 color is (R, G, B, A) = (0, 0, 0, 0). Initially, blending is disabled 159 for all draw buffers." 160 161Additions to Chapter 5 of the OpenGL 2.0 Specification (Special Functions) 162 163 None. 164 165Additions to Chapter 6 of the OpenGL 2.0 Specification (State and 166State Requests) 167 168 None. 169 170Additions to Appendix A of the OpenGL 2.0 Specification (Invariance) 171 172 None. 173 174Additions to the AGL/GLX/WGL Specifications 175 176 None. 177 178Errors 179 180 The error INVALID_ENUM is generated if the <buf> parameter of 181 BlendFuncIndexedAMD, BlendFuncSeparateIndexedAMD, BlendEquationIndexedAMD, 182 or BlendEquatioSeparateIndexedAMD is outside the range 183 [0, MAX_DRAW_BUFFERS-1]. 184 185 The error INVALID_ENUM is generated by BlendFuncIndexedAMD 186 if either <src>, or <dst> is not an accepted value. 187 188 The error INVALID_ENUM is generated by BlendFuncSeparateIndexedAMD 189 if either <srcRGB>, <dstRGB>, <srcAlpha>, or <dstAlpha> is not 190 an accepted value. 191 192 The error INVALID_ENUM is generated if the <mode> parameter of 193 BlendEquationIndexedAMD is not one of FUNC_ADD, FUNC_SUBTRACT, 194 FUNC_REVERSE_SUBTRACT, MAX, or MIN. 195 196 The error INVALID_ENUM is generated if either the <modeRGB> or <modeAlpha> 197 parameter of BlendEquationSeparateIndexedAMD is not one of 198 FUNC_ADD, FUNC_SUBTRACT, FUNC_REVERSE_SUBTRACT, MAX, or MIN. 199 200 The error INVALID_OPERATION is generated if any of these new entry-points 201 are executed between the execution of glBegin and the corresponding 202 execution of glEnd. 203 204New State 205 206 Modify (table 6.20, p281), modifying the entries for BLEND_SRC_RGB, 207 BLEND_SRC_ALPHA, BLEND_DST_RGB, BLEND_DST_ALPHA, BLEND_EQUATION_RGB, 208 and BLEND_EQUATION_ALPHA and adding new indexed versions as well. 209 210 211 Get Target Type Get Command Initial Value Description Section Attribute 212 ---------- ---- --------------------- -------------- ----------------------------------------------- ------- ------------------- 213 BLEND_SRC_RGB Z15 GetIntegerv ONE Blending source RGB function for draw buffer 0 4.1.8 color-buffer 214 (v1.3:BLEND_SRC) 215 216 BLEND_SRC_RGB Z15 GetIntegerIndexedvEXT ONE Blending source RGB function for draw buffer i 4.1.8 color-buffer 217 (v1.3:BLEND_SRC) where i is specified as <buf> 218 219 BLEND_SRC_ALPHA Z15 GetIntegerv ONE Blending source A function for draw buffer 0 4.1.8 color-buffer 220 221 BLEND_SRC_ALPHA Z15 GetIntegerIndexedvEXT ONE Blending source A function for draw buffer i 4.1.8 color-buffer 222 where i is specified as <buf> 223 224 BLEND_DST_RGB Z14 GetIntegerv ZERO Blending dest. RGB function for draw buffer 0 4.1.8 color-buffer 225 (v1.3:BLEND DST) 226 227 BLEND_DST_RGB Z14 GetIntegerIndexedvEXT ZERO Blending dest. RGB function for draw buffer i 4.1.8 color-buffer 228 (v1.3:BLEND DST) where i is specified as <buf> 229 230 BLEND_DST_ALPHA Z14 GetIntegerv ZERO Blending dest. A function for draw buffer 0 4.1.8 color-buffer 231 232 BLEND_DST_ALPHA Z14 GetIntegerIndexedvEXT ZERO Blending dest. A function for draw buffer i 4.1.8 color-buffer 233 where i is specified as <buf> 234 235 BLEND_EQUATION_RGB Z5 GetIntegerv FUNC_ADD RGB blending equation for draw buffer 0 4.1.8 color-buffer 236 (v1.5: BLEND EQUATION) 237 238 BLEND_EQUATION_RGB Z5 GetIntegerIndexedvEXT FUNC_ADD RGB blending equation for draw buffer i 4.1.8 color-buffer 239 (v1.5: BLEND EQUATION) where i is specified as <buf> 240 241 BLEND_EQUATION_ALPHA Z5 GetIntegerv FUNC_ADD Alpha blending equation for draw buffer 0 4.1.8 color-buffer 242 243 BLEND_EQUATION_ALPHA Z5 GetIntegerIndexedvEXT FUNC_ADD Alpha blending equation for draw buffer i 4.1.8 color-buffer 244 where i is specified as <buf> 245 246Issues 247 248 1. What should we call this? 249 250 PROPOSED: Suggestions currently are 251 AMD_draw_buffers_blend 252 AMD_drawbuffers_blend 253 AMD_mrt_blend 254 255 256 2. Should this be an AMDX extension or just AMD? 257 258 PROPOSED: We propose AMD since the functionality currently exists in 259 DX 10.1 and is used by developers in that API. 260 261 262 3. What effect does using the non-indexed versions of the blend function 263 or equation entry-points have upon the new indexed per draw buffer 264 versions? 265 266 RESOLVED: Similar to the way EXT_draw_buffers2 handles the indexed 267 and non-indexed ColorMask interaction in issue 3. The non-indexed 268 versions of the functions will set all buffers to the passed in 269 parameters. 270 271 For example, BlendFunc will set all color buffer blend functions to 272 the values passed in. 273 274 4. Should the new functions be ---Indexed (as in EXT_draw_buffers2) or 275 ---i (as in OpenGL 3.0 core)? 276 277 RESOLVED: For consistency with EXT_draw_buffers2, leave them as 278 ---Indexed. If this functionality is promoted to core in a later 279 version of OpenGL, they can be changed to ---i. 280 281Revision History 282 283 #3, July 10, 2009: Jon Leech 284 Assign extension number, minor formatting cleanup for registry. 285 286 #2, March 26, 2009: myoung 287 Tightened up language. Resolved some issues. 288 289 #1, March 25, 2009: myoung 290 Internal spec development. 291