• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2
3    NV_representative_fragment_test
4
5Name Strings
6
7    GL_NV_representative_fragment_test
8
9Contacts
10
11    Christoph Kubisch, NVIDIA Corporation (ckubisch 'at' nvidia.com)
12    Kedarnath Thangudu, NVIDIA Corporation (kthangudu 'at' nvidia.com)
13
14Contributors
15
16    Jeff Bolz, NVIDIA Corporation
17    Pat Brown, NVIDIA Corporation
18    Eric Werness, NVIDIA Corporation
19    Pyarelal Knowles, NVIDIA Corporation
20
21Status
22
23    Shipping
24
25Version
26
27    Last Modified Date:     March 7, 2019
28    NVIDIA Revision:        3
29
30Number
31
32    OpenGL Extension #528
33    OpenGL ES Extension #314
34
35Dependencies
36
37    This extension is written against the OpenGL 4.6 Specification
38    (Compatibility Profile), dated May 14, 2018.
39
40    OpenGL 4.5 or OpenGL ES 3.2 is required.
41
42Overview
43
44    This extension provides a new _representative fragment test_ that allows
45    implementations to reduce the amount of rasterization and fragment
46    processing work performed for each point, line, or triangle primitive. For
47    any primitive that produces one or more fragments that pass all other
48    early fragment tests, the implementation is permitted to choose one or
49    more "representative" fragments for processing and discard all other
50    fragments. For draw calls rendering multiple points, lines, or triangles
51    arranged in lists, strips, or fans, the representative fragment test is
52    performed independently for each of those primitives.
53
54    This extension is useful for applications that use an early render pass
55    to determine the full set of primitives that would be visible in the final
56    scene. In this render pass, such applications would set up a fragment
57    shader that enables early fragment tests and writes to an image or shader
58    storage buffer to record the ID of the primitive that generated the
59    fragment. Without this extension, the shader would record the ID
60    separately for each visible fragment of each primitive. With this
61    extension, fewer stores will be performed, particularly for large
62    primitives.
63
64    The representative fragment test has no effect if early fragment tests are
65    not enabled via the fragment shader. The set of fragments discarded by the
66    representative fragment test is implementation-dependent and may vary from
67    frame to frame. In some cases, the representative fragment test may not
68    discard any fragments for a given primitive.
69
70
71New Procedures and Functions
72
73    None
74
75New Tokens
76
77    Accepted by the <cap> parameter of Enable, Disable, and IsEnabled,
78    and by the <pname> parameter of GetBooleanv, GetIntegerv,
79    GetFloatv, and GetDoublev:
80
81        REPRESENTATIVE_FRAGMENT_TEST_NV       0x937F
82
83Modifications to the OpenGL 4.6 Specification (Compatibility Profile)
84
85    Modify Section 14.9, Early Per-Fragment Tests (p. 578)
86
87    (modify second pararaph of the section, p. 578, to document that there are
88     now four optional early fragment tests)
89
90    Three fragment operations are performed, and a further four are
91    optionally performed on each fragment, ...
92
93    (modify the last paragraph, p. 578, to list the new early fragment test)
94
95    If early per-fragment operations are enabled, these tests are also
96    performed:
97
98        * the stencil test (see section 17.3.3);
99        * the depth buffer test (see section 17.3.4); and
100        * the representative fragment test (see section 17.3.X)
101        * occlusion query sample counting (see section 17.3.5)
102
103
104    Modify Section 14.9.4, The Early Fragment Test Qualifier, p. 582
105
106    (modify the first paragraph of the section, p. 582, to enumerate the new
107     test)
108
109    The stencil test, depth buffer test, representative fragment test, and
110    occlusion query sample counting are performed if and only if early
111    fragment tests are enabled in the active fragment shader (see section
112    15.2.4). ...
113
114
115    Insert new section before Section 17.3.5, Occlusion Queries (p. 614)
116
117    Section 17.3.X, Representative Fragment Test
118
119    The representative fragment test allows implementations to reduce the
120    amount of rasterization and fragment processing work performed for each
121    point, line, or triangle primitive. For any primitive that produces one or
122    more fragments that pass all prior early fragment tests, the
123    implementation is permitted to choose one or more "representative"
124    fragments for processing and discard all other fragments. For draw calls
125    rendering multiple points, lines, or triangles arranged in lists, strips,
126    or fans, the representative fragment test is performed independently for
127    each of those primitives. The set of fragments discarded by the
128    representative fragment test is implementation-dependent. In some cases,
129    the representative fragment test may not discard any fragments for a given
130    primitive.
131
132    This test is enabled or disabled using Enable or Disable with the target
133    REPRESENTATIVE_FRAGMENT_NV. If early fragment tests (section 15.2.4) are
134    not enabled in the active fragment shader, the representative fragment
135    test has no effect, even if enabled.
136
137
138Additions to the AGL/GLX/WGL Specifications
139
140    None.
141
142New State
143
144    Get Value                              Type    Get Command   Initial Value   Description                Sec    Attribute
145    ------------------------------------   ----    -----------   -------------   -------------------------  ------ --------------
146    REPRESENTATIVE_FRAGMENT_TEST_NV          B      IsEnabled     GL_FALSE       Representative fragment    17.3.X enable
147                                                                                 test
148
149New Implementation Dependent State
150
151    None
152
153Interactions with OpenGL ES
154
155    If implemented with OpenGL ES, ignore references to GetDoublev.
156
157Issues
158
159    (1) Since the representative fragment test does not have guaranteed
160        behavior, it is sort of a hint.  Should we use the existing hint
161        mechanisms for this extension or simply add an enable?
162
163    RESOLVED:  Use an enable.  Hints are rarely used in OpenGL, and the
164    "FASTEST" vs. "NICEST" vs. "DONT_CARE" doesn't map reasonably to the
165    representative fragment test.
166
167    (2) Should this functionality be exposed as a sub-feature of the depth or
168        stencil tests, as its own separate per-fragment test, or as some piece
169        of state controlling primitive rasterization?
170
171    RESOLVED:  Expose as a per-fragment test.  This test is largely orthogonal
172    to depth testing, other than it is supposed to run after the depth
173    testing.  So coupling it to the depth test doesn't make sense.  Coupling
174    the feature to rasterization also doesn't make too much sense, because the
175    rasterization pipeline stage discarding fragments for this test would
176    depend on a later pipeline stages performing other per-fragment tests
177    (such as the depth test).
178
179
180Revision History
181
182    Revision 3, March 7, 2019 (pknowles)
183    - Add ES interactions.
184
185    Revision 2, September 15, 2018 (pbrown)
186    - Prepare specification for publication.
187
188    Revision 1 (ckubisch and kthangudu)
189    - Internal Revisions
190