15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci NV_conservative_raster 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_NV_conservative_raster 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Jeff Bolz, NVIDIA Corporation (jbolz 'at' nvidia.com) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciContributors 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci Michael Chock, NVIDIA Corporation 165bd8deadSopenharmony_ci 175bd8deadSopenharmony_ciStatus 185bd8deadSopenharmony_ci 195bd8deadSopenharmony_ci Shipping. 205bd8deadSopenharmony_ci 215bd8deadSopenharmony_ciVersion 225bd8deadSopenharmony_ci 235bd8deadSopenharmony_ci Last Modified Date: March 27, 2015 245bd8deadSopenharmony_ci Revision: 3 255bd8deadSopenharmony_ci 265bd8deadSopenharmony_ciNumber 275bd8deadSopenharmony_ci 285bd8deadSopenharmony_ci OpenGL Extension #465 295bd8deadSopenharmony_ci OpenGL ES Extension #228 305bd8deadSopenharmony_ci 315bd8deadSopenharmony_ciDependencies 325bd8deadSopenharmony_ci 335bd8deadSopenharmony_ci This extension is written against the OpenGL 4.3 specification 345bd8deadSopenharmony_ci (Compatibility Profile) but may be used with the Core profile or 355bd8deadSopenharmony_ci OpenGL ES 2.0 or later. 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ci When this extension is used with the Core profile or an OpenGL ES 385bd8deadSopenharmony_ci context, references to functionality specific to the Compatibility 395bd8deadSopenharmony_ci Profile can be ignored. 405bd8deadSopenharmony_ci 415bd8deadSopenharmony_ciOverview 425bd8deadSopenharmony_ci 435bd8deadSopenharmony_ci This extension adds a "conservative" rasterization mode where any pixel 445bd8deadSopenharmony_ci that is partially covered, even if no sample location is covered, is 455bd8deadSopenharmony_ci treated as fully covered and a corresponding fragment will be shaded. 465bd8deadSopenharmony_ci 475bd8deadSopenharmony_ci A new control is also added to modify window coordinate snapping 485bd8deadSopenharmony_ci precision. 495bd8deadSopenharmony_ci 505bd8deadSopenharmony_ci These controls can be used to implement "binning" to a low-resolution 515bd8deadSopenharmony_ci render target, for example to determine which tiles of a sparse texture 525bd8deadSopenharmony_ci need to be populated. An app can construct a framebuffer where there is 535bd8deadSopenharmony_ci one pixel per tile in the sparse texture, and adjust the number of 545bd8deadSopenharmony_ci subpixel bits such that snapping occurs to the same effective grid as when 555bd8deadSopenharmony_ci rendering to the sparse texture. Then triangles should cover (at least) 565bd8deadSopenharmony_ci the same pixels in the low-res framebuffer as they do tiles in the sparse 575bd8deadSopenharmony_ci texture. 585bd8deadSopenharmony_ci 595bd8deadSopenharmony_ci 605bd8deadSopenharmony_ciNew Procedures and Functions 615bd8deadSopenharmony_ci 625bd8deadSopenharmony_ci void SubpixelPrecisionBiasNV(uint xbits, uint ybits); 635bd8deadSopenharmony_ci 645bd8deadSopenharmony_ciNew Tokens 655bd8deadSopenharmony_ci 665bd8deadSopenharmony_ci Accepted by the <cap> parameter of Enable, Disable, IsEnabled: 675bd8deadSopenharmony_ci 685bd8deadSopenharmony_ci CONSERVATIVE_RASTERIZATION_NV 0x9346 695bd8deadSopenharmony_ci 705bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetBooleanv, GetDoublev, 715bd8deadSopenharmony_ci GetIntegerv, and GetFloatv: 725bd8deadSopenharmony_ci 735bd8deadSopenharmony_ci SUBPIXEL_PRECISION_BIAS_X_BITS_NV 0x9347 745bd8deadSopenharmony_ci SUBPIXEL_PRECISION_BIAS_Y_BITS_NV 0x9348 755bd8deadSopenharmony_ci MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV 0x9349 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ciAdditions to Chapter 13 of the OpenGL 4.3 (Compatibility Profile) Specification 785bd8deadSopenharmony_ci(Fixed-Function Vertex Post-Processing) 795bd8deadSopenharmony_ci 805bd8deadSopenharmony_ci Modify subsection 13.6.1 "Controlling the Viewport", p. 469 815bd8deadSopenharmony_ci 825bd8deadSopenharmony_ci Add after the formula for the vertex's window coordinates: 835bd8deadSopenharmony_ci 845bd8deadSopenharmony_ci The vertex's window x and y coordinates may be optionally converted 855bd8deadSopenharmony_ci to fixed-point values with <N> fractional bits. If CONSERVATIVE_- 865bd8deadSopenharmony_ci RASTERIZATION_NV is disabled (see section 14.6.X), then <N> is the 875bd8deadSopenharmony_ci implementation-dependent value of SUBPIXEL_BITS. If CONSERVATIVE_- 885bd8deadSopenharmony_ci RASTERIZATION_NV is enabled, <N> is computed as the sum of the value of 895bd8deadSopenharmony_ci SUBPIXEL_BITS and programmable values of SUBPIXEL_PRECISION_BIAS_{X,Y}- 905bd8deadSopenharmony_ci _BITS_NV. These values may be set with the command 915bd8deadSopenharmony_ci 925bd8deadSopenharmony_ci void SubpixelPrecisionBiasNV(uint xbits, uint ybits); 935bd8deadSopenharmony_ci 945bd8deadSopenharmony_ci When these values are non-zero, the invariance requirement of section 14.2 955bd8deadSopenharmony_ci may not apply because the subpixel precision may not be the same at all 965bd8deadSopenharmony_ci window coordinates. The initial values of SUBPIXEL_PRECISION_BIAS_{X,Y}- 975bd8deadSopenharmony_ci _BITS_NV are zero. If <xbits> or <ybits> are greater than the value of 985bd8deadSopenharmony_ci MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV, the error INVALID_VALUE is generated. 995bd8deadSopenharmony_ci 1005bd8deadSopenharmony_ci 1015bd8deadSopenharmony_ciAdditions to Chapter 14 of the OpenGL 4.3 (Compatibility Profile) Specification 1025bd8deadSopenharmony_ci(Fixed-Function Primitive Assembly and Rasterization) 1035bd8deadSopenharmony_ci 1045bd8deadSopenharmony_ci Add a new subsection at the end of 14.6, 14.6.X "Conservative Rasterization" 1055bd8deadSopenharmony_ci 1065bd8deadSopenharmony_ci Point, line, and polygon rasterization may optionally be made conservative 1075bd8deadSopenharmony_ci by calling Enable and Disable with a <pname> of CONSERVATIVE_- 1085bd8deadSopenharmony_ci RASTERIZATION_NV. When conservative rasterization is enabled, rather than 1095bd8deadSopenharmony_ci evaluating coverage at individual sample locations, a determination is made 1105bd8deadSopenharmony_ci of whether any portion of the pixel (including its edges and corners) is 1115bd8deadSopenharmony_ci covered by the primitive. If any portion of the pixel is covered, then a 1125bd8deadSopenharmony_ci fragment is generated with all coverage samples turned on. Conservative 1135bd8deadSopenharmony_ci rasterization may also generate fragments for pixels near the edges of 1145bd8deadSopenharmony_ci rasterized point or line primitives, even if those pixels are not covered 1155bd8deadSopenharmony_ci by the primitive. The set of such pixels is implementation-dependent, but 1165bd8deadSopenharmony_ci implementations are encouraged to evaluate coverage as precisely as 1175bd8deadSopenharmony_ci possible. 1185bd8deadSopenharmony_ci 1195bd8deadSopenharmony_ci If CONSERVATIVE_RASTERIZATION_NV is enabled, points are rasterized 1205bd8deadSopenharmony_ci according to multisample rasterization rules (section 14.4.3), except that 1215bd8deadSopenharmony_ci a fragment will be generated for a framebuffer pixel if the circle 1225bd8deadSopenharmony_ci (POINT_SPRITE disabled) or square (POINT_SPRITE enabled) covers any portion 1235bd8deadSopenharmony_ci of the pixel, including its edges or corners. When performing conservative 1245bd8deadSopenharmony_ci rasterization of points, the POINT_SMOOTH enable is ignored and treated as 1255bd8deadSopenharmony_ci disabled. 1265bd8deadSopenharmony_ci 1275bd8deadSopenharmony_ci If CONSERVATIVE_RASTERIZATION_NV is enabled, lines are rasterized according 1285bd8deadSopenharmony_ci to multisample rasterization rules (section 14.5.4), except that the 1295bd8deadSopenharmony_ci LINE_STIPPLE and LINE_SMOOTH enables are ignored and treated as disabled. 1305bd8deadSopenharmony_ci 1315bd8deadSopenharmony_ci If CONSERVATIVE_RASTERIZATION_NV is enabled, polygons are rasterized 1325bd8deadSopenharmony_ci according to multisample rasterization rules (section 14.6.6), except that 1335bd8deadSopenharmony_ci the POLYGON_SMOOTH enable is ignored and treated as disabled. Polygons with 1345bd8deadSopenharmony_ci an area of zero generate no fragments, even for pixels that contain a 1355bd8deadSopenharmony_ci vertex or edge of the zero-area polygon. 1365bd8deadSopenharmony_ci 1375bd8deadSopenharmony_ci Modify the new Subsection "Drawing Textures" from the NV_draw_texture 1385bd8deadSopenharmony_ci extension: 1395bd8deadSopenharmony_ci 1405bd8deadSopenharmony_ci In either case, the set of fragments generated is not affected by the 1415bd8deadSopenharmony_ci CULL_FACE, POLYGON_SMOOTH, POLYGON_OFFSET_FILL enables, or PolygonMode 1425bd8deadSopenharmony_ci state. The CONVSERVATIVE_RASTERIZATION_NV enable does apply, and fragments 1435bd8deadSopenharmony_ci will be generated for all pixels which have any portion covered by the 1445bd8deadSopenharmony_ci rectangle. All fragments generated for the rectangle will have a Z window 1455bd8deadSopenharmony_ci coordinate of <z>. 1465bd8deadSopenharmony_ci 1475bd8deadSopenharmony_ci 1485bd8deadSopenharmony_ciInteractions with OpenGL ES and Core Profiles 1495bd8deadSopenharmony_ci 1505bd8deadSopenharmony_ci If using OpenGL ES or a Core profile, references to LINE_SMOOTH, 1515bd8deadSopenharmony_ci LINE_STIPPLE, POINT_SMOOTH, and POLYGON_SMOOTH are ignored and treated as 1525bd8deadSopenharmony_ci disabled. POINT_SPRITE is ignored and treated as enabled. For OpenGL ES, 1535bd8deadSopenharmony_ci references to PolygonMode are ignored. 1545bd8deadSopenharmony_ci 1555bd8deadSopenharmony_ci 1565bd8deadSopenharmony_ciNew Implementation Dependent State 1575bd8deadSopenharmony_ci 1585bd8deadSopenharmony_ci Minimum 1595bd8deadSopenharmony_ci Get Value Type Get Command Value Description Sec. 1605bd8deadSopenharmony_ci --------- ------- ----------- ------- ------------------------ ------ 1615bd8deadSopenharmony_ci MAX_SUBPIXEL_PRECISION_- Z+ GetIntegerv 1 Max number of extra bits 13.6.1 1625bd8deadSopenharmony_ci BIAS_BITS_NV 1635bd8deadSopenharmony_ci 1645bd8deadSopenharmony_ci 1655bd8deadSopenharmony_ciNew State 1665bd8deadSopenharmony_ci 1675bd8deadSopenharmony_ci Get Value Get Command Type Initial Value Description Sec. Attribute 1685bd8deadSopenharmony_ci --------- ----------- ---- ------------- ----------- ---- --------- 1695bd8deadSopenharmony_ci CONSERVATIVE_RASTERIZATION_NV IsEnabled B FALSE Enable conservative 14.6.X enable 1705bd8deadSopenharmony_ci rasterization rules 1715bd8deadSopenharmony_ci SUBPIXEL_PRECISION_BIAS_X_BITS_NV GetIntegerv Z+ 0 Additional window x 13.6.1 viewport 1725bd8deadSopenharmony_ci coordinate precision 1735bd8deadSopenharmony_ci SUBPIXEL_PRECISION_BIAS_Y_BITS_NV GetIntegerv Z+ 0 Additional window y 13.6.1 viewport 1745bd8deadSopenharmony_ci coordinate precision 1755bd8deadSopenharmony_ci 1765bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications 1775bd8deadSopenharmony_ci 1785bd8deadSopenharmony_ci None. 1795bd8deadSopenharmony_ci 1805bd8deadSopenharmony_ciGLX Protocol 1815bd8deadSopenharmony_ci 1825bd8deadSopenharmony_ci None. 1835bd8deadSopenharmony_ci 1845bd8deadSopenharmony_ciModifications to the OpenGL Shading Language Specification, Version 4.30 1855bd8deadSopenharmony_ci 1865bd8deadSopenharmony_ci None. 1875bd8deadSopenharmony_ci 1885bd8deadSopenharmony_ciErrors 1895bd8deadSopenharmony_ci 1905bd8deadSopenharmony_ci INVALID_VALUE is generated by SubpixelPrecisionBiasNV if <xbits> or 1915bd8deadSopenharmony_ci <ybits> are greater than the value of MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV. 1925bd8deadSopenharmony_ci 1935bd8deadSopenharmony_ciIssues 1945bd8deadSopenharmony_ci 1955bd8deadSopenharmony_ci (1) How is invariance affected by the precision bias? 1965bd8deadSopenharmony_ci 1975bd8deadSopenharmony_ci RESOLVED: Invariance may be broken for large enough values of the bias. It 1985bd8deadSopenharmony_ci is expected that an implementation has enough precision to support 1995bd8deadSopenharmony_ci SUBPIXEL_BITS for a MAX_VIEWPORT_DIMS size viewport, but if the combination 2005bd8deadSopenharmony_ci of viewport size and total subpixel precision exceed that then less 2015bd8deadSopenharmony_ci precision may be used for large x,y coordinates. 2025bd8deadSopenharmony_ci 2035bd8deadSopenharmony_ci (2) Do zero area primitives generate fragments in conservative raster? 2045bd8deadSopenharmony_ci 2055bd8deadSopenharmony_ci RESOLVED: No, although in some cases that may not be the desired behavior. 2065bd8deadSopenharmony_ci If a primitive is truly zero area (e.g. two vertices of a triangle have 2075bd8deadSopenharmony_ci identical positions), then drawing nothing is probably fine. If the 2085bd8deadSopenharmony_ci primitive happens to be zero area due to subpixel precision then generating 2095bd8deadSopenharmony_ci fragments may be desirable, but this spec does define that behavior. 2105bd8deadSopenharmony_ci 2115bd8deadSopenharmony_ci The primary reason to discard zero area primitives is that attribute 2125bd8deadSopenharmony_ci interpolation is not well-defined when the area is zero. 2135bd8deadSopenharmony_ci 2145bd8deadSopenharmony_ci (3) How does centroid interpolation work for a conservative primitive? 2155bd8deadSopenharmony_ci 2165bd8deadSopenharmony_ci RESOLVED: Since a fragment generated by a conservative primitive is 2175bd8deadSopenharmony_ci considered "fully covered", any location within the pixel may be used for 2185bd8deadSopenharmony_ci interpolation. This implies that the interpolation may occur outside of the 2195bd8deadSopenharmony_ci original primitive, causing attribute extrapolation. 2205bd8deadSopenharmony_ci 2215bd8deadSopenharmony_ci (4) How is depth coordinate evaluation handled for conservative 2225bd8deadSopenharmony_ci rasterization? 2235bd8deadSopenharmony_ci 2245bd8deadSopenharmony_ci RESOLVED: The "extrapolation" issue for attributes also applies to depth 2255bd8deadSopenharmony_ci evaluation. 2265bd8deadSopenharmony_ci 2275bd8deadSopenharmony_ci (5) How does NV_draw_texture interact with this extension? 2285bd8deadSopenharmony_ci 2295bd8deadSopenharmony_ci RESOLVED: The DrawTextureNV command rasterizes conservatively. 2305bd8deadSopenharmony_ci 2315bd8deadSopenharmony_ciRevision History 2325bd8deadSopenharmony_ci 2335bd8deadSopenharmony_ci Revision 3, 2015/03/27 2345bd8deadSopenharmony_ci - Add ES interactions 2355bd8deadSopenharmony_ci 2365bd8deadSopenharmony_ci Revision 2, 2014/09/26 (Jon Leech) 2375bd8deadSopenharmony_ci - Add missing return type to function 2385bd8deadSopenharmony_ci 2395bd8deadSopenharmony_ci Revision 1 2405bd8deadSopenharmony_ci - Internal revisions. 241