15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci NV_blend_minmax_factor 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_NV_blend_minmax_factor 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContributors 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Jeff Bolz 125bd8deadSopenharmony_ci Pierre Boudier 135bd8deadSopenharmony_ci Charles Hansen 145bd8deadSopenharmony_ci Bill Sebastian, Visual Music Systems 155bd8deadSopenharmony_ci Graham Sellers, original AMD specification 165bd8deadSopenharmony_ci 175bd8deadSopenharmony_ciContact 185bd8deadSopenharmony_ci 195bd8deadSopenharmony_ci Mark Kilgard, NVIDIA (mjk 'at' nvidia.com) 205bd8deadSopenharmony_ci 215bd8deadSopenharmony_ciStatus 225bd8deadSopenharmony_ci 235bd8deadSopenharmony_ci Implemented in NVIDIA's August 2017 SIGGRAPH driver 245bd8deadSopenharmony_ci 255bd8deadSopenharmony_ciVersion 265bd8deadSopenharmony_ci 275bd8deadSopenharmony_ci Last Modified Date: July 26, 2017 285bd8deadSopenharmony_ci Author Revision: 3 295bd8deadSopenharmony_ci 305bd8deadSopenharmony_ciNumber 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ci OpenGL Extension #510 335bd8deadSopenharmony_ci OpenGL ES Extension #285 345bd8deadSopenharmony_ci 355bd8deadSopenharmony_ciDependencies 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ci The extension is written against the OpenGL 4.1 (Core) Specification. 385bd8deadSopenharmony_ci 395bd8deadSopenharmony_ci OpenGL 1.0 or ES 2.0 is required. 405bd8deadSopenharmony_ci 415bd8deadSopenharmony_ci This extension interacts with 425bd8deadSopenharmony_ci NVX_blend_equation_advanced_multi_draw_buffers as specified. 435bd8deadSopenharmony_ci 445bd8deadSopenharmony_ci This extension interacts with ARB_blend_func_extended, 455bd8deadSopenharmony_ci EXT_blend_func_extended (for ES), or OpenGL 3.3 as specified. 465bd8deadSopenharmony_ci 475bd8deadSopenharmony_ci This extension interacts with NV_blend_equation_advanced, 485bd8deadSopenharmony_ci NV_blend_equation_advanced_coherent, KHR_blend_equation_advanced, 495bd8deadSopenharmony_ci KHR_blend_equation_advanced_coherent, OpenGL 4.5, or ES 3.2 as 505bd8deadSopenharmony_ci specified. 515bd8deadSopenharmony_ci 525bd8deadSopenharmony_ciOverview 535bd8deadSopenharmony_ci 545bd8deadSopenharmony_ci The EXT_blend_minmax extension extended the GL's blending 555bd8deadSopenharmony_ci functionality to allow the blending equation to be specified by the 565bd8deadSopenharmony_ci application. That extension introduced the MIN_EXT and MAX_EXT blend 575bd8deadSopenharmony_ci equations, which caused the result of the blend equation to become 585bd8deadSopenharmony_ci the minimum or maximum of the source color and destination color, 595bd8deadSopenharmony_ci respectively. 605bd8deadSopenharmony_ci 615bd8deadSopenharmony_ci The MIN_EXT and MAX_EXT blend equations, however, do not include the 625bd8deadSopenharmony_ci source or destination blend factors in the arguments to the min and 635bd8deadSopenharmony_ci max functions. This extension provides two new blend equations that 645bd8deadSopenharmony_ci produce the minimum or maximum of the products of the source color 655bd8deadSopenharmony_ci and source factor, and the destination color and destination factor. 665bd8deadSopenharmony_ci 675bd8deadSopenharmony_ci This NVIDIA extension has some limitations relative to the 685bd8deadSopenharmony_ci AMD_blend_minmax_factor extension. See issues #1, #2, and #3. 695bd8deadSopenharmony_ci 705bd8deadSopenharmony_ciNew Procedures and Functions 715bd8deadSopenharmony_ci 725bd8deadSopenharmony_ci None. 735bd8deadSopenharmony_ci 745bd8deadSopenharmony_ciNew Tokens 755bd8deadSopenharmony_ci 765bd8deadSopenharmony_ci Accepted by the <mode> parameter of BlendEquation and BlendEquationi, and by 775bd8deadSopenharmony_ci the <modeRGB> and <modeAlpha> parameters of BlendEquationSeparate and 785bd8deadSopenharmony_ci BlendEquationSeparatei: 795bd8deadSopenharmony_ci 805bd8deadSopenharmony_ci FACTOR_MIN_AMD 0x901C 815bd8deadSopenharmony_ci FACTOR_MAX_AMD 0x901D 825bd8deadSopenharmony_ci 835bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 4.1 (Core) Specification (OpenGL Operation) 845bd8deadSopenharmony_ci 855bd8deadSopenharmony_ci None. 865bd8deadSopenharmony_ci 875bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 4.1 (Core) Specification (Rasterization) 885bd8deadSopenharmony_ci 895bd8deadSopenharmony_ci None. 905bd8deadSopenharmony_ci 915bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 4.1 (Core) Specification (Per-Fragment 925bd8deadSopenharmony_ciOperations and the Frame Buffer) 935bd8deadSopenharmony_ci 945bd8deadSopenharmony_ci Modify the list of accepted tokens for <mode>, <modeRGB> and <modeAlpha> 955bd8deadSopenharmony_ci in the description of BlendEquation{i} and BlendEquationSeparate{i}, p.262: 965bd8deadSopenharmony_ci 975bd8deadSopenharmony_ci "... <mode>, <modeRGB>, <modeAlpha> must be one of FUNC_ADD, FUNC_SUBTRACT, 985bd8deadSopenharmony_ci FUNC_REVERSE_SUBTRACT, MIN, MAX, FACTOR_MIN_AMD, or FACTOR_MAX_AMD. ..." 995bd8deadSopenharmony_ci 1005bd8deadSopenharmony_ci Add to Table 4.1: RGB and Alpha Blend Equations 1015bd8deadSopenharmony_ci 1025bd8deadSopenharmony_ci +-----------------+---------------------------+-----------------------------+ 1035bd8deadSopenharmony_ci | Mode | RGB Components | Alpha Component | 1045bd8deadSopenharmony_ci +-----------------+---------------------------+-----------------------------+ 1055bd8deadSopenharmony_ci | FACTOR_MIN_AMD | R = min(Rs * Sr, Rd * Dr) | A = min(As * Sa, Ad * Da) | 1065bd8deadSopenharmony_ci | | G = min(Gs * Sg, Gd * Dg) | | 1075bd8deadSopenharmony_ci | | B = min(Bs * Sb, Bd * Db) | | 1085bd8deadSopenharmony_ci +-----------------+---------------------------+-----------------------------+ 1095bd8deadSopenharmony_ci | FACTOR_MAX_AMD | R = max(Rs * Sr, Rd * Dr) | A = max(As * Sa, Ad * Da) | 1105bd8deadSopenharmony_ci | | G = max(Gs * Sg, Gd * Dg) | | 1115bd8deadSopenharmony_ci | | B = max(Bs * Sb, Bd * Db) | | 1125bd8deadSopenharmony_ci +-----------------+---------------------------+-----------------------------+ 1135bd8deadSopenharmony_ci 1145bd8deadSopenharmony_ci Add the following precision limitation after table 4.1: 1155bd8deadSopenharmony_ci 1165bd8deadSopenharmony_ci "An implementation may perform the computations for the FACTOR_MIN_AMD 1175bd8deadSopenharmony_ci and FACTOR_MAX_AMD modes in half-precsion floating-point even 1185bd8deadSopenharmony_ci when the representable range of the framebuffer is can represent 1195bd8deadSopenharmony_ci single-precision or better color components." 1205bd8deadSopenharmony_ci 1215bd8deadSopenharmony_ci Add the following orthogonality restriction after table 4.1: 1225bd8deadSopenharmony_ci 1235bd8deadSopenharmony_ci "When the NVX_blend_equation_advanced_multi_draw_buffers is not 1245bd8deadSopenharmony_ci supported, the FACTOR_MIN_AMD and FACTOR_MAX_AMD blending equations 1255bd8deadSopenharmony_ci are supported only when rendering to a single color buffer using 1265bd8deadSopenharmony_ci fragment color zero. In this case, if any non-NONE draw buffer 1275bd8deadSopenharmony_ci enabled for blending uses either the FACTOR_MIN_AMD and FACTOR_MAX_AMD 1285bd8deadSopenharmony_ci blending equations, the error INVALID_OPERATION is generated by 1295bd8deadSopenharmony_ci [[Compatibility Profile: Begin or any operation that implicitly 1305bd8deadSopenharmony_ci calls Begin (such as DrawElements)]] [[Core Profile: DrawArrays 1315bd8deadSopenharmony_ci and the other drawing commands defined in section 2.8.3]] if: 1325bd8deadSopenharmony_ci 1335bd8deadSopenharmony_ci * the draw buffer for color output zero selects multiple color buffers 1345bd8deadSopenharmony_ci (e.g., FRONT_AND_BACK in the default framebuffer); or 1355bd8deadSopenharmony_ci 1365bd8deadSopenharmony_ci * the draw buffer for any other color output is not NONE. 1375bd8deadSopenharmony_ci 1385bd8deadSopenharmony_ci Alternatively when the NVX_blend_equation_advanced_multi_draw_buffers 1395bd8deadSopenharmony_ci is supported, if any non-NONE draw buffer enabled for blending uses 1405bd8deadSopenharmony_ci a blend equation of either FACTOR_MIN_AMD or FACTOR_MAX_AMD for 1415bd8deadSopenharmony_ci either RGB or alpha, the error INVALID_OPERATION is generated by 1425bd8deadSopenharmony_ci [[Compatibility Profile: Begin or any operation that implicitly 1435bd8deadSopenharmony_ci calls Begin (such as DrawElements)]] [[Core Profile: DrawArrays 1445bd8deadSopenharmony_ci and the other drawing commands defined in section 2.8.3]] if any 1455bd8deadSopenharmony_ci other non-NONE draw buffer uses a different combination of the 1465bd8deadSopenharmony_ci first draw buffer's RGB and alpha blend equation." In other words, 1475bd8deadSopenharmony_ci the FACTOR_MIN_AMD or FACTOR_MAX_AMD blend equations are now allowed 1485bd8deadSopenharmony_ci with multiple draw buffers as long as they use they use identical 1495bd8deadSopenharmony_ci blend equations for RGB and alpha for all non-NONE draw buffers. 1505bd8deadSopenharmony_ci 1515bd8deadSopenharmony_ci If any non-NONE draw buffer enabled for blending uses any of 1525bd8deadSopenharmony_ci SRC1_COLOR, SRC1_ALPHA, ONE_MINUS_SRC1_COLOR, or ONE_MINUS_SRC1_ALPHA 1535bd8deadSopenharmony_ci for a source or destination blend function, the error 1545bd8deadSopenharmony_ci INVALID_OPERATION is generated by [[Compatibility Profile: Begin or 1555bd8deadSopenharmony_ci any operation that implicitly calls Begin (such as DrawElements)]] 1565bd8deadSopenharmony_ci [[Core Profile: DrawArrays and the other drawing commands defined 1575bd8deadSopenharmony_ci in section 2.8.3]]." 1585bd8deadSopenharmony_ci 1595bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 4.1 (Core) Specification (Special Functions) 1605bd8deadSopenharmony_ci 1615bd8deadSopenharmony_ci None. 1625bd8deadSopenharmony_ci 1635bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 4.1 (Core) Specification (State and 1645bd8deadSopenharmony_ciState Requests) 1655bd8deadSopenharmony_ci 1665bd8deadSopenharmony_ci None. 1675bd8deadSopenharmony_ci 1685bd8deadSopenharmony_ciAdditions to Appendix A of the OpenGL 4.1 (Core) Specification (Invariance) 1695bd8deadSopenharmony_ci 1705bd8deadSopenharmony_ci None. 1715bd8deadSopenharmony_ci 1725bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications 1735bd8deadSopenharmony_ci 1745bd8deadSopenharmony_ci None. 1755bd8deadSopenharmony_ci 1765bd8deadSopenharmony_ciErrors 1775bd8deadSopenharmony_ci 1785bd8deadSopenharmony_ci None. 1795bd8deadSopenharmony_ci 1805bd8deadSopenharmony_ciNew State 1815bd8deadSopenharmony_ci 1825bd8deadSopenharmony_ci Modify Table 6.21: Pixel Operations (cont.) p.343 1835bd8deadSopenharmony_ci 1845bd8deadSopenharmony_ci Change entries for BLEND_EQUATION_ALPHA and BLEND_EQUATION_RGB to: 1855bd8deadSopenharmony_ci 1865bd8deadSopenharmony_ci +----------------------+---------+---------------+---------------+-------------------------+-------+ 1875bd8deadSopenharmony_ci | Get Value | Type | Get Command | Initial Value | Description | Sec. | 1885bd8deadSopenharmony_ci +----------------------+---------+---------------+---------------+-------------------------+-------+ 1895bd8deadSopenharmony_ci | BLEND_EQUATION_RGB | 8* x Z7 | GetIntegeri_v | FUNC_ADD | RGB Blending Equation | 4.1.7 | 1905bd8deadSopenharmony_ci | | | | | for Draw Buffer i | | 1915bd8deadSopenharmony_ci +----------------------+---------+---------------+---------------+-------------------------+-------+ 1925bd8deadSopenharmony_ci | BLEND_EQUATION_ALPHA | 8* x Z7 | GetIntegeri_v | FUNC_ADD | Alpha Blending Equation | 4.1.7 | 1935bd8deadSopenharmony_ci | | | | | for Draw Buffer i | | 1945bd8deadSopenharmony_ci +----------------------+---------+---------------+---------------+-------------------------+-------+ 1955bd8deadSopenharmony_ci 1965bd8deadSopenharmony_ci * Note that the only change change is that BLEND_EQUATION_RGB and 1975bd8deadSopenharmony_ci BLEND_EQUATION_ALPHA are now Z7 rather than Z5. 1985bd8deadSopenharmony_ci 1995bd8deadSopenharmony_ciIssues 2005bd8deadSopenharmony_ci 2015bd8deadSopenharmony_ci 1) Why not just implement AMD_blend_factor_minmax? 2025bd8deadSopenharmony_ci 2035bd8deadSopenharmony_ci RESOLVED: NVIDIA has a precision limitation and orthogonality 2045bd8deadSopenharmony_ci restrictions. 2055bd8deadSopenharmony_ci 2065bd8deadSopenharmony_ci Rather than pollute the AMD extension with an incomplete 2075bd8deadSopenharmony_ci implementation, this comparable NV version is API-consistent 2085bd8deadSopenharmony_ci (uses the same token values) and same blending math but documents 2095bd8deadSopenharmony_ci its precision limitation and restrictions. 2105bd8deadSopenharmony_ci 2115bd8deadSopenharmony_ci 2) What is the precision limitation? 2125bd8deadSopenharmony_ci 2135bd8deadSopenharmony_ci The GL_FACTOR_MIN_AMD and GL_FACTOR_MAX_AMD blend functions are 2145bd8deadSopenharmony_ci allowed to compute their blend results in half-precision even 2155bd8deadSopenharmony_ci when the framebuffer format is single-precision. In practice, 2165bd8deadSopenharmony_ci this means the blend modes work but will quantize results 2175bd8deadSopenharmony_ci to the representable range of half-precision, even if the 2185bd8deadSopenharmony_ci framebuffer is full precision. 2195bd8deadSopenharmony_ci 2205bd8deadSopenharmony_ci This limitation matches the allowance of the advanced blend 2215bd8deadSopenharmony_ci equations introduced by NV_blend_equation_advanced (and 2225bd8deadSopenharmony_ci standardized by KHR_blend_equation and OpenGL 4.5 and ES 3.2). 2235bd8deadSopenharmony_ci 2245bd8deadSopenharmony_ci This means magnitudes beyond the largest representable magnitude 2255bd8deadSopenharmony_ci of half-precision may be mapped to infinity. Magnitudes less 2265bd8deadSopenharmony_ci than the smallest representable non-zero magnitude may be mapped 2275bd8deadSopenharmony_ci to zero. Mantissa bits may be quantied. 2285bd8deadSopenharmony_ci 2295bd8deadSopenharmony_ci While this limitation allows implementations to perform these 2305bd8deadSopenharmony_ci blend modes in half-precision, it does not require the blend 2315bd8deadSopenharmony_ci modes to be performed in half-precsion. Implementations are 2325bd8deadSopenharmony_ci allowed to blend with better numerics than half-precision. 2335bd8deadSopenharmony_ci This being said, expect NVIDIA implementations circa 2017 to 2345bd8deadSopenharmony_ci implement these blend modes using half-precision numerics. 2355bd8deadSopenharmony_ci 2365bd8deadSopenharmony_ci 3) What are the orthogonality restrictions? 2375bd8deadSopenharmony_ci 2385bd8deadSopenharmony_ci If more than one draw buffer is configured 2395bd8deadSopenharmony_ci with glDrawBuffers (or similar command) and 2405bd8deadSopenharmony_ci NVX_blend_equation_advanced_multi_draw_buffers is supported and at 2415bd8deadSopenharmony_ci least one of the non-NONE draw buffers has GL_FACTOR_MIN_AMD or 2425bd8deadSopenharmony_ci GL_FACTOR_MAX_AMD configured as the buffer's RGB or alpha blend 2435bd8deadSopenharmony_ci equation, then all non-NONE draw buffers must have identical 2445bd8deadSopenharmony_ci blend equations configuration for RGB and alpha; otherwise the 2455bd8deadSopenharmony_ci error GL_INVALID_OPERATION is generated. 2465bd8deadSopenharmony_ci 2475bd8deadSopenharmony_ci If more than one draw buffer is configured 2485bd8deadSopenharmony_ci with glDrawBuffers (or similar command) and 2495bd8deadSopenharmony_ci NVX_blend_equation_advanced_multi_draw_buffers is NOT 2505bd8deadSopenharmony_ci supported and any one or more of the non-NONE draw buffers has 2515bd8deadSopenharmony_ci GL_FACTOR_MIN_AMD or GL_FACTOR_MAX_AMD configured as the buffer's 2525bd8deadSopenharmony_ci blend equation, the error GL_INVALID_OPERATION is generated. 2535bd8deadSopenharmony_ci 2545bd8deadSopenharmony_ci If any source or destination blend factor is one of GL_SRC1_COLOR 2555bd8deadSopenharmony_ci for that draw buffer, GL_SRC1_ALPHA, GL_ONE_MINUS_SRC1_COLOR, 2565bd8deadSopenharmony_ci or GL_ONE_MINUS_SRC1_ALPHA (the dual-source blending factors 2575bd8deadSopenharmony_ci introduced by ARB_blend_func_extended and EXT_blend_func_extended 2585bd8deadSopenharmony_ci and standardized by OpenGL 3.3) for a given enabled draw buffer, 2595bd8deadSopenharmony_ci the error GL_INVALID_OPERATION is generated. 2605bd8deadSopenharmony_ci 2615bd8deadSopenharmony_ci 4) Do the blend parameters GL_BLEND_PREMULTIPLIED_SRC_NV and 2625bd8deadSopenharmony_ci GL_BLEND_OVERLAP_NV apply to GL_FACTOR_MIN_AMD and GL_FACTOR_MAX_AMD. 2635bd8deadSopenharmony_ci 2645bd8deadSopenharmony_ci RESOLVED: No. 2655bd8deadSopenharmony_ci 2665bd8deadSopenharmony_ci These blend parameters are intended to affect advanced blend modes 2675bd8deadSopenharmony_ci expressed as RGBA compositing operators. GL_FACTOR_MIN_ARM and 2685bd8deadSopenharmony_ci GL_FACTOR_MAX_AMD can be used separately for RGB and alpha so these 2695bd8deadSopenharmony_ci blend parameters should not apply to them. 2705bd8deadSopenharmony_ci 2715bd8deadSopenharmony_ci 5) Will these blend modes be coherent 2725bd8deadSopenharmony_ci if NV_blend_equation_advanced_coherent or 2735bd8deadSopenharmony_ci KHR_blend_equation_advanced_coherent are not supported? 2745bd8deadSopenharmony_ci 2755bd8deadSopenharmony_ci RESOLVED: No, but they should still operate if 2765bd8deadSopenharmony_ci NV_blend_minmax_factor is advertised. glBlendBarrierNV or 2775bd8deadSopenharmony_ci glBlendBarrierKHR will be needed to ensure coherency for 2785bd8deadSopenharmony_ci overlapping primitives. 2795bd8deadSopenharmony_ci 2805bd8deadSopenharmony_ci 6) What NVIDIA GPUs can be expected to implement this extension? 2815bd8deadSopenharmony_ci 2825bd8deadSopenharmony_ci RESOLVED: The same set that advertise 2835bd8deadSopenharmony_ci KHR_blend_equation_advanced_coherent and 2845bd8deadSopenharmony_ci NV_blend_equation_advanced_coherent. 2855bd8deadSopenharmony_ci 2865bd8deadSopenharmony_ci In practice, this is Maxwell GPUs and beyond. 2875bd8deadSopenharmony_ci 2885bd8deadSopenharmony_ci 7) Does this extension support OpenGL ES? 2895bd8deadSopenharmony_ci 2905bd8deadSopenharmony_ci RESOLVED: Yes. 2915bd8deadSopenharmony_ci 2925bd8deadSopenharmony_ciRevision History 2935bd8deadSopenharmony_ci 2945bd8deadSopenharmony_ci Rev. Date Author Changes 2955bd8deadSopenharmony_ci ---- -------- -------- ----------------------------------------- 2965bd8deadSopenharmony_ci 3 07/26/2017 mjk public release 297