1Name 2 3 NV_conservative_raster 4 5Name Strings 6 7 GL_NV_conservative_raster 8 9Contact 10 11 Jeff Bolz, NVIDIA Corporation (jbolz 'at' nvidia.com) 12 13Contributors 14 15 Michael Chock, NVIDIA Corporation 16 17Status 18 19 Shipping. 20 21Version 22 23 Last Modified Date: March 27, 2015 24 Revision: 3 25 26Number 27 28 OpenGL Extension #465 29 OpenGL ES Extension #228 30 31Dependencies 32 33 This extension is written against the OpenGL 4.3 specification 34 (Compatibility Profile) but may be used with the Core profile or 35 OpenGL ES 2.0 or later. 36 37 When this extension is used with the Core profile or an OpenGL ES 38 context, references to functionality specific to the Compatibility 39 Profile can be ignored. 40 41Overview 42 43 This extension adds a "conservative" rasterization mode where any pixel 44 that is partially covered, even if no sample location is covered, is 45 treated as fully covered and a corresponding fragment will be shaded. 46 47 A new control is also added to modify window coordinate snapping 48 precision. 49 50 These controls can be used to implement "binning" to a low-resolution 51 render target, for example to determine which tiles of a sparse texture 52 need to be populated. An app can construct a framebuffer where there is 53 one pixel per tile in the sparse texture, and adjust the number of 54 subpixel bits such that snapping occurs to the same effective grid as when 55 rendering to the sparse texture. Then triangles should cover (at least) 56 the same pixels in the low-res framebuffer as they do tiles in the sparse 57 texture. 58 59 60New Procedures and Functions 61 62 void SubpixelPrecisionBiasNV(uint xbits, uint ybits); 63 64New Tokens 65 66 Accepted by the <cap> parameter of Enable, Disable, IsEnabled: 67 68 CONSERVATIVE_RASTERIZATION_NV 0x9346 69 70 Accepted by the <pname> parameter of GetBooleanv, GetDoublev, 71 GetIntegerv, and GetFloatv: 72 73 SUBPIXEL_PRECISION_BIAS_X_BITS_NV 0x9347 74 SUBPIXEL_PRECISION_BIAS_Y_BITS_NV 0x9348 75 MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV 0x9349 76 77Additions to Chapter 13 of the OpenGL 4.3 (Compatibility Profile) Specification 78(Fixed-Function Vertex Post-Processing) 79 80 Modify subsection 13.6.1 "Controlling the Viewport", p. 469 81 82 Add after the formula for the vertex's window coordinates: 83 84 The vertex's window x and y coordinates may be optionally converted 85 to fixed-point values with <N> fractional bits. If CONSERVATIVE_- 86 RASTERIZATION_NV is disabled (see section 14.6.X), then <N> is the 87 implementation-dependent value of SUBPIXEL_BITS. If CONSERVATIVE_- 88 RASTERIZATION_NV is enabled, <N> is computed as the sum of the value of 89 SUBPIXEL_BITS and programmable values of SUBPIXEL_PRECISION_BIAS_{X,Y}- 90 _BITS_NV. These values may be set with the command 91 92 void SubpixelPrecisionBiasNV(uint xbits, uint ybits); 93 94 When these values are non-zero, the invariance requirement of section 14.2 95 may not apply because the subpixel precision may not be the same at all 96 window coordinates. The initial values of SUBPIXEL_PRECISION_BIAS_{X,Y}- 97 _BITS_NV are zero. If <xbits> or <ybits> are greater than the value of 98 MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV, the error INVALID_VALUE is generated. 99 100 101Additions to Chapter 14 of the OpenGL 4.3 (Compatibility Profile) Specification 102(Fixed-Function Primitive Assembly and Rasterization) 103 104 Add a new subsection at the end of 14.6, 14.6.X "Conservative Rasterization" 105 106 Point, line, and polygon rasterization may optionally be made conservative 107 by calling Enable and Disable with a <pname> of CONSERVATIVE_- 108 RASTERIZATION_NV. When conservative rasterization is enabled, rather than 109 evaluating coverage at individual sample locations, a determination is made 110 of whether any portion of the pixel (including its edges and corners) is 111 covered by the primitive. If any portion of the pixel is covered, then a 112 fragment is generated with all coverage samples turned on. Conservative 113 rasterization may also generate fragments for pixels near the edges of 114 rasterized point or line primitives, even if those pixels are not covered 115 by the primitive. The set of such pixels is implementation-dependent, but 116 implementations are encouraged to evaluate coverage as precisely as 117 possible. 118 119 If CONSERVATIVE_RASTERIZATION_NV is enabled, points are rasterized 120 according to multisample rasterization rules (section 14.4.3), except that 121 a fragment will be generated for a framebuffer pixel if the circle 122 (POINT_SPRITE disabled) or square (POINT_SPRITE enabled) covers any portion 123 of the pixel, including its edges or corners. When performing conservative 124 rasterization of points, the POINT_SMOOTH enable is ignored and treated as 125 disabled. 126 127 If CONSERVATIVE_RASTERIZATION_NV is enabled, lines are rasterized according 128 to multisample rasterization rules (section 14.5.4), except that the 129 LINE_STIPPLE and LINE_SMOOTH enables are ignored and treated as disabled. 130 131 If CONSERVATIVE_RASTERIZATION_NV is enabled, polygons are rasterized 132 according to multisample rasterization rules (section 14.6.6), except that 133 the POLYGON_SMOOTH enable is ignored and treated as disabled. Polygons with 134 an area of zero generate no fragments, even for pixels that contain a 135 vertex or edge of the zero-area polygon. 136 137 Modify the new Subsection "Drawing Textures" from the NV_draw_texture 138 extension: 139 140 In either case, the set of fragments generated is not affected by the 141 CULL_FACE, POLYGON_SMOOTH, POLYGON_OFFSET_FILL enables, or PolygonMode 142 state. The CONVSERVATIVE_RASTERIZATION_NV enable does apply, and fragments 143 will be generated for all pixels which have any portion covered by the 144 rectangle. All fragments generated for the rectangle will have a Z window 145 coordinate of <z>. 146 147 148Interactions with OpenGL ES and Core Profiles 149 150 If using OpenGL ES or a Core profile, references to LINE_SMOOTH, 151 LINE_STIPPLE, POINT_SMOOTH, and POLYGON_SMOOTH are ignored and treated as 152 disabled. POINT_SPRITE is ignored and treated as enabled. For OpenGL ES, 153 references to PolygonMode are ignored. 154 155 156New Implementation Dependent State 157 158 Minimum 159 Get Value Type Get Command Value Description Sec. 160 --------- ------- ----------- ------- ------------------------ ------ 161 MAX_SUBPIXEL_PRECISION_- Z+ GetIntegerv 1 Max number of extra bits 13.6.1 162 BIAS_BITS_NV 163 164 165New State 166 167 Get Value Get Command Type Initial Value Description Sec. Attribute 168 --------- ----------- ---- ------------- ----------- ---- --------- 169 CONSERVATIVE_RASTERIZATION_NV IsEnabled B FALSE Enable conservative 14.6.X enable 170 rasterization rules 171 SUBPIXEL_PRECISION_BIAS_X_BITS_NV GetIntegerv Z+ 0 Additional window x 13.6.1 viewport 172 coordinate precision 173 SUBPIXEL_PRECISION_BIAS_Y_BITS_NV GetIntegerv Z+ 0 Additional window y 13.6.1 viewport 174 coordinate precision 175 176Additions to the AGL/GLX/WGL Specifications 177 178 None. 179 180GLX Protocol 181 182 None. 183 184Modifications to the OpenGL Shading Language Specification, Version 4.30 185 186 None. 187 188Errors 189 190 INVALID_VALUE is generated by SubpixelPrecisionBiasNV if <xbits> or 191 <ybits> are greater than the value of MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV. 192 193Issues 194 195 (1) How is invariance affected by the precision bias? 196 197 RESOLVED: Invariance may be broken for large enough values of the bias. It 198 is expected that an implementation has enough precision to support 199 SUBPIXEL_BITS for a MAX_VIEWPORT_DIMS size viewport, but if the combination 200 of viewport size and total subpixel precision exceed that then less 201 precision may be used for large x,y coordinates. 202 203 (2) Do zero area primitives generate fragments in conservative raster? 204 205 RESOLVED: No, although in some cases that may not be the desired behavior. 206 If a primitive is truly zero area (e.g. two vertices of a triangle have 207 identical positions), then drawing nothing is probably fine. If the 208 primitive happens to be zero area due to subpixel precision then generating 209 fragments may be desirable, but this spec does define that behavior. 210 211 The primary reason to discard zero area primitives is that attribute 212 interpolation is not well-defined when the area is zero. 213 214 (3) How does centroid interpolation work for a conservative primitive? 215 216 RESOLVED: Since a fragment generated by a conservative primitive is 217 considered "fully covered", any location within the pixel may be used for 218 interpolation. This implies that the interpolation may occur outside of the 219 original primitive, causing attribute extrapolation. 220 221 (4) How is depth coordinate evaluation handled for conservative 222 rasterization? 223 224 RESOLVED: The "extrapolation" issue for attributes also applies to depth 225 evaluation. 226 227 (5) How does NV_draw_texture interact with this extension? 228 229 RESOLVED: The DrawTextureNV command rasterizes conservatively. 230 231Revision History 232 233 Revision 3, 2015/03/27 234 - Add ES interactions 235 236 Revision 2, 2014/09/26 (Jon Leech) 237 - Add missing return type to function 238 239 Revision 1 240 - Internal revisions. 241