15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    EXT_shadow_samplers
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_EXT_shadow_samplers
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContributors
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Contributors to ARB_shadow and EXT_shadow_funcs on which this extension 
125bd8deadSopenharmony_ci        is based
135bd8deadSopenharmony_ci    Galo Avila
145bd8deadSopenharmony_ci    Kelvin Chiu
155bd8deadSopenharmony_ci    Richard Schreyer
165bd8deadSopenharmony_ci
175bd8deadSopenharmony_ciContacts
185bd8deadSopenharmony_ci
195bd8deadSopenharmony_ci    Benj Lipchak, Apple (lipchak 'at' apple.com)
205bd8deadSopenharmony_ci
215bd8deadSopenharmony_ciStatus
225bd8deadSopenharmony_ci
235bd8deadSopenharmony_ci    Complete
245bd8deadSopenharmony_ci
255bd8deadSopenharmony_ciVersion
265bd8deadSopenharmony_ci
275bd8deadSopenharmony_ci    Date: June 25, 2012
285bd8deadSopenharmony_ci    Revision: 4
295bd8deadSopenharmony_ci
305bd8deadSopenharmony_ciNumber
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ci    OpenGL ES Extension #102
335bd8deadSopenharmony_ci
345bd8deadSopenharmony_ciDependencies
355bd8deadSopenharmony_ci
365bd8deadSopenharmony_ci    Requires OpenGL ES 2.0.
375bd8deadSopenharmony_ci
385bd8deadSopenharmony_ci    Written based on the wording of the OpenGL ES 2.0.25 Full Specification
395bd8deadSopenharmony_ci    (November 2, 2010).
405bd8deadSopenharmony_ci
415bd8deadSopenharmony_ci    Written based on the wording of The OpenGL ES Shading Language 1.0.17
425bd8deadSopenharmony_ci    Specification (May 12, 2009).
435bd8deadSopenharmony_ci
445bd8deadSopenharmony_ci    Requires OES_depth_texture.
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ci    OES_packed_depth_stencil affects the definition of this extension.
475bd8deadSopenharmony_ci    
485bd8deadSopenharmony_ciOverview
495bd8deadSopenharmony_ci
505bd8deadSopenharmony_ci    This extension supports comparing the texture R coordinate to a depth
515bd8deadSopenharmony_ci    texture value returning the result as a float value in the range [0,1]. 
525bd8deadSopenharmony_ci    This can be used to implement shadow maps.
535bd8deadSopenharmony_ci
545bd8deadSopenharmony_ciNew Procedures and Functions
555bd8deadSopenharmony_ci    
565bd8deadSopenharmony_ci    None
575bd8deadSopenharmony_ci
585bd8deadSopenharmony_ciNew Tokens
595bd8deadSopenharmony_ci
605bd8deadSopenharmony_ci    Accepted by the <pname> parameter of TexParameterf, TexParameteri,
615bd8deadSopenharmony_ci    TexParameterfv, TexParameteriv, GetTexParameterfv, and GetTexParameteriv:
625bd8deadSopenharmony_ci
635bd8deadSopenharmony_ci    TEXTURE_COMPARE_MODE_EXT    0x884C
645bd8deadSopenharmony_ci    TEXTURE_COMPARE_FUNC_EXT    0x884D
655bd8deadSopenharmony_ci
665bd8deadSopenharmony_ci    Accepted by the <param> parameter of TexParameterf, TexParameteri,
675bd8deadSopenharmony_ci    TexParameterfv, and TexParameteriv when the <pname> parameter is
685bd8deadSopenharmony_ci    TEXTURE_COMPARE_MODE_EXT:
695bd8deadSopenharmony_ci
705bd8deadSopenharmony_ci    COMPARE_REF_TO_TEXTURE_EXT  0x884E
715bd8deadSopenharmony_ci
725bd8deadSopenharmony_ci    Returned in <type> by glGetActiveUniform:
735bd8deadSopenharmony_ci
745bd8deadSopenharmony_ci    GL_SAMPLER_2D_SHADOW_EXT    0x8B62 
755bd8deadSopenharmony_ci
765bd8deadSopenharmony_ciNew GLSL defines
775bd8deadSopenharmony_ci
785bd8deadSopenharmony_ci    #extension GL_EXT_shadow_samplers : require
795bd8deadSopenharmony_ci
805bd8deadSopenharmony_ciNew GLSL sampler types
815bd8deadSopenharmony_ci
825bd8deadSopenharmony_ci    sampler2DShadow
835bd8deadSopenharmony_ci
845bd8deadSopenharmony_ciNew GLSL functions
855bd8deadSopenharmony_ci
865bd8deadSopenharmony_ci    float shadow2DEXT(sampler2DShadow sampler, vec3 coord);
875bd8deadSopenharmony_ci    float shadow2DProjEXT(sampler2DShadow sampler, vec4 coord);
885bd8deadSopenharmony_ci
895bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL ES 2.0 Specification (OpenGL ES Operation)
905bd8deadSopenharmony_ci
915bd8deadSopenharmony_ci    In Section 2.10.4, replace the final sentence on p. 36 with:
925bd8deadSopenharmony_ci
935bd8deadSopenharmony_ci    "The type returned can be any of FLOAT, FLOAT_VEC2, FLOAT_VEC3, FLOAT_VEC4,
945bd8deadSopenharmony_ci    INT, INT_VEC2, INT_VEC3, INT_VEC4, BOOL, BOOL_VEC2, BOOL_VEC3, BOOL_VEC4, 
955bd8deadSopenharmony_ci    FLOAT_MAT2, FLOAT_MAT3, FLOAT_MAT4, SAMPLER_2D, SAMPLER_CUBE, or 
965bd8deadSopenharmony_ci    SAMPLER_2D_SHADOW_EXT."
975bd8deadSopenharmony_ci
985bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL ES 2.0 Specification (Rasterization)
995bd8deadSopenharmony_ci
1005bd8deadSopenharmony_ci    Section 3.7.4, Texture Parameters, p. 76, append table 3.10 with the
1015bd8deadSopenharmony_ci    following:
1025bd8deadSopenharmony_ci
1035bd8deadSopenharmony_ci    Name                       Type   Legal Values
1045bd8deadSopenharmony_ci    ------------------------   ----   -------------------------------
1055bd8deadSopenharmony_ci    TEXTURE_COMPARE_MODE_EXT   enum   NONE, COMPARE_REF_TO_TEXTURE_EXT
1065bd8deadSopenharmony_ci    TEXTURE_COMPARE_FUNC_EXT   enum   LEQUAL, GEQUAL, LESS, GREATER, EQUAL, 
1075bd8deadSopenharmony_ci                                      NOTEQUAL, ALWAYS, NEVER
1085bd8deadSopenharmony_ci
1095bd8deadSopenharmony_ci    After section 3.7.13, Texture Objects, p. 86, insert the following new 
1105bd8deadSopenharmony_ci    section:
1115bd8deadSopenharmony_ci
1125bd8deadSopenharmony_ci        "3.7.14 Texture Comparison Modes
1135bd8deadSopenharmony_ci
1145bd8deadSopenharmony_ci        Texture values can also be computed according to a specified comparison
1155bd8deadSopenharmony_ci        function. Texture parameter TEXTURE_COMPARE_MODE_EXT specifies the 
1165bd8deadSopenharmony_ci        comparison operands, and parameter TEXTURE_COMPARE_FUNC_EXT specifies
1175bd8deadSopenharmony_ci        the comparison function.
1185bd8deadSopenharmony_ci        
1195bd8deadSopenharmony_ci        3.7.14.1 Depth Texture Comparison Mode
1205bd8deadSopenharmony_ci
1215bd8deadSopenharmony_ci        If the currently bound texture's base internal format is 
1225bd8deadSopenharmony_ci        DEPTH_COMPONENT or DEPTH_STENCIL_OES, then TEXTURE_COMPARE_MODE_EXT 
1235bd8deadSopenharmony_ci        and TEXTURE_COMPARE_FUNC_EXT control the output of the texture unit
1245bd8deadSopenharmony_ci        as described below. Otherwise, the texture unit operates in the normal
1255bd8deadSopenharmony_ci        manner and texture comparison is bypassed.
1265bd8deadSopenharmony_ci
1275bd8deadSopenharmony_ci        Let D_t be the depth texture value and D_ref be the reference value, 
1285bd8deadSopenharmony_ci        provided by the shader's texture lookup function. D_t and D_ref are 
1295bd8deadSopenharmony_ci        clamped to the range [0,1]. Then the effective texture value is
1305bd8deadSopenharmony_ci        computed as follows:
1315bd8deadSopenharmony_ci
1325bd8deadSopenharmony_ci        If the value of TEXTURE_COMPARE_MODE_EXT is NONE, then
1335bd8deadSopenharmony_ci
1345bd8deadSopenharmony_ci            r = D_t
1355bd8deadSopenharmony_ci
1365bd8deadSopenharmony_ci        If the value of TEXTURE_COMPARE_MODE_EXT is 
1375bd8deadSopenharmony_ci        COMPARE_REF_TO_TEXTURE_EXT, then r depends on the texture Comparison
1385bd8deadSopenharmony_ci        function as shown in table 3.X.
1395bd8deadSopenharmony_ci
1405bd8deadSopenharmony_ci
1415bd8deadSopenharmony_ci        Texture Comparison Function  Computed result r
1425bd8deadSopenharmony_ci        ---------------------------  -----------------
1435bd8deadSopenharmony_ci                                         { 1.0,  if D_ref <= Dt
1445bd8deadSopenharmony_ci        LEQUAL                       r = {
1455bd8deadSopenharmony_ci                                         { 0.0,  if D_ref > Dt
1465bd8deadSopenharmony_ci
1475bd8deadSopenharmony_ci                                         { 1.0,  if D_ref >= Dt
1485bd8deadSopenharmony_ci        GEQUAL                       r = {
1495bd8deadSopenharmony_ci                                         { 0.0,  if D_ref < Dt
1505bd8deadSopenharmony_ci
1515bd8deadSopenharmony_ci                                         { 1.0,  if D_ref < Dt
1525bd8deadSopenharmony_ci        LESS                         r = {
1535bd8deadSopenharmony_ci                                         { 0.0,  if D_ref >= Dt
1545bd8deadSopenharmony_ci
1555bd8deadSopenharmony_ci                                         { 1.0,  if D_ref > Dt
1565bd8deadSopenharmony_ci        GREATER                      r = {
1575bd8deadSopenharmony_ci                                         { 0.0,  if D_ref < Dt
1585bd8deadSopenharmony_ci
1595bd8deadSopenharmony_ci                                         { 1.0,  if D_ref == Dt
1605bd8deadSopenharmony_ci        EQUAL                        r = {
1615bd8deadSopenharmony_ci                                         { 0.0,  if D_ref != Dt
1625bd8deadSopenharmony_ci
1635bd8deadSopenharmony_ci                                         { 1.0,  if D_ref != Dt
1645bd8deadSopenharmony_ci        NOTEQUAL                     r = {
1655bd8deadSopenharmony_ci                                         { 0.0,  if D_ref == Dt
1665bd8deadSopenharmony_ci
1675bd8deadSopenharmony_ci        ALWAYS                       r = 1.0
1685bd8deadSopenharmony_ci
1695bd8deadSopenharmony_ci        NEVER                        r = 0.0
1705bd8deadSopenharmony_ci
1715bd8deadSopenharmony_ci             Table 3.X: Depth texture comparison functions.
1725bd8deadSopenharmony_ci
1735bd8deadSopenharmony_ci
1745bd8deadSopenharmony_ci        The resulting r is assigned to R_t.
1755bd8deadSopenharmony_ci
1765bd8deadSopenharmony_ci        If the value of TEXTURE_MAG_FILTER is not NEAREST, or the value of 
1775bd8deadSopenharmony_ci        TEXTURE_MIN_FILTER is not NEAREST or NEAREST_MIPMAP_NEAREST, then r may 
1785bd8deadSopenharmony_ci        be computed by comparing more than one depth texture value to the 
1795bd8deadSopenharmony_ci        texture reference value. The details of this are implementation-
1805bd8deadSopenharmony_ci        dependent, but r should be a value in the range [0, 1] which is 
1815bd8deadSopenharmony_ci        proportional to the number of comparison passes or failures."
1825bd8deadSopenharmony_ci
1835bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL ES 2.0 Specification (Per-Fragment
1845bd8deadSopenharmony_ciOperations and the Framebuffer)
1855bd8deadSopenharmony_ci
1865bd8deadSopenharmony_ci    None
1875bd8deadSopenharmony_ci
1885bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL ES 2.0 Specification (Special Functions)
1895bd8deadSopenharmony_ci
1905bd8deadSopenharmony_ci    None
1915bd8deadSopenharmony_ci
1925bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL ES 2.0 Specification (State and
1935bd8deadSopenharmony_ciState Requests)
1945bd8deadSopenharmony_ci
1955bd8deadSopenharmony_ci    None
1965bd8deadSopenharmony_ci
1975bd8deadSopenharmony_ciAdditions to OpenGL ES Shading Language 1.00 Specification
1985bd8deadSopenharmony_ci
1995bd8deadSopenharmony_ci    Append the following row to the table in section 4.1, Basic Types:
2005bd8deadSopenharmony_ci    
2015bd8deadSopenharmony_ci    Type             Meaning
2025bd8deadSopenharmony_ci    ---------------  ---------------------------------------------------------
2035bd8deadSopenharmony_ci    sampler2DShadow  a handle for accessing a 2D depth texture with comparison
2045bd8deadSopenharmony_ci
2055bd8deadSopenharmony_ci    Insert the following paragraph after the first paragraph in section 8.7, 
2065bd8deadSopenharmony_ci    Texture Lookup Functions:
2075bd8deadSopenharmony_ci    
2085bd8deadSopenharmony_ci    "For shadow forms (the sampler parameter is a shadow-type), a depth 
2095bd8deadSopenharmony_ci    comparison lookup on the depth texture bound to sampler is done as 
2105bd8deadSopenharmony_ci    described in section 3.7.14 “Texture Comparison Modes” of the OpenGL ES 
2115bd8deadSopenharmony_ci    Specification. See the table below for which component specifies D_ref. The
2125bd8deadSopenharmony_ci    texture bound to sampler must be a depth texture, or results are undefined.
2135bd8deadSopenharmony_ci    If a non-shadow texture call is made to a sampler that represents a depth 
2145bd8deadSopenharmony_ci    texture with depth comparisons turned on, then results are undefined. If a 
2155bd8deadSopenharmony_ci    shadow texture call is made to a sampler that represents a depth texture 
2165bd8deadSopenharmony_ci    with depth comparisons turned off, then results are undefined. If a shadow 
2175bd8deadSopenharmony_ci    texture call is made to a sampler that does not represent a depth texture, 
2185bd8deadSopenharmony_ci    then results are undefined."
2195bd8deadSopenharmony_ci
2205bd8deadSopenharmony_ci    Append "precision lowp sampler2DShadow;" to the default precision statements
2215bd8deadSopenharmony_ci    in section 4.5.3.
2225bd8deadSopenharmony_ci
2235bd8deadSopenharmony_ciDependencies on OES_packed_depth_stencil
2245bd8deadSopenharmony_ci
2255bd8deadSopenharmony_ci    If OES_packed_depth_stencil is not supported, then all references to
2265bd8deadSopenharmony_ci    DEPTH_STENCIL_OES should be omitted. 
2275bd8deadSopenharmony_ci
2285bd8deadSopenharmony_ciIssues
2295bd8deadSopenharmony_ci
2305bd8deadSopenharmony_ci    (1) Should the result of the texture comparison be interpreted as 
2315bd8deadSopenharmony_ci    a LUMINANCE, INTENSITY or ALPHA texel?
2325bd8deadSopenharmony_ci
2335bd8deadSopenharmony_ci    RESOLVED: A scalar value is returned from the shadow lookup built-in
2345bd8deadSopenharmony_ci    function in the fragment shader, so it can be interpreted however desired.
2355bd8deadSopenharmony_ci
2365bd8deadSopenharmony_ciRevision History
2375bd8deadSopenharmony_ci
2385bd8deadSopenharmony_ci   Date: 6/16/2011
2395bd8deadSopenharmony_ci   Revision: 1 (Benj Lipchak)
2405bd8deadSopenharmony_ci      - Initial draft
2415bd8deadSopenharmony_ci
2425bd8deadSopenharmony_ci   Date: 7/22/2011
2435bd8deadSopenharmony_ci   Revision: 2 (Benj Lipchak)
2445bd8deadSopenharmony_ci      - Rename from APPLE to EXT
2455bd8deadSopenharmony_ci
2465bd8deadSopenharmony_ci   Date: 1/18/2012
2475bd8deadSopenharmony_ci   Revision: 3 (Kelvin Chiu)
2485bd8deadSopenharmony_ci      - Add GL_SAMPLER_2D_SHADOW_EXT for glGetActiveUniform type
2495bd8deadSopenharmony_ci
2505bd8deadSopenharmony_ci   Date: 6/25/2012
2515bd8deadSopenharmony_ci   Revision: 4 (Benj Lipchak)
2525bd8deadSopenharmony_ci      - Specify lowp as the default precision of sampler2DShadow
253