1Name
2
3    NV_conservative_raster_underestimation
4
5Name Strings
6
7    GL_NV_conservative_raster_underestimation
8
9Contact
10
11    Kedarnath Thangudu, NVIDIA Corporation (kthangudu 'at' nvidia.com)
12
13Contributors
14
15    Mark Kilgard, NVIDIA
16
17Status
18
19    Shipping in NVIDIA release 388.XX drivers and up
20
21Version
22
23    Last Modified Date:         November 15, 2017
24    Revision:                   1
25
26Number
27
28    OpenGL Extension #518
29
30Dependencies
31
32    This extension is written against NV_conservative_raster as applied to
33    OpenGL 4.3 specification (Core Profile).
34
35    This extension interacts with NV_gpu_program4 and NV_gpu_program5.
36    
37Overview
38    
39    The extension NV_conservative_raster provides a new rasterization mode 
40    known as "Overestimated Conservative Rasterization", where any pixel that 
41    is partially covered, even if no sample location is covered, is treated as 
42    fully covered and a corresponding fragment will be shaded.  There is also 
43    an "Underestimated Conservative Rasterization" variant, where only the 
44    pixels that are completely covered by the primitive are rasterized. 
45
46    This extension provides the underestimated conservative rasterization 
47    information for each fragment in the fragment shader through a new
48    built-in gl_FragFullyCoveredNV.
49
50New Procedures and Functions
51
52    None.
53
54New Tokens
55
56    None.
57
58Additions to Chapter 14 of the OpenGL 4.3 (Compatibility Profile) Specification
59(Fixed-Function Primitive Assembly and Rasterization)
60
61    Add a new paragraph at the end of subsection 14.6.X "Conservative 
62    Rasterization" (added by NV_conservative_raster)
63
64    When CONSERVATIVE_RASTERIZATION_NV is enabled, the fragment shader built-in
65    input boolean variable gl_FragFullyCoveredNV will indicate if the fragment 
66    being shaded is completely covered by the primitive.
67
68Additions to Chapter 15 of the OpenGL 4.3 (Compatibility Profile) Specification
69(Programmable Fragment Processing)
70
71    Add to the Section 15.2.2 (Shader Inputs)
72
73    When CONSERVATIVE_RASTERIZATION_NV is enabled, the built-in read-only 
74    variable gl_FragFullyCoveredNV is set to TRUE if the fragment is fully 
75    covered by the generating primitive, and FALSE otherwise.
76
77New State
78
79    None.
80
81Additions to the AGL/GLX/WGL Specifications
82
83    None.
84
85GLX Protocol
86
87    None.
88    
89Modifications to the OpenGL Shading Language Specification, Version 4.30
90
91    Including the following line in a shader can be used to control the 
92    language features described in this extension:
93
94        #extension GL_NV_conservative_raster_underestimation : <behavior>
95
96    where <behavior> is as specified in section 3.3.
97
98    New preprocessor #defines are added to the OpenGL Shading Language:
99
100        #define GL_NV_conservative_raster_underestimation     1
101
102    Modify Section 7.1 (Built-In Language Variables), p. 113
103
104    Add to the list of fragment shader built-ins:
105
106        in bool gl_FragFullyCoveredNV;
107
108    Add the following descriptions for gl_FragFullyCoveredNV:
109
110    The built-in variable gl_FragFullyCoveredNV is a fragment-shader input 
111    variable which is set to TRUE, when CONSERVATIVE_RASTERIZATION_NV is 
112    enabled and the fragment is fully covered by the generating primitive, and 
113    FALSE otherwise. 
114
115Errors
116
117    None.
118
119Interactions with NV_gpu_program4 and NV_gpu_program5
120
121    If NV_gpu_program4 or NV_gpu_program5 is supported and the 
122    "NV_conservative_raster_underestimation" program option is specified, 
123    fragment programs can read the "fragment.fullycovered" attribute to 
124    determine if the fragment is fully covered by the primitive.
125
126    (Add the following rule to the NV_fragment_program4 grammar)
127
128    <attribBasic>   ::= ...
129                      | <fragPrefix> "fullycovered"
130
131    (Add the following to the Table X.X Fragment Attribute Bindings)
132
133    Fragment Attribute Binding  Components  Underlying State
134    --------------------------  ----------  ----------------------------
135    * fragment.fullycovered     (c,-,-,-)   fragment fully covered.
136
137    (Add the following to the Section 2.X.2, Program Grammar)
138
139    If a fragment attribute binding matches "fragment.fullycovered", the "x"
140    component of the fragment attribute variable is set to either 0 or 1,
141    depending on how the fragment is covered by the primitive.  If 
142    CONSERVATIVE_RASTERIZATION is enabled and the fragment is completely 
143    covered by the primitive, the fullycovered attribute is set to 1; 
144    otherwise, it is set to 0.  The "y", "z", and "w" coordinates are 
145    undefined.
146
147    If the "NV_conservative_raster_underestimation" program option is not 
148    specified, "fragment.fullycovered" binding is unavailable.
149
150Issues
151
152    (1) Do you need a new rasterization mode for underestimated conservative 
153    rasterization?
154
155    RESOLVED: Enabling CONSERVATIVE_RASTERIZATION will compute both 
156    overestimated and underestimated coverage for a primitive. A fragment will 
157    be shaded for each pixel that is covered under overestimation and the 
158    underestimation information is provided as a fragment shader input.  By 
159    simply discarding fragments that are not fully covered in the fragment 
160    shader, an application can achieve underestimated rasterization of a 
161    primitive in the final image.
162
163    (2) Should the y, z, and w components of the fragment.fullycovered
164    state for NV_gpu_program4 and NV_gpu_program5 be undefined?
165
166    RESOLVED: Yes.
167
168    The (c,-,-,-) is consistent with all the other scalar attributes in
169    NV_gpu_program*.
170
171    This undefined behavior is limited to the assembly interface and
172    not exposed in GLSL.
173
174    (3) How does having CONSERVATIVE_RASTERIZATION enabled affect the sample 
175    mask (gl_SampleMask) visible in the fragment shader?
176
177    RESOLVED: When you have CONSERVATIVE_RASTERIZATION enabled on, the 
178    gl_SampleMask will unconditionally show all 1's for valid samples.
179
180    Even with all 1's in gl_SampleMask doesn't imply that a fragment is
181    fully covered.
182    
183Revision History
184
185    Revision 1
186      - Internal revisions.
187