15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    AMD_conservative_depth
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName String
65bd8deadSopenharmony_ci    
75bd8deadSopenharmony_ci    GL_AMD_conservative_depth
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Graham Sellers, AMD (graham.sellers 'at' amd.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciContributors
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    Pierre Boudier, AMD
165bd8deadSopenharmony_ci    Graham Sellers, AMD
175bd8deadSopenharmony_ci
185bd8deadSopenharmony_ciStatus
195bd8deadSopenharmony_ci
205bd8deadSopenharmony_ci    In Progress
215bd8deadSopenharmony_ci
225bd8deadSopenharmony_ciVersion
235bd8deadSopenharmony_ci
245bd8deadSopenharmony_ci    Last Modified Date:         10/25/2010
255bd8deadSopenharmony_ci    Author Revision:            4
265bd8deadSopenharmony_ci
275bd8deadSopenharmony_ciNumber
285bd8deadSopenharmony_ci
295bd8deadSopenharmony_ci    385
305bd8deadSopenharmony_ci
315bd8deadSopenharmony_ciDependencies
325bd8deadSopenharmony_ci
335bd8deadSopenharmony_ci    OpenGL 3.0 is required.
345bd8deadSopenharmony_ci
355bd8deadSopenharmony_ci    This extension is written against the OpenGL Shading Language Version 4.00.
365bd8deadSopenharmony_ci
375bd8deadSopenharmony_ciOverview
385bd8deadSopenharmony_ci
395bd8deadSopenharmony_ci    There is a common optimization for hardware accelerated implementation of
405bd8deadSopenharmony_ci    OpenGL which relies on an early depth test to be run before the fragment
415bd8deadSopenharmony_ci    shader so that the shader evaluation can be skipped if the fragment ends
425bd8deadSopenharmony_ci    up being discarded because it is occluded.
435bd8deadSopenharmony_ci
445bd8deadSopenharmony_ci    This optimization does not affect the final rendering, and is typically
455bd8deadSopenharmony_ci    possible when the fragment does not change the depth programmatically.
465bd8deadSopenharmony_ci    (i.e.: it does not write to the built-in gl_FragDepth output). There are,
475bd8deadSopenharmony_ci    however a class of operations on the depth in the shader which could
485bd8deadSopenharmony_ci    still be performed while allowing the early depth test to operate.
495bd8deadSopenharmony_ci
505bd8deadSopenharmony_ci    This extension allows the application to pass enough information to the
515bd8deadSopenharmony_ci    GL implementation to activate such optimizations safely.
525bd8deadSopenharmony_ci
535bd8deadSopenharmony_ciNew Procedures and Functions
545bd8deadSopenharmony_ci
555bd8deadSopenharmony_ci    None.
565bd8deadSopenharmony_ci
575bd8deadSopenharmony_ciNew Tokens
585bd8deadSopenharmony_ci
595bd8deadSopenharmony_ci    None.
605bd8deadSopenharmony_ci
615bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications
625bd8deadSopenharmony_ci
635bd8deadSopenharmony_ci    None.
645bd8deadSopenharmony_ci
655bd8deadSopenharmony_ciModifications to the OpenGL Shading Language Specification version 1.50.9
665bd8deadSopenharmony_ci
675bd8deadSopenharmony_ciAdditions to Chapter 1 of the OpenGL Shading Language 4.00.08 Specification (Introduction)
685bd8deadSopenharmony_ci
695bd8deadSopenharmony_ci    None.
705bd8deadSopenharmony_ci
715bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL Shading Language 4.00.08 Specification (Overview of OpenGL Shading)
725bd8deadSopenharmony_ci
735bd8deadSopenharmony_ci    None.
745bd8deadSopenharmony_ci
755bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL Shading Language 4.00.08 Specification (Basics)
765bd8deadSopenharmony_ci
775bd8deadSopenharmony_ci    Add a new Section 3.3.x, GL_AMD_conservative_depth Extension
785bd8deadSopenharmony_ci
795bd8deadSopenharmony_ci    Including the following line in a shader can be used to control the language
805bd8deadSopenharmony_ci    features described in this extension:
815bd8deadSopenharmony_ci
825bd8deadSopenharmony_ci        #extension GL_AMD_conservative_depth: <behavior>
835bd8deadSopenharmony_ci
845bd8deadSopenharmony_ci    where <behavior> is as described in section 3.3.
855bd8deadSopenharmony_ci
865bd8deadSopenharmony_ci    A new preprocessor #define is added to the OpenGL Shading Language:
875bd8deadSopenharmony_ci
885bd8deadSopenharmony_ci        #define GL_AMD_conservative_depth 1
895bd8deadSopenharmony_ci
905bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL Shading Language 4.00.08 Specification (Variables and Types)
915bd8deadSopenharmony_ci
925bd8deadSopenharmony_ci    Modify Section 4.3.8.2 (Output Layout Qualifiers) page 47
935bd8deadSopenharmony_ci
945bd8deadSopenharmony_ci    Modify the paragraph beginning: "Fragment shaders allow output layout
955bd8deadSopenharmony_ci    qualifiers only..."
965bd8deadSopenharmony_ci
975bd8deadSopenharmony_ci        Fragment shaders allow output layout qualifiers only on the interface
985bd8deadSopenharmony_ci        out, or for the purposes of redeclaring the built-in variable
995bd8deadSopenharmony_ci        gl_FragDepth (see Section 7.1, Built-In Language Variables).
1005bd8deadSopenharmony_ci
1015bd8deadSopenharmony_ci    Insert the following before the paragraph beginning: "Geometry shaders can
1025bd8deadSopenharmony_ci    have three types of output layout qualifiers..."
1035bd8deadSopenharmony_ci
1045bd8deadSopenharmony_ci        The built-in fragment shader variable gl_FragDepth may be redeclared
1055bd8deadSopenharmony_ci        using one of the following layout qualifiers.
1065bd8deadSopenharmony_ci
1075bd8deadSopenharmony_ci        layout-qualifier-id
1085bd8deadSopenharmony_ci            depth_any
1095bd8deadSopenharmony_ci            depth_greater
1105bd8deadSopenharmony_ci            depth_less
1115bd8deadSopenharmony_ci            depth_unchanged
1125bd8deadSopenharmony_ci
1135bd8deadSopenharmony_ci        For example:
1145bd8deadSopenharmony_ci
1155bd8deadSopenharmony_ci            layout (depth_greater) out float gl_FragDepth;
1165bd8deadSopenharmony_ci
1175bd8deadSopenharmony_ci        The layout qualifier for gl_FragDepth controls how the GL will interpret
1185bd8deadSopenharmony_ci        assignments to the gl_FragDepth out variable for the purpose of depth
1195bd8deadSopenharmony_ci        testing. Any assignment to gl_FragDepth will be honored by the shader
1205bd8deadSopenharmony_ci        and the updated value of gl_FragDepth will still be written to the
1215bd8deadSopenharmony_ci        depth buffer if it is determined that the depth write should occur.
1225bd8deadSopenharmony_ci        However, depending on the layout qualifier of gl_FragDepth and the
1235bd8deadSopenharmony_ci        current state of depth testing, the GL may perform optimizations or
1245bd8deadSopenharmony_ci        reordering of operations to depth test and writes to improve performance.
1255bd8deadSopenharmony_ci
1265bd8deadSopenharmony_ci        By default, gl_FragDepth assumes the <depth_any> layout qualifier. When
1275bd8deadSopenharmony_ci        the layout qualifier for gl_FragDepth is <depth_any>, the shader compiler
1285bd8deadSopenharmony_ci        will note any assignment to gl_FragDepth modifying it in an unknown way,
1295bd8deadSopenharmony_ci        and depth testing will always be performed after the shader has executed.
1305bd8deadSopenharmony_ci        When the layout qualifier is <depth_greater>, the GL will assume that
1315bd8deadSopenharmony_ci        any modification of gl_FragDepth will only increase its value. When the
1325bd8deadSopenharmony_ci        layout qualifier is <depth_less>, the GL will assume that any
1335bd8deadSopenharmony_ci        modification of gl_FragDepth will only decrease its value. When the
1345bd8deadSopenharmony_ci        layout qualifier is <depth_unchanged>, the shader compiler will honor
1355bd8deadSopenharmony_ci        any modification to gl_FragDepth, but the rest of the GL assume that
1365bd8deadSopenharmony_ci        gl_FragDepth is not assigned a new value.
1375bd8deadSopenharmony_ci
1385bd8deadSopenharmony_ci        If a shader redeclares gl_FragDepth using the <depth_greater>,
1395bd8deadSopenharmony_ci        <depth_less> or <depth_unchanged> and then violates this contract, the
1405bd8deadSopenharmony_ci        results of the depth test may be inaccurate and any resulting rendering
1415bd8deadSopenharmony_ci        will produce undefined results. However, no error is generated.
1425bd8deadSopenharmony_ci
1435bd8deadSopenharmony_ci        Redeclarations are performed as follows:
1445bd8deadSopenharmony_ci
1455bd8deadSopenharmony_ci            out float gl_FragDepth;                             // Redeclaration that changes nothing is allowed
1465bd8deadSopenharmony_ci
1475bd8deadSopenharmony_ci            layout (depth_any) out float gl_FragDepth;          // Assume that gl_FragDepth may be modified in any way
1485bd8deadSopenharmony_ci            layout (depth_greater) out float gl_FragDepth;      // Assume that gl_FragDepth may be modified such that its value will only increase
1495bd8deadSopenharmony_ci            layout (depth_less) out float gl_FragDepth;         // Assume that gl_FragDepth may be modified such that its value will only decrease
1505bd8deadSopenharmony_ci            layout (depth_unchanged) out float gl_FragDepth;    // Assume that gl_FragDepth will not be modified
1515bd8deadSopenharmony_ci
1525bd8deadSopenharmony_ci        If gl_FragDepth is redeclared in any fragment shader in a program, it must
1535bd8deadSopenharmony_ci        be redeclared in all fragment shaders in that program that have static
1545bd8deadSopenharmony_ci        assignments to gl_FragDepth. All redeclarations of gl_FragDepth in all
1555bd8deadSopenharmony_ci        fragment shaders in a single program must have the same set of qualifiers.
1565bd8deadSopenharmony_ci        Within any shader, the first redeclarations of gl_FragDepth must appear
1575bd8deadSopenharmony_ci        before any use of gl_FragDepth. The built-in gl_FragDepth is only
1585bd8deadSopenharmony_ci        predeclared in fragment shaders, so redeclaring it in any other shader
1595bd8deadSopenharmony_ci        language will be illegal.
1605bd8deadSopenharmony_ci
1615bd8deadSopenharmony_ciRevision History
1625bd8deadSopenharmony_ci
1635bd8deadSopenharmony_ci    Rev.    Date      Author    Changes
1645bd8deadSopenharmony_ci    ----  --------    --------  -----------------------------------------
1655bd8deadSopenharmony_ci
1665bd8deadSopenharmony_ci     4    25/10/2010  gsellers  Apply patch from idr.
1675bd8deadSopenharmony_ci     3    04/01/2010  gsellers  Minor cleanup. Update to GLSL 4.00.
1685bd8deadSopenharmony_ci     2    12/01/2009  gsellers  Internal updates
1695bd8deadSopenharmony_ci     1    11/03/2009  pboudier  Initial draft
170