15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    ARB_post_depth_coverage
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_ARB_post_depth_coverage
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Piers Daniell, NVIDIA Corporation (pdaniell 'at' nvidia.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciContributors
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    Jeff Bolz, NVIDIA
165bd8deadSopenharmony_ci    Pat Brown, NVIDIA
175bd8deadSopenharmony_ci    James Helferty, NVIDIA
185bd8deadSopenharmony_ci    Eric Werness, NVIDIA
195bd8deadSopenharmony_ci
205bd8deadSopenharmony_ciNotice
215bd8deadSopenharmony_ci
225bd8deadSopenharmony_ci    Copyright (c) 2015 The Khronos Group Inc. Copyright terms at
235bd8deadSopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
245bd8deadSopenharmony_ci
255bd8deadSopenharmony_ciSpecification Update Policy
265bd8deadSopenharmony_ci
275bd8deadSopenharmony_ci    Khronos-approved extension specifications are updated in response to
285bd8deadSopenharmony_ci    issues and bugs prioritized by the Khronos OpenGL Working Group. For
295bd8deadSopenharmony_ci    extensions which have been promoted to a core Specification, fixes will
305bd8deadSopenharmony_ci    first appear in the latest version of that core Specification, and will
315bd8deadSopenharmony_ci    eventually be backported to the extension document. This policy is
325bd8deadSopenharmony_ci    described in more detail at
335bd8deadSopenharmony_ci        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
345bd8deadSopenharmony_ci
355bd8deadSopenharmony_ciStatus
365bd8deadSopenharmony_ci
375bd8deadSopenharmony_ci    Complete. Approved by the ARB on June 26, 2015.
385bd8deadSopenharmony_ci    Ratified by the Khronos Board of Promoters on August 7, 2015.
395bd8deadSopenharmony_ci
405bd8deadSopenharmony_ciVersion
415bd8deadSopenharmony_ci
425bd8deadSopenharmony_ci    Last Modified Date:         June 25, 2015
435bd8deadSopenharmony_ci    Revision:                   3
445bd8deadSopenharmony_ci
455bd8deadSopenharmony_ciNumber
465bd8deadSopenharmony_ci
475bd8deadSopenharmony_ci    ARB Extension #180
485bd8deadSopenharmony_ci
495bd8deadSopenharmony_ciDependencies
505bd8deadSopenharmony_ci
515bd8deadSopenharmony_ci    This extension is written against the OpenGL 4.5 specification
525bd8deadSopenharmony_ci    (Compatibility Profile).
535bd8deadSopenharmony_ci
545bd8deadSopenharmony_ci    This extension is written against version 4.50 of the OpenGL
555bd8deadSopenharmony_ci    Shading Language Specification.
565bd8deadSopenharmony_ci
575bd8deadSopenharmony_ci    This extension interacts with NV_fragment_program4.
585bd8deadSopenharmony_ci
595bd8deadSopenharmony_ci    This extension interacts with EXT_post_depth_coverage.
605bd8deadSopenharmony_ci
615bd8deadSopenharmony_ciOverview
625bd8deadSopenharmony_ci
635bd8deadSopenharmony_ci    This extension allows the fragment shader to control whether values in
645bd8deadSopenharmony_ci    gl_SampleMaskIn[] reflect the coverage after application of the early
655bd8deadSopenharmony_ci    depth and stencil tests.  This feature can be enabled with the following
665bd8deadSopenharmony_ci    layout qualifier in the fragment shader:
675bd8deadSopenharmony_ci
685bd8deadSopenharmony_ci        layout(post_depth_coverage) in;
695bd8deadSopenharmony_ci
705bd8deadSopenharmony_ci    Use of this feature implicitly enables early fragment tests.
715bd8deadSopenharmony_ci
725bd8deadSopenharmony_ciNew Procedures and Functions
735bd8deadSopenharmony_ci
745bd8deadSopenharmony_ci    None.
755bd8deadSopenharmony_ci
765bd8deadSopenharmony_ciNew Tokens
775bd8deadSopenharmony_ci
785bd8deadSopenharmony_ci    None.
795bd8deadSopenharmony_ci
805bd8deadSopenharmony_ciAdditions to Chapter 15 of the OpenGL 4.5 (Compatibility Profile) Specification
815bd8deadSopenharmony_ci(Rasterization)
825bd8deadSopenharmony_ci
835bd8deadSopenharmony_ci    Modify Section 15.1 Fragment Shader Variables, p. 558
845bd8deadSopenharmony_ci
855bd8deadSopenharmony_ci    (modify the third paragraph on p. 559)
865bd8deadSopenharmony_ci
875bd8deadSopenharmony_ci    ...When interpolating variables declared using "centroid in", the variable
885bd8deadSopenharmony_ci    is sampled at a location within the pixel covered by the primitive
895bd8deadSopenharmony_ci    generating the fragment. The fragment shader layout qualifier
905bd8deadSopenharmony_ci    "post_depth_coverage" (Section 15.2.2) does not affect the determination of the
915bd8deadSopenharmony_ci    centroid location.
925bd8deadSopenharmony_ci
935bd8deadSopenharmony_ci    Modify Section 15.2.2 Shader Inputs, p. 560
945bd8deadSopenharmony_ci
955bd8deadSopenharmony_ci    (modify the fourth paragraph on p. 562)
965bd8deadSopenharmony_ci
975bd8deadSopenharmony_ci    ...Bit <n> of element <w> in the array is set if and only if the sample
985bd8deadSopenharmony_ci    numbered <32w + n> is considered covered for this fragment shader
995bd8deadSopenharmony_ci    invocation. If the fragment shader specifies the "early_fragment_tests" and
1005bd8deadSopenharmony_ci    "post_depth_coverage" layout qualifiers, then the sample is considered covered
1015bd8deadSopenharmony_ci    if and only if the sample is covered by the primitive and the sample passes
1025bd8deadSopenharmony_ci    the early fragment tests (as described in Section 15.2.4). If these layout
1035bd8deadSopenharmony_ci    qualifiers are not specified, then the sample is considered covered if the
1045bd8deadSopenharmony_ci    sample is covered by the primitive, regardless of the result of the
1055bd8deadSopenharmony_ci    fragment tests. ...
1065bd8deadSopenharmony_ci
1075bd8deadSopenharmony_ci
1085bd8deadSopenharmony_ciNew Implementation Dependent State
1095bd8deadSopenharmony_ci
1105bd8deadSopenharmony_ci    None.
1115bd8deadSopenharmony_ci
1125bd8deadSopenharmony_ciNew State
1135bd8deadSopenharmony_ci
1145bd8deadSopenharmony_ci    None.
1155bd8deadSopenharmony_ci
1165bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications
1175bd8deadSopenharmony_ci
1185bd8deadSopenharmony_ci    None.
1195bd8deadSopenharmony_ci
1205bd8deadSopenharmony_ciGLX Protocol
1215bd8deadSopenharmony_ci
1225bd8deadSopenharmony_ci    None.
1235bd8deadSopenharmony_ci
1245bd8deadSopenharmony_ciModifications to the OpenGL Shading Language Specification, Version 4.50
1255bd8deadSopenharmony_ci
1265bd8deadSopenharmony_ci    Including the following line in a shader can be used to control the
1275bd8deadSopenharmony_ci    language features described in this extension:
1285bd8deadSopenharmony_ci
1295bd8deadSopenharmony_ci      #extension GL_ARB_post_depth_coverage : <behavior>
1305bd8deadSopenharmony_ci
1315bd8deadSopenharmony_ci    where <behavior> is as specified in section 3.3.
1325bd8deadSopenharmony_ci
1335bd8deadSopenharmony_ci    New preprocessor #defines are added to the OpenGL Shading Language:
1345bd8deadSopenharmony_ci
1355bd8deadSopenharmony_ci      #define GL_ARB_post_depth_coverage                1
1365bd8deadSopenharmony_ci
1375bd8deadSopenharmony_ci
1385bd8deadSopenharmony_ci    Modify Section 4.4.1.3 Fragment Shader Inputs (p. 63)
1395bd8deadSopenharmony_ci
1405bd8deadSopenharmony_ci    (replace the discussion of early_fragment_tests on p. 64)
1415bd8deadSopenharmony_ci
1425bd8deadSopenharmony_ci    Fragment shaders also allow the following layout qualifiers on "in" only (not
1435bd8deadSopenharmony_ci    with variable declarations)
1445bd8deadSopenharmony_ci
1455bd8deadSopenharmony_ci        layout-qualifier-id
1465bd8deadSopenharmony_ci            early_fragment_tests
1475bd8deadSopenharmony_ci            post_depth_coverage
1485bd8deadSopenharmony_ci
1495bd8deadSopenharmony_ci    For example,
1505bd8deadSopenharmony_ci
1515bd8deadSopenharmony_ci        layout(early_fragment_tests) in;
1525bd8deadSopenharmony_ci        layout(post_depth_coverage) in;
1535bd8deadSopenharmony_ci
1545bd8deadSopenharmony_ci    "early_fragment_tests" requests that fragment tests be performed before
1555bd8deadSopenharmony_ci    fragment shader execution, as described in section 15.2.4 "Early Fragment
1565bd8deadSopenharmony_ci    Tests" of the OpenGL Specification. If neither this nor post_depth_coverage
1575bd8deadSopenharmony_ci    are declared, per-fragment tests will be performed after fragment shader
1585bd8deadSopenharmony_ci    execution.
1595bd8deadSopenharmony_ci
1605bd8deadSopenharmony_ci    "post_depth_coverage" requests that the built-in "gl_SampleMaskIn[]" will
1615bd8deadSopenharmony_ci    reflect the result of the early fragment tests, as described in section
1625bd8deadSopenharmony_ci    15.2.2 "Shader Inputs" of the OpenGL Specification.
1635bd8deadSopenharmony_ci
1645bd8deadSopenharmony_ci    Only one fragment shader (compilation unit) need declare these, though
1655bd8deadSopenharmony_ci    more than one can. If at least one fragment shader declares one of these,
1665bd8deadSopenharmony_ci    then it is enabled.
1675bd8deadSopenharmony_ci
1685bd8deadSopenharmony_ci
1695bd8deadSopenharmony_ciDependencies on NV_fragment_program4
1705bd8deadSopenharmony_ci
1715bd8deadSopenharmony_ci    Modify Section 2.X.6.Y of the NV_fragment_program4 specification
1725bd8deadSopenharmony_ci
1735bd8deadSopenharmony_ci    (add new option section)
1745bd8deadSopenharmony_ci
1755bd8deadSopenharmony_ci    + Post-depth Coverage (ARB_post_depth_coverage)
1765bd8deadSopenharmony_ci
1775bd8deadSopenharmony_ci    If a fragment program specifies the "ARB_post_depth_coverage" option, the
1785bd8deadSopenharmony_ci    sample mask will reflect the result of the early fragment tests, as
1795bd8deadSopenharmony_ci    described in Section 15.2.2 "Shader Inputs". If a fragment program
1805bd8deadSopenharmony_ci    specifies the ARB_post_depth_coverage option and not the
1815bd8deadSopenharmony_ci    NV_early_fragment_tests option, it will fail to compile.
1825bd8deadSopenharmony_ci
1835bd8deadSopenharmony_ciDependencies on EXT_post_depth_coverage
1845bd8deadSopenharmony_ci
1855bd8deadSopenharmony_ci    If a shader enables both EXT_post_depth_coverage and ARB_post_depth_coverage
1865bd8deadSopenharmony_ci    the behavior of layout(post_depth_coverage) will match
1875bd8deadSopenharmony_ci    ARB_post_depth_coverage.
1885bd8deadSopenharmony_ci
1895bd8deadSopenharmony_ciErrors
1905bd8deadSopenharmony_ci
1915bd8deadSopenharmony_ci    None.
1925bd8deadSopenharmony_ci
1935bd8deadSopenharmony_ciIssues
1945bd8deadSopenharmony_ci
1955bd8deadSopenharmony_ci    (1) Should the determination of a fragment's centroid use the pre-depth or
1965bd8deadSopenharmony_ci    post-depth coverage?
1975bd8deadSopenharmony_ci
1985bd8deadSopenharmony_ci    RESOLVED: In this extension, it uses the pre-depth coverage. This way the
1995bd8deadSopenharmony_ci    centroid location (and hence the result of shading) does not depend on the
2005bd8deadSopenharmony_ci    rendering order, which is almost certainly the desired result for 3D
2015bd8deadSopenharmony_ci    rendering.
2025bd8deadSopenharmony_ci
2035bd8deadSopenharmony_ci    For path rendering, it would be desirable to use post-depth centroid since
2045bd8deadSopenharmony_ci    the stencil test really determines whether samples are inside the primitive
2055bd8deadSopenharmony_ci    rather than whether samples are "occluded," and guaranteeing attributes
2065bd8deadSopenharmony_ci    are sampled inside the path would be nice.
2075bd8deadSopenharmony_ci
2085bd8deadSopenharmony_ci    (2) What happens if you write gl_FragDepth? What about side-effects?
2095bd8deadSopenharmony_ci
2105bd8deadSopenharmony_ci    RESOLVED: Because the post_depth_coverage option implies
2115bd8deadSopenharmony_ci    early_fragment_tests, the behavior for these cases is inhereted from the
2125bd8deadSopenharmony_ci    basic early_fragment_tests behavior, so writes to gl_FragDepth are ignored
2135bd8deadSopenharmony_ci    and side effects are only executed on shaders that are executed which have
2145bd8deadSopenharmony_ci    already passed the early fragment operations.
2155bd8deadSopenharmony_ci
2165bd8deadSopenharmony_ciRevision History
2175bd8deadSopenharmony_ci
2185bd8deadSopenharmony_ci    Revision 3, June 25, 2015
2195bd8deadSopenharmony_ci
2205bd8deadSopenharmony_ci      Add interaction between ARB_post_depth_coverage and
2215bd8deadSopenharmony_ci      EXT_post_depth_coverage behaviors
2225bd8deadSopenharmony_ci
2235bd8deadSopenharmony_ci    Revision 2, April 29, 2015
2245bd8deadSopenharmony_ci
2255bd8deadSopenharmony_ci      Implicitly enable early_fragment_tests when post_depth_coverage
2265bd8deadSopenharmony_ci      is enabled. Add a clarification issue.
2275bd8deadSopenharmony_ci
2285bd8deadSopenharmony_ci    Revision 1, April 20, 2015
2295bd8deadSopenharmony_ci
2305bd8deadSopenharmony_ci      Initial ARB spec branched from EXT_post_depth_coverage
231