15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    OES_depth_texture
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_OES_depth_texture
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Aaftab Munshi (amunshi@apple.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciNotice
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    Copyright (c) 2006-2013 The Khronos Group Inc. Copyright terms at
165bd8deadSopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
175bd8deadSopenharmony_ci
185bd8deadSopenharmony_ciSpecification Update Policy
195bd8deadSopenharmony_ci
205bd8deadSopenharmony_ci    Khronos-approved extension specifications are updated in response to
215bd8deadSopenharmony_ci    issues and bugs prioritized by the Khronos OpenGL ES Working Group. For
225bd8deadSopenharmony_ci    extensions which have been promoted to a core Specification, fixes will
235bd8deadSopenharmony_ci    first appear in the latest version of that core Specification, and will
245bd8deadSopenharmony_ci    eventually be backported to the extension document. This policy is
255bd8deadSopenharmony_ci    described in more detail at
265bd8deadSopenharmony_ci        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
275bd8deadSopenharmony_ci
285bd8deadSopenharmony_ciStatus
295bd8deadSopenharmony_ci
305bd8deadSopenharmony_ci    Ratified by the Khronos BOP, March 20, 2008.
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ciVersion
335bd8deadSopenharmony_ci
345bd8deadSopenharmony_ci    Last Modifed Date: January 29, 2012
355bd8deadSopenharmony_ci
365bd8deadSopenharmony_ciNumber
375bd8deadSopenharmony_ci
385bd8deadSopenharmony_ci    OpenGL ES Extension #44
395bd8deadSopenharmony_ci
405bd8deadSopenharmony_ciDependencies
415bd8deadSopenharmony_ci
425bd8deadSopenharmony_ci    OpenGL ES 2.0 is required.
435bd8deadSopenharmony_ci    This extension is written against the OpenGL ES 2.0 specification
445bd8deadSopenharmony_ci
455bd8deadSopenharmony_ciOverview
465bd8deadSopenharmony_ci
475bd8deadSopenharmony_ci    This extension defines a new texture format that stores depth values in 
485bd8deadSopenharmony_ci    the texture.  Depth texture images are widely used for shadow casting but 
495bd8deadSopenharmony_ci    can also  be used for other effects such as image based rendering, displacement 
505bd8deadSopenharmony_ci    mapping etc.  
515bd8deadSopenharmony_ci
525bd8deadSopenharmony_ciIssues
535bd8deadSopenharmony_ci
545bd8deadSopenharmony_ci1.  Should manual generation of mipmaps for a depth texture using GenerateMipmap be supported?
555bd8deadSopenharmony_ci
565bd8deadSopenharmony_ci    Possible Resolutions:
575bd8deadSopenharmony_ci
585bd8deadSopenharmony_ci    a)  Allow manual generation of mipmaps.  This will ensure that GenerateMipmap works
595bd8deadSopenharmony_ci        consistently for any texture.
605bd8deadSopenharmony_ci
615bd8deadSopenharmony_ci    b)  Disallow.  GenerateMipmap will generate INVALID_OPERATION error for a depth texture.
625bd8deadSopenharmony_ci        The reason for this is that doing a low-pass filter to generate depth values for 
635bd8deadSopenharmony_ci        higher mip-levels of a depth texture does not make sense.
645bd8deadSopenharmony_ci
655bd8deadSopenharmony_ci    Resolution: Adopt approach b).  Manual generation of mipmaps is done by averaging a 
665bd8deadSopenharmony_ci    2 x 2 region --> 1 texel as we go from one level to the next.  This does not make much 
675bd8deadSopenharmony_ci    sense for depth textures.  A better approach would be to take a min or max of 2 x 2 texel 
685bd8deadSopenharmony_ci    region instead of doing an average.  Since min & max filters are not supported by GenerateMipmap, 
695bd8deadSopenharmony_ci    the WG decided to disallow manual generation of mipmaps for a depth texture.
705bd8deadSopenharmony_ci
715bd8deadSopenharmony_ci2.  Should GL_DEPTH_TEXTURE_MODE be used to determine whether depth textures are treated as
725bd8deadSopenharmony_ci    LUMINANCE, INTENSITY or ALPHA textures during texture filtering and application.
735bd8deadSopenharmony_ci
745bd8deadSopenharmony_ci    Possible Resolutions:
755bd8deadSopenharmony_ci
765bd8deadSopenharmony_ci    a)  Adopt text from the OpenGL specification.
775bd8deadSopenharmony_ci
785bd8deadSopenharmony_ci    b)  No longer require DEPTH_TEXTURE_MODE.  Treat depth textures always as luminance 
795bd8deadSopenharmony_ci        textures i.e. depth value is returned as (d, d, d, 1.0) by GLSL texture* calls in the
805bd8deadSopenharmony_ci        fragment and/or vertex shader.
815bd8deadSopenharmony_ci
825bd8deadSopenharmony_ci    Resolution:  Adopt approach b).  We only need to support one way of treating how depth textures
835bd8deadSopenharmony_ci    are read by the shader instead of three possible ways as supported by OpenGL.  Almost all apps on 
845bd8deadSopenharmony_ci    desktop that use depth textures treat depth textures as LUMINANCE.  Therefore, this extension treats 
855bd8deadSopenharmony_ci    depth textures always as luminance textures and no longer supports DEPTH_TEXTURE_MODE.
865bd8deadSopenharmony_ci
875bd8deadSopenharmony_ci3.  How should 24-bit depth texture data be represented when specified in TexImage2D and TexSubImage2D?
885bd8deadSopenharmony_ci
895bd8deadSopenharmony_ci    Resolution:  This is currently not supported.  Depth textures can be specified with 16-bit depth
905bd8deadSopenharmony_ci    values i.e. <type> = UNSIGNED_SHORT or 32-bit depth values i.e. <type> = UNSIGNED_INT.
915bd8deadSopenharmony_ci
925bd8deadSopenharmony_ci4.  Are cube-map depth textures implemented by this extension?
935bd8deadSopenharmony_ci
945bd8deadSopenharmony_ci    Resolution: No. This is defined in OES_depth_texture_cube_map.
955bd8deadSopenharmony_ci
965bd8deadSopenharmony_ci    A very interesting use case is rendering shadows for a point light.
975bd8deadSopenharmony_ci    For a point light, you want to be able to render depth values into a cube-map and then 
985bd8deadSopenharmony_ci    use this cube-map depth texture as a shadow map to compute % in shadow at each pixel.
995bd8deadSopenharmony_ci    
1005bd8deadSopenharmony_ci    The original version of this extension supported cube-map
1015bd8deadSopenharmony_ci    depth textures, but this was contradicted by OES_packed_depth_stencil which
1025bd8deadSopenharmony_ci    only supported 2D textures. Some implementations of OES_depth_texture did
1035bd8deadSopenharmony_ci    not support cube-maps while others did so it was decided to make support for
1045bd8deadSopenharmony_ci    cube-map depth textures a separate extension.
1055bd8deadSopenharmony_ci
1065bd8deadSopenharmony_ci5.  Are 3D depth textures implemented by this extension?
1075bd8deadSopenharmony_ci
1085bd8deadSopenharmony_ci    Resolution:  This is not supported.  We could not come up with any use cases for
1095bd8deadSopenharmony_ci    3D depth textures.  In addition, we can always define a new extension that adds 
1105bd8deadSopenharmony_ci    this specific functionality in the future.
1115bd8deadSopenharmony_ci
1125bd8deadSopenharmony_ciNew Procedures and Functions
1135bd8deadSopenharmony_ci
1145bd8deadSopenharmony_ci    None
1155bd8deadSopenharmony_ci
1165bd8deadSopenharmony_ciNew Tokens
1175bd8deadSopenharmony_ci
1185bd8deadSopenharmony_ci    Accepted by the <format> parameter of TexImage2D and TexSubImage2D and
1195bd8deadSopenharmony_ci    <internalFormat> parameter of TexImage2D:
1205bd8deadSopenharmony_ci    
1215bd8deadSopenharmony_ci        DEPTH_COMPONENT          0x1902
1225bd8deadSopenharmony_ci        
1235bd8deadSopenharmony_ci    Accepted by the <type> parameter of TexImage2D, TexSubImage2D: 
1245bd8deadSopenharmony_ci
1255bd8deadSopenharmony_ci        UNSIGNED_SHORT           0x1403
1265bd8deadSopenharmony_ci        UNSIGNED_INT             0x1405
1275bd8deadSopenharmony_ci
1285bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL ES 2.0 Specification (OpenGL Operation)
1295bd8deadSopenharmony_ci
1305bd8deadSopenharmony_ci    Modifications to table 2.9 (Component conversions)
1315bd8deadSopenharmony_ci
1325bd8deadSopenharmony_ci        Add the following entries:
1335bd8deadSopenharmony_ci
1345bd8deadSopenharmony_ci            GLType                     Conversion
1355bd8deadSopenharmony_ci            -------                    ----------
1365bd8deadSopenharmony_ci            UNSIGNED_SHORT             c / (2^16 - 1)
1375bd8deadSopenharmony_ci            UNSIGNED_INT               c / (2^32 - 1)
1385bd8deadSopenharmony_ci
1395bd8deadSopenharmony_ci        NOTE:  UNSIGNED_SHORT and UNSIGNED_INT entries already exist in table 2.9 of the 
1405bd8deadSopenharmony_ci               OpenGL ES 2.0 specification and have been added here for clarity.
1415bd8deadSopenharmony_ci
1425bd8deadSopenharmony_ciAdditions to Chapter 3, section 3.8 of the OpenGL ES 2.0 specification
1435bd8deadSopenharmony_ci
1445bd8deadSopenharmony_ci    Textures with <format> and <internalFormat> values of DEPTH_COMPONENT
1455bd8deadSopenharmony_ci    refer to a texture that contains depth component data.  <type> is used
1465bd8deadSopenharmony_ci    to determine the number of bits used to specify depth texel values.  
1475bd8deadSopenharmony_ci
1485bd8deadSopenharmony_ci    A <type> value of UNSIGNED_SHORT refers to a 16-bit depth value.
1495bd8deadSopenharmony_ci  
1505bd8deadSopenharmony_ci    A <type> value of UNSIGNED_INT refers to a 32-bit depth value.
1515bd8deadSopenharmony_ci    
1525bd8deadSopenharmony_ci    As per the OpenGL ES spec, there is no guarantee that the OpenGL ES implementation 
1535bd8deadSopenharmony_ci    will use the <type> to determine how to store the depth texture internally.  
1545bd8deadSopenharmony_ci    It may choose to downsample the 32-bit depth values to 16-bit or even 24-bit.
1555bd8deadSopenharmony_ci    There is currently no way for the application to know or find out how the
1565bd8deadSopenharmony_ci    depth texture (or any texture) will be stored internally by the OpenGL ES implementation.
1575bd8deadSopenharmony_ci
1585bd8deadSopenharmony_ci    Textures with a base internal format of DEPTH_COMPONENT are supported
1595bd8deadSopenharmony_ci    by texture image specification commands only if <target> is TEXTURE_2D.
1605bd8deadSopenharmony_ci    Using this format in conjunction with any other <target> will result in
1615bd8deadSopenharmony_ci    an INVALID_OPERATION error.
1625bd8deadSopenharmony_ci
1635bd8deadSopenharmony_ci    CopyTexImage2D and CopyTexSubImage2D are not supported.
1645bd8deadSopenharmony_ci
1655bd8deadSopenharmony_ciAdditions to Chapter 4, section 4.4.2 of the OpenGL ES 2.0 specification
1665bd8deadSopenharmony_ci
1675bd8deadSopenharmony_ci    Textures of <format> = DEPTH_COMPONENT are depth renderable.
1685bd8deadSopenharmony_ci
1695bd8deadSopenharmony_ciErrors
1705bd8deadSopenharmony_ci
1715bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if the <format> and <internalFormat>
1725bd8deadSopenharmony_ci    is DEPTH_COMPONENT and <type> is not UNSIGNED_SHORT, or UNSIGNED_INT.
1735bd8deadSopenharmony_ci
1745bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if the <format> and <internalFormat>
1755bd8deadSopenharmony_ci    is not DEPTH_COMPONENT and <type> is UNSIGNED_SHORT, or UNSIGNED_INT.
1765bd8deadSopenharmony_ci
1775bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if <target> is not TEXTURE_2D.
1785bd8deadSopenharmony_ci
1795bd8deadSopenharmony_ciNew State
1805bd8deadSopenharmony_ci
1815bd8deadSopenharmony_ci    None.
1825bd8deadSopenharmony_ci
1835bd8deadSopenharmony_ciRevision History
1845bd8deadSopenharmony_ci 
1855bd8deadSopenharmony_ci    1/17/2006    First Draft.
1865bd8deadSopenharmony_ci    6/14/2006    CopyTexImage2D and CopyTexSubImage2D are not supported.
1875bd8deadSopenharmony_ci    7/19/2007    Added Issues section + updates to section 3.8 +
1885bd8deadSopenharmony_ci                 add section on supporting framebuffer texture attachements
1895bd8deadSopenharmony_ci                 for depth textures.
1905bd8deadSopenharmony_ci    7/30/2007    Update issues section with adopted resolutions.
1915bd8deadSopenharmony_ci                 Updates to the Errors section.
1925bd8deadSopenharmony_ci    7/31/2007    Updates to conversion table 2.9
1935bd8deadSopenharmony_ci    9/4/2007     Added item 3 to Issues List.  
1945bd8deadSopenharmony_ci                 Resolution for issue 1 changed to b) - decided in ES WG meeting on 8/29/2007.
1955bd8deadSopenharmony_ci    9/24/2007    Removed UNSIGNED_INT_24_OES.  Added reasoning to resolutions in Issues section.
1965bd8deadSopenharmony_ci                 Removed dependencies on OES_depth24 and OES_depth32.
1975bd8deadSopenharmony_ci    10/20/2007   Added issues 4. and 5.
1985bd8deadSopenharmony_ci    10/08/2009   Changed INVALID_VALUE to INVALID_OPERATION error (bug 5209).
1995bd8deadSopenharmony_ci    01/29/2012   Move depth cube map texture support to OES_depth_texture_cube_map.
200