15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    NV_representative_fragment_test
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_NV_representative_fragment_test
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContacts
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Christoph Kubisch, NVIDIA Corporation (ckubisch 'at' nvidia.com)
125bd8deadSopenharmony_ci    Kedarnath Thangudu, NVIDIA Corporation (kthangudu 'at' nvidia.com)
135bd8deadSopenharmony_ci
145bd8deadSopenharmony_ciContributors
155bd8deadSopenharmony_ci
165bd8deadSopenharmony_ci    Jeff Bolz, NVIDIA Corporation
175bd8deadSopenharmony_ci    Pat Brown, NVIDIA Corporation
185bd8deadSopenharmony_ci    Eric Werness, NVIDIA Corporation
195bd8deadSopenharmony_ci    Pyarelal Knowles, NVIDIA Corporation
205bd8deadSopenharmony_ci
215bd8deadSopenharmony_ciStatus
225bd8deadSopenharmony_ci
235bd8deadSopenharmony_ci    Shipping
245bd8deadSopenharmony_ci
255bd8deadSopenharmony_ciVersion
265bd8deadSopenharmony_ci
275bd8deadSopenharmony_ci    Last Modified Date:     March 7, 2019
285bd8deadSopenharmony_ci    NVIDIA Revision:        3
295bd8deadSopenharmony_ci
305bd8deadSopenharmony_ciNumber
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ci    OpenGL Extension #528
335bd8deadSopenharmony_ci    OpenGL ES Extension #314
345bd8deadSopenharmony_ci
355bd8deadSopenharmony_ciDependencies
365bd8deadSopenharmony_ci
375bd8deadSopenharmony_ci    This extension is written against the OpenGL 4.6 Specification
385bd8deadSopenharmony_ci    (Compatibility Profile), dated May 14, 2018.
395bd8deadSopenharmony_ci
405bd8deadSopenharmony_ci    OpenGL 4.5 or OpenGL ES 3.2 is required.
415bd8deadSopenharmony_ci
425bd8deadSopenharmony_ciOverview
435bd8deadSopenharmony_ci
445bd8deadSopenharmony_ci    This extension provides a new _representative fragment test_ that allows
455bd8deadSopenharmony_ci    implementations to reduce the amount of rasterization and fragment
465bd8deadSopenharmony_ci    processing work performed for each point, line, or triangle primitive. For
475bd8deadSopenharmony_ci    any primitive that produces one or more fragments that pass all other
485bd8deadSopenharmony_ci    early fragment tests, the implementation is permitted to choose one or
495bd8deadSopenharmony_ci    more "representative" fragments for processing and discard all other
505bd8deadSopenharmony_ci    fragments. For draw calls rendering multiple points, lines, or triangles
515bd8deadSopenharmony_ci    arranged in lists, strips, or fans, the representative fragment test is
525bd8deadSopenharmony_ci    performed independently for each of those primitives.
535bd8deadSopenharmony_ci
545bd8deadSopenharmony_ci    This extension is useful for applications that use an early render pass
555bd8deadSopenharmony_ci    to determine the full set of primitives that would be visible in the final
565bd8deadSopenharmony_ci    scene. In this render pass, such applications would set up a fragment
575bd8deadSopenharmony_ci    shader that enables early fragment tests and writes to an image or shader
585bd8deadSopenharmony_ci    storage buffer to record the ID of the primitive that generated the
595bd8deadSopenharmony_ci    fragment. Without this extension, the shader would record the ID
605bd8deadSopenharmony_ci    separately for each visible fragment of each primitive. With this
615bd8deadSopenharmony_ci    extension, fewer stores will be performed, particularly for large
625bd8deadSopenharmony_ci    primitives.
635bd8deadSopenharmony_ci
645bd8deadSopenharmony_ci    The representative fragment test has no effect if early fragment tests are
655bd8deadSopenharmony_ci    not enabled via the fragment shader. The set of fragments discarded by the
665bd8deadSopenharmony_ci    representative fragment test is implementation-dependent and may vary from
675bd8deadSopenharmony_ci    frame to frame. In some cases, the representative fragment test may not
685bd8deadSopenharmony_ci    discard any fragments for a given primitive.
695bd8deadSopenharmony_ci
705bd8deadSopenharmony_ci
715bd8deadSopenharmony_ciNew Procedures and Functions
725bd8deadSopenharmony_ci
735bd8deadSopenharmony_ci    None
745bd8deadSopenharmony_ci
755bd8deadSopenharmony_ciNew Tokens
765bd8deadSopenharmony_ci
775bd8deadSopenharmony_ci    Accepted by the <cap> parameter of Enable, Disable, and IsEnabled,
785bd8deadSopenharmony_ci    and by the <pname> parameter of GetBooleanv, GetIntegerv,
795bd8deadSopenharmony_ci    GetFloatv, and GetDoublev:
805bd8deadSopenharmony_ci
815bd8deadSopenharmony_ci        REPRESENTATIVE_FRAGMENT_TEST_NV       0x937F
825bd8deadSopenharmony_ci
835bd8deadSopenharmony_ciModifications to the OpenGL 4.6 Specification (Compatibility Profile)
845bd8deadSopenharmony_ci
855bd8deadSopenharmony_ci    Modify Section 14.9, Early Per-Fragment Tests (p. 578)
865bd8deadSopenharmony_ci
875bd8deadSopenharmony_ci    (modify second pararaph of the section, p. 578, to document that there are
885bd8deadSopenharmony_ci     now four optional early fragment tests)
895bd8deadSopenharmony_ci
905bd8deadSopenharmony_ci    Three fragment operations are performed, and a further four are
915bd8deadSopenharmony_ci    optionally performed on each fragment, ...
925bd8deadSopenharmony_ci
935bd8deadSopenharmony_ci    (modify the last paragraph, p. 578, to list the new early fragment test)
945bd8deadSopenharmony_ci
955bd8deadSopenharmony_ci    If early per-fragment operations are enabled, these tests are also
965bd8deadSopenharmony_ci    performed:
975bd8deadSopenharmony_ci
985bd8deadSopenharmony_ci        * the stencil test (see section 17.3.3);
995bd8deadSopenharmony_ci        * the depth buffer test (see section 17.3.4); and
1005bd8deadSopenharmony_ci        * the representative fragment test (see section 17.3.X)
1015bd8deadSopenharmony_ci        * occlusion query sample counting (see section 17.3.5)
1025bd8deadSopenharmony_ci
1035bd8deadSopenharmony_ci
1045bd8deadSopenharmony_ci    Modify Section 14.9.4, The Early Fragment Test Qualifier, p. 582
1055bd8deadSopenharmony_ci
1065bd8deadSopenharmony_ci    (modify the first paragraph of the section, p. 582, to enumerate the new
1075bd8deadSopenharmony_ci     test)
1085bd8deadSopenharmony_ci
1095bd8deadSopenharmony_ci    The stencil test, depth buffer test, representative fragment test, and
1105bd8deadSopenharmony_ci    occlusion query sample counting are performed if and only if early
1115bd8deadSopenharmony_ci    fragment tests are enabled in the active fragment shader (see section
1125bd8deadSopenharmony_ci    15.2.4). ...
1135bd8deadSopenharmony_ci
1145bd8deadSopenharmony_ci
1155bd8deadSopenharmony_ci    Insert new section before Section 17.3.5, Occlusion Queries (p. 614)
1165bd8deadSopenharmony_ci
1175bd8deadSopenharmony_ci    Section 17.3.X, Representative Fragment Test
1185bd8deadSopenharmony_ci
1195bd8deadSopenharmony_ci    The representative fragment test allows implementations to reduce the
1205bd8deadSopenharmony_ci    amount of rasterization and fragment processing work performed for each
1215bd8deadSopenharmony_ci    point, line, or triangle primitive. For any primitive that produces one or
1225bd8deadSopenharmony_ci    more fragments that pass all prior early fragment tests, the
1235bd8deadSopenharmony_ci    implementation is permitted to choose one or more "representative"
1245bd8deadSopenharmony_ci    fragments for processing and discard all other fragments. For draw calls
1255bd8deadSopenharmony_ci    rendering multiple points, lines, or triangles arranged in lists, strips,
1265bd8deadSopenharmony_ci    or fans, the representative fragment test is performed independently for
1275bd8deadSopenharmony_ci    each of those primitives. The set of fragments discarded by the
1285bd8deadSopenharmony_ci    representative fragment test is implementation-dependent. In some cases,
1295bd8deadSopenharmony_ci    the representative fragment test may not discard any fragments for a given
1305bd8deadSopenharmony_ci    primitive.
1315bd8deadSopenharmony_ci
1325bd8deadSopenharmony_ci    This test is enabled or disabled using Enable or Disable with the target
1335bd8deadSopenharmony_ci    REPRESENTATIVE_FRAGMENT_NV. If early fragment tests (section 15.2.4) are
1345bd8deadSopenharmony_ci    not enabled in the active fragment shader, the representative fragment
1355bd8deadSopenharmony_ci    test has no effect, even if enabled.
1365bd8deadSopenharmony_ci
1375bd8deadSopenharmony_ci
1385bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications
1395bd8deadSopenharmony_ci
1405bd8deadSopenharmony_ci    None.
1415bd8deadSopenharmony_ci
1425bd8deadSopenharmony_ciNew State
1435bd8deadSopenharmony_ci
1445bd8deadSopenharmony_ci    Get Value                              Type    Get Command   Initial Value   Description                Sec    Attribute
1455bd8deadSopenharmony_ci    ------------------------------------   ----    -----------   -------------   -------------------------  ------ --------------
1465bd8deadSopenharmony_ci    REPRESENTATIVE_FRAGMENT_TEST_NV          B      IsEnabled     GL_FALSE       Representative fragment    17.3.X enable
1475bd8deadSopenharmony_ci                                                                                 test
1485bd8deadSopenharmony_ci
1495bd8deadSopenharmony_ciNew Implementation Dependent State
1505bd8deadSopenharmony_ci
1515bd8deadSopenharmony_ci    None
1525bd8deadSopenharmony_ci
1535bd8deadSopenharmony_ciInteractions with OpenGL ES
1545bd8deadSopenharmony_ci
1555bd8deadSopenharmony_ci    If implemented with OpenGL ES, ignore references to GetDoublev.
1565bd8deadSopenharmony_ci
1575bd8deadSopenharmony_ciIssues
1585bd8deadSopenharmony_ci
1595bd8deadSopenharmony_ci    (1) Since the representative fragment test does not have guaranteed
1605bd8deadSopenharmony_ci        behavior, it is sort of a hint.  Should we use the existing hint
1615bd8deadSopenharmony_ci        mechanisms for this extension or simply add an enable?
1625bd8deadSopenharmony_ci
1635bd8deadSopenharmony_ci    RESOLVED:  Use an enable.  Hints are rarely used in OpenGL, and the
1645bd8deadSopenharmony_ci    "FASTEST" vs. "NICEST" vs. "DONT_CARE" doesn't map reasonably to the
1655bd8deadSopenharmony_ci    representative fragment test.
1665bd8deadSopenharmony_ci
1675bd8deadSopenharmony_ci    (2) Should this functionality be exposed as a sub-feature of the depth or
1685bd8deadSopenharmony_ci        stencil tests, as its own separate per-fragment test, or as some piece
1695bd8deadSopenharmony_ci        of state controlling primitive rasterization?
1705bd8deadSopenharmony_ci
1715bd8deadSopenharmony_ci    RESOLVED:  Expose as a per-fragment test.  This test is largely orthogonal
1725bd8deadSopenharmony_ci    to depth testing, other than it is supposed to run after the depth
1735bd8deadSopenharmony_ci    testing.  So coupling it to the depth test doesn't make sense.  Coupling
1745bd8deadSopenharmony_ci    the feature to rasterization also doesn't make too much sense, because the
1755bd8deadSopenharmony_ci    rasterization pipeline stage discarding fragments for this test would
1765bd8deadSopenharmony_ci    depend on a later pipeline stages performing other per-fragment tests
1775bd8deadSopenharmony_ci    (such as the depth test).
1785bd8deadSopenharmony_ci
1795bd8deadSopenharmony_ci
1805bd8deadSopenharmony_ciRevision History
1815bd8deadSopenharmony_ci
1825bd8deadSopenharmony_ci    Revision 3, March 7, 2019 (pknowles)
1835bd8deadSopenharmony_ci    - Add ES interactions.
1845bd8deadSopenharmony_ci
1855bd8deadSopenharmony_ci    Revision 2, September 15, 2018 (pbrown)
1865bd8deadSopenharmony_ci    - Prepare specification for publication.
1875bd8deadSopenharmony_ci
1885bd8deadSopenharmony_ci    Revision 1 (ckubisch and kthangudu)
1895bd8deadSopenharmony_ci    - Internal Revisions
190