1Name 2 3 NV_blend_minmax_factor 4 5Name Strings 6 7 GL_NV_blend_minmax_factor 8 9Contributors 10 11 Jeff Bolz 12 Pierre Boudier 13 Charles Hansen 14 Bill Sebastian, Visual Music Systems 15 Graham Sellers, original AMD specification 16 17Contact 18 19 Mark Kilgard, NVIDIA (mjk 'at' nvidia.com) 20 21Status 22 23 Implemented in NVIDIA's August 2017 SIGGRAPH driver 24 25Version 26 27 Last Modified Date: July 26, 2017 28 Author Revision: 3 29 30Number 31 32 OpenGL Extension #510 33 OpenGL ES Extension #285 34 35Dependencies 36 37 The extension is written against the OpenGL 4.1 (Core) Specification. 38 39 OpenGL 1.0 or ES 2.0 is required. 40 41 This extension interacts with 42 NVX_blend_equation_advanced_multi_draw_buffers as specified. 43 44 This extension interacts with ARB_blend_func_extended, 45 EXT_blend_func_extended (for ES), or OpenGL 3.3 as specified. 46 47 This extension interacts with NV_blend_equation_advanced, 48 NV_blend_equation_advanced_coherent, KHR_blend_equation_advanced, 49 KHR_blend_equation_advanced_coherent, OpenGL 4.5, or ES 3.2 as 50 specified. 51 52Overview 53 54 The EXT_blend_minmax extension extended the GL's blending 55 functionality to allow the blending equation to be specified by the 56 application. That extension introduced the MIN_EXT and MAX_EXT blend 57 equations, which caused the result of the blend equation to become 58 the minimum or maximum of the source color and destination color, 59 respectively. 60 61 The MIN_EXT and MAX_EXT blend equations, however, do not include the 62 source or destination blend factors in the arguments to the min and 63 max functions. This extension provides two new blend equations that 64 produce the minimum or maximum of the products of the source color 65 and source factor, and the destination color and destination factor. 66 67 This NVIDIA extension has some limitations relative to the 68 AMD_blend_minmax_factor extension. See issues #1, #2, and #3. 69 70New Procedures and Functions 71 72 None. 73 74New Tokens 75 76 Accepted by the <mode> parameter of BlendEquation and BlendEquationi, and by 77 the <modeRGB> and <modeAlpha> parameters of BlendEquationSeparate and 78 BlendEquationSeparatei: 79 80 FACTOR_MIN_AMD 0x901C 81 FACTOR_MAX_AMD 0x901D 82 83Additions to Chapter 2 of the OpenGL 4.1 (Core) Specification (OpenGL Operation) 84 85 None. 86 87Additions to Chapter 3 of the OpenGL 4.1 (Core) Specification (Rasterization) 88 89 None. 90 91Additions to Chapter 4 of the OpenGL 4.1 (Core) Specification (Per-Fragment 92Operations and the Frame Buffer) 93 94 Modify the list of accepted tokens for <mode>, <modeRGB> and <modeAlpha> 95 in the description of BlendEquation{i} and BlendEquationSeparate{i}, p.262: 96 97 "... <mode>, <modeRGB>, <modeAlpha> must be one of FUNC_ADD, FUNC_SUBTRACT, 98 FUNC_REVERSE_SUBTRACT, MIN, MAX, FACTOR_MIN_AMD, or FACTOR_MAX_AMD. ..." 99 100 Add to Table 4.1: RGB and Alpha Blend Equations 101 102 +-----------------+---------------------------+-----------------------------+ 103 | Mode | RGB Components | Alpha Component | 104 +-----------------+---------------------------+-----------------------------+ 105 | FACTOR_MIN_AMD | R = min(Rs * Sr, Rd * Dr) | A = min(As * Sa, Ad * Da) | 106 | | G = min(Gs * Sg, Gd * Dg) | | 107 | | B = min(Bs * Sb, Bd * Db) | | 108 +-----------------+---------------------------+-----------------------------+ 109 | FACTOR_MAX_AMD | R = max(Rs * Sr, Rd * Dr) | A = max(As * Sa, Ad * Da) | 110 | | G = max(Gs * Sg, Gd * Dg) | | 111 | | B = max(Bs * Sb, Bd * Db) | | 112 +-----------------+---------------------------+-----------------------------+ 113 114 Add the following precision limitation after table 4.1: 115 116 "An implementation may perform the computations for the FACTOR_MIN_AMD 117 and FACTOR_MAX_AMD modes in half-precsion floating-point even 118 when the representable range of the framebuffer is can represent 119 single-precision or better color components." 120 121 Add the following orthogonality restriction after table 4.1: 122 123 "When the NVX_blend_equation_advanced_multi_draw_buffers is not 124 supported, the FACTOR_MIN_AMD and FACTOR_MAX_AMD blending equations 125 are supported only when rendering to a single color buffer using 126 fragment color zero. In this case, if any non-NONE draw buffer 127 enabled for blending uses either the FACTOR_MIN_AMD and FACTOR_MAX_AMD 128 blending equations, the error INVALID_OPERATION is generated by 129 [[Compatibility Profile: Begin or any operation that implicitly 130 calls Begin (such as DrawElements)]] [[Core Profile: DrawArrays 131 and the other drawing commands defined in section 2.8.3]] if: 132 133 * the draw buffer for color output zero selects multiple color buffers 134 (e.g., FRONT_AND_BACK in the default framebuffer); or 135 136 * the draw buffer for any other color output is not NONE. 137 138 Alternatively when the NVX_blend_equation_advanced_multi_draw_buffers 139 is supported, if any non-NONE draw buffer enabled for blending uses 140 a blend equation of either FACTOR_MIN_AMD or FACTOR_MAX_AMD for 141 either RGB or alpha, the error INVALID_OPERATION is generated by 142 [[Compatibility Profile: Begin or any operation that implicitly 143 calls Begin (such as DrawElements)]] [[Core Profile: DrawArrays 144 and the other drawing commands defined in section 2.8.3]] if any 145 other non-NONE draw buffer uses a different combination of the 146 first draw buffer's RGB and alpha blend equation." In other words, 147 the FACTOR_MIN_AMD or FACTOR_MAX_AMD blend equations are now allowed 148 with multiple draw buffers as long as they use they use identical 149 blend equations for RGB and alpha for all non-NONE draw buffers. 150 151 If any non-NONE draw buffer enabled for blending uses any of 152 SRC1_COLOR, SRC1_ALPHA, ONE_MINUS_SRC1_COLOR, or ONE_MINUS_SRC1_ALPHA 153 for a source or destination blend function, the error 154 INVALID_OPERATION is generated by [[Compatibility Profile: Begin or 155 any operation that implicitly calls Begin (such as DrawElements)]] 156 [[Core Profile: DrawArrays and the other drawing commands defined 157 in section 2.8.3]]." 158 159Additions to Chapter 5 of the OpenGL 4.1 (Core) Specification (Special Functions) 160 161 None. 162 163Additions to Chapter 6 of the OpenGL 4.1 (Core) Specification (State and 164State Requests) 165 166 None. 167 168Additions to Appendix A of the OpenGL 4.1 (Core) Specification (Invariance) 169 170 None. 171 172Additions to the AGL/GLX/WGL Specifications 173 174 None. 175 176Errors 177 178 None. 179 180New State 181 182 Modify Table 6.21: Pixel Operations (cont.) p.343 183 184 Change entries for BLEND_EQUATION_ALPHA and BLEND_EQUATION_RGB to: 185 186 +----------------------+---------+---------------+---------------+-------------------------+-------+ 187 | Get Value | Type | Get Command | Initial Value | Description | Sec. | 188 +----------------------+---------+---------------+---------------+-------------------------+-------+ 189 | BLEND_EQUATION_RGB | 8* x Z7 | GetIntegeri_v | FUNC_ADD | RGB Blending Equation | 4.1.7 | 190 | | | | | for Draw Buffer i | | 191 +----------------------+---------+---------------+---------------+-------------------------+-------+ 192 | BLEND_EQUATION_ALPHA | 8* x Z7 | GetIntegeri_v | FUNC_ADD | Alpha Blending Equation | 4.1.7 | 193 | | | | | for Draw Buffer i | | 194 +----------------------+---------+---------------+---------------+-------------------------+-------+ 195 196 * Note that the only change change is that BLEND_EQUATION_RGB and 197 BLEND_EQUATION_ALPHA are now Z7 rather than Z5. 198 199Issues 200 201 1) Why not just implement AMD_blend_factor_minmax? 202 203 RESOLVED: NVIDIA has a precision limitation and orthogonality 204 restrictions. 205 206 Rather than pollute the AMD extension with an incomplete 207 implementation, this comparable NV version is API-consistent 208 (uses the same token values) and same blending math but documents 209 its precision limitation and restrictions. 210 211 2) What is the precision limitation? 212 213 The GL_FACTOR_MIN_AMD and GL_FACTOR_MAX_AMD blend functions are 214 allowed to compute their blend results in half-precision even 215 when the framebuffer format is single-precision. In practice, 216 this means the blend modes work but will quantize results 217 to the representable range of half-precision, even if the 218 framebuffer is full precision. 219 220 This limitation matches the allowance of the advanced blend 221 equations introduced by NV_blend_equation_advanced (and 222 standardized by KHR_blend_equation and OpenGL 4.5 and ES 3.2). 223 224 This means magnitudes beyond the largest representable magnitude 225 of half-precision may be mapped to infinity. Magnitudes less 226 than the smallest representable non-zero magnitude may be mapped 227 to zero. Mantissa bits may be quantied. 228 229 While this limitation allows implementations to perform these 230 blend modes in half-precision, it does not require the blend 231 modes to be performed in half-precsion. Implementations are 232 allowed to blend with better numerics than half-precision. 233 This being said, expect NVIDIA implementations circa 2017 to 234 implement these blend modes using half-precision numerics. 235 236 3) What are the orthogonality restrictions? 237 238 If more than one draw buffer is configured 239 with glDrawBuffers (or similar command) and 240 NVX_blend_equation_advanced_multi_draw_buffers is supported and at 241 least one of the non-NONE draw buffers has GL_FACTOR_MIN_AMD or 242 GL_FACTOR_MAX_AMD configured as the buffer's RGB or alpha blend 243 equation, then all non-NONE draw buffers must have identical 244 blend equations configuration for RGB and alpha; otherwise the 245 error GL_INVALID_OPERATION is generated. 246 247 If more than one draw buffer is configured 248 with glDrawBuffers (or similar command) and 249 NVX_blend_equation_advanced_multi_draw_buffers is NOT 250 supported and any one or more of the non-NONE draw buffers has 251 GL_FACTOR_MIN_AMD or GL_FACTOR_MAX_AMD configured as the buffer's 252 blend equation, the error GL_INVALID_OPERATION is generated. 253 254 If any source or destination blend factor is one of GL_SRC1_COLOR 255 for that draw buffer, GL_SRC1_ALPHA, GL_ONE_MINUS_SRC1_COLOR, 256 or GL_ONE_MINUS_SRC1_ALPHA (the dual-source blending factors 257 introduced by ARB_blend_func_extended and EXT_blend_func_extended 258 and standardized by OpenGL 3.3) for a given enabled draw buffer, 259 the error GL_INVALID_OPERATION is generated. 260 261 4) Do the blend parameters GL_BLEND_PREMULTIPLIED_SRC_NV and 262 GL_BLEND_OVERLAP_NV apply to GL_FACTOR_MIN_AMD and GL_FACTOR_MAX_AMD. 263 264 RESOLVED: No. 265 266 These blend parameters are intended to affect advanced blend modes 267 expressed as RGBA compositing operators. GL_FACTOR_MIN_ARM and 268 GL_FACTOR_MAX_AMD can be used separately for RGB and alpha so these 269 blend parameters should not apply to them. 270 271 5) Will these blend modes be coherent 272 if NV_blend_equation_advanced_coherent or 273 KHR_blend_equation_advanced_coherent are not supported? 274 275 RESOLVED: No, but they should still operate if 276 NV_blend_minmax_factor is advertised. glBlendBarrierNV or 277 glBlendBarrierKHR will be needed to ensure coherency for 278 overlapping primitives. 279 280 6) What NVIDIA GPUs can be expected to implement this extension? 281 282 RESOLVED: The same set that advertise 283 KHR_blend_equation_advanced_coherent and 284 NV_blend_equation_advanced_coherent. 285 286 In practice, this is Maxwell GPUs and beyond. 287 288 7) Does this extension support OpenGL ES? 289 290 RESOLVED: Yes. 291 292Revision History 293 294 Rev. Date Author Changes 295 ---- -------- -------- ----------------------------------------- 296 3 07/26/2017 mjk public release 297