Path: blob/main_old/extensions/ANGLE_depth_texture.txt
1693 views
Name12ANGLE_depth_texture34Name Strings56GL_ANGLE_depth_texture78Contributors910Nicolas Capens, TransGaming11Daniel Koch, TransGaming12Shannon Woods, TransGaming13Kenneth Russell, Google14Vangelis Kokkevis, Google15Gregg Tavares, Google16Contributors to OES_depth_texture17Contributors to OES_packed_depth_stencil1819Contact2021Shannon Woods, TransGaming (shannon 'dot' woods 'at' transgaming.com)2223Status2425Implemented in ANGLE.2627Version2829Last Modified Date: February 25, 201330Revision: #43132Number3334TBD3536Dependencies3738OpenGL ES 2.0 is required.39This extension is written against the OpenGL ES 2.0.25 specification4041OES_packed_depth_stencil affects the definition of this extension.4243EXT_texture_storage affects the definition of this extension.4445Overview4647This extension defines support for 2D depth and depth-stencil48textures in an OpenGL ES implementation.4950This extension incorporates the depth texturing functionality of51OES_depth_texture and OES_packed_depth_stencil, but does not52provide the ability to load existing data via TexImage2D or53TexSubImage2D. This extension also allows implementation54variability in which components from a sampled depth texture55contain the depth data. Depth textures created with this56extension only support 1 level.5758New Procedures and Functions5960None6162New Tokens6364Accepted by the <format> parameter of TexImage2D and TexSubImage2D and65<internalformat> parameter of TexImage2D:6667DEPTH_COMPONENT 0x190268DEPTH_STENCIL_OES 0x84F96970Accepted by the <type> parameter of TexImage2D, TexSubImage2D:7172UNSIGNED_SHORT 0x140373UNSIGNED_INT 0x140574UNSIGNED_INT_24_8_OES 0x84FA7576Accepted by the <internalformat> parameter of TexStorage2DEXT:7778DEPTH_COMPONENT16 0x81A579DEPTH_COMPONENT32_OES 0x81A780DEPTH24_STENCIL8_OES 0x88F08182Additions to Chapter 2 of the OpenGL ES 2.0 Specification (OpenGL Operation)8384Update Section 2.10.5 "Shader Execution" in the subsection titled85"Texture Access" add a new paragraph before the last paragraph add86this line:8788"The stencil index texture internal component is ignored if the base89internal format is DEPTH_STENCIL_OES.9091If a vertex shader uses..."9293Additions to Chapter 3 of the OpenGL ES 2.0 specification (Rasterization)9495Add the following rows to Table 3.2 (page 62):9697type Parameter GL Data Type Special98------------------------------------------------99... ... ...100UNSIGNED_SHORT ushort No101UNSIGNED_INT uint No102UNSIGNED_INT_24_8_OES uint Yes103104Add the following rows to Table 3.3 (page 62):105106Format Name Element Meaning and Order Target Buffer107------------------------------------------------------------------108... ... ...109DEPTH_COMPONENT Depth Depth110DEPTH_STENCIL_OES Depth and Stencil Index Depth and Stencil111... ... ...112113Add a row to Table 3.5 "Packed pixel formats" (page 64):114115type Parameter GL Type Components Pixel Formats116------------------------------------------------------------------117... ... ... ...118UNSIGNED_INT_24_8_OES uint 2 DEPTH_STENCIL_OES119120Add a new table after Table 3.6 (page 64):121122UNSIGNED_INT_24_8_OES12312431 30 29 28 27 26 ... 12 11 10 9 8 7 6 5 4 3 2 1 0125+----------------------------------+---------------+126| 1st Component | 2nd Component |127+----------------------------------+---------------+128129Table 3.6.B: UNSIGNED_INT formats130131Add a row to Table 3.7 "Packed pixel field assignments" (page 65):132133Format | 1st 2nd 3rd 4th134------------------+-------------------------------135... | ... ... ... ...136DEPTH_STENCIL_OES | depth stencil N/A N/A137138Add the following paragraph to the end of the section "Conversion to139floating-point" (page 65):140141"For groups of components that contain both standard components and index142elements, such as DEPTH_STENCIL_OES, the index elements are not converted."143144In section 3.7.1 "Texture Image Specification", update page 67 to145say:146147"The selected groups are processed as described in section 3.6.2, stopping148just before final conversion. Each R, G, B, A, or depth value so generated149is clamped to [0, 1], while the stencil index values are masked by 2^n-1,150where n is the number of stencil bits in the internal format resolution151(see below).152153Components are then selected from the resulting R, G, B, A, depth, or154stencil index values to obtain a texture with the base internal format155specified by <internalformat>. Table 3.8 summarizes the mapping of R, G,156B, A, depth, or stencil values to texture components, as a function of the157base internal format of the texture image. <internalformat> may be158specified as one of the internal format symbolic constants listed in159table 3.8. Specifying a value for <internalformat> that is not one of the160above values generates the error INVALID_VALUE. If <internalformat> does161not match <format>, the error INVALID_OPERATION is generated.162163Textures with a base internal format of DEPTH_COMPONENT or164DEPTH_STENCIL_OES are supported by texture image specification commands165only if <target> is TEXTURE_2D. Using these formats in conjunction with166any other <target> will result in an INVALID_OPERATION error.167168Textures with a base internal format of DEPTH_COMPONENT or169DEPTH_STENCIL_OES only support one level of image data. Specifying a170non-zero value for <level> will result in an INVALID_OPERATION error.171172Textures with a base internal format of DEPTH_COMPONENT or DEPTH_STENCIL_OES173require either depth component data or depth/stencil component data.174Textures with other base internal formats require RGBA component data. The175error INVALID_OPERATION is generated if the base internal format is176DEPTH_COMPONENT or DEPTH_STENCIL_OES and <format> is not DEPTH_COMPONENT or177DEPTH_STENCIL_OES, or if the base internal format is not DEPTH_COMPONENT or178DEPTH_STENCIL_OES and <format> is DEPTH_COMPONENT or DEPTH_STENCIL_OES.179180Textures with a base internal format of DEPTH_COMPONENT or181DEPTH_STENCIL_OES do not support loading image data via the TexImage182commands. They can only have their contents specified by rendering183to them. The INVALID_OPERATION error is generated by the TexImage2D184command if <data> is not NULL for such textures."185186Add a row to table 3.8 (page 68), and update the title of the187second column:188189Base Internal Format RGBA, Depth and Stencil Values Internal Components190-------------------------------------------------------------------------191... ... ...192DEPTH_COMPONENT Depth D193DEPTH_STENCIL_OES Depth,Stencil D,S194... ... ...195196Update the caption for table 3.8 (page 68)197198"Table 3.8: Conversion from RGBA, depth, and stencil pixel components to199internal texture components. Texture components R, G, B, A, and L are200converted back to RGBA colors during filtering as shown in table 3.12.201Texture components D are converted to RGBA colors as described in202section 3.7.8-1/2."203204Add the following to section 3.7.2 "Alternate Texture Image Specification205Commands":206207"CopyTexImage2D and CopyTexSubImage2D generate the INVALID_OPERATION208error if the base internal format of the destination texture is209DEPTH_COMPONENT or DEPTH_STENCIL_OES.210211TexSubImage2D generates the INVALID_OPERATION error if the base internal212format of the texture is DEPTH_COMPONENT or DEPTH_STENCIL_OES."213214Add a new section between sections 3.7.8 and 3.7.9:215216"3.7.8-1/2 Depth/Stencil Textures217218If the currently bound texture's base internal format is DEPTH_COMPONENT or219DEPTH_STENCIL_OES, then the output of the texture unit is as described220below. Otherwise, the texture unit operates in the normal manner.221222Let <D_t> be the depth texture value, provided by the shader's texture lookup223function. Then the effective texture value is computed as follows:224<Tau> = <D_t>225226If the texture image has a base internal format of DEPTH_STENCIL_OES, then227the stencil index texture component is ignored. The texture value <Tau> does228not include a stencil index component, but includes only the depth229component.230231The resulting <Tau> is assigned to <R_t>. In some implementations, <Tau> is232also assigned to <G_t>, <B_t>, or <A_t>. Thus in table 3.12, textures with233depth component data behave as if their base internal format is RGBA, with234values in <G_t>, <B_t>, and <A_t> being implementation dependent."235236Add the following to section 3.7.11 "Mipmap Generation":237238"If the level zero array contains depth or depth-stencil data, the239error INVALID_OPERATION is generated."240241Insert a new paragraph after the first paragraph of the "Texture Access"242subsection of section 3.8.2 on page 87, which says:243244"Texture lookups involving textures with depth component data generate245a texture source color by using depth data directly, as described in246section 3.7.8-1/2. The stencil texture internal component is ignored247if the base internal format is DEPTH_STENCIL_OES."248249Additions to Chapter 4 of the OpenGL ES 2.0 specification (Per-Fragment250Operations and the Framebuffer)251252In section 4.4.5 "Framebuffer Completeness", replace the the 3rd253paragraph with the following text:254255"* An internal format is color-renderable if it is one of the formats256from table 4.5 noted as color-renderable or if it is unsized format257RGBA or RGB. No other formats, including compressed internal formats,258are color-renderable.259260* An internal format is depth-renderable if it is one of the sized261internal formats from table 4.5 noted as depth-renderable, if it262is the unsized format DEPTH_COMPONENT or if it is the internal263format value of DEPTH24_STENCIL8_OES. No other formats are264depth-renderable.265266* An internal format is stencil-renderable if it is one of the sized267internal formats from table 4.5 noted as stencil-renderable or if it268is DEPTH24_STENCIL8_OES. No other formats are stencil-renderable."269270Additions to Chapter 5 of the OpenGL ES 2.0 Specification (Special271Functions)272273None.274275Additions to Chapter 6 of the OpenGL ES 2.0 Specification (State and State276Requests)277278None.279280Interactions with OES_packed_depth_stencil281282If OES_packed_depth_stencil is not supported, mentions of283DEPTH_STENCIL_OES and UNSIGNED_INT_24_8_OES as a format/type combinations284for TexImage2D and TexSubImage2D are omitted. Mentions of285the internal format DEPTH24_STENCIL8_OES are also omitted.286287Interactions with EXT_texture_storage288289If EXT_texture_storage is supported the following internalformat290to format/type mappings are used:291292<internalformat> <format> <type>293---------------- -------- ------294DEPTH_COMPONENT16 DEPTH_COMPONENT UNSIGNED_SHORT295DEPTH_COMPONENT32_OES DEPTH_COMPONENT UNSIGNED_INT296DEPTH24_STENCIL8_OES DEPTH_STENCIL_OES UNSIGNED_INT297298Textures with the above <internalformats> only support one level of299image data. Specifying a value other than one for the <levels> parameter300to TexStorage2DEXT will result in an INVALID_OPERATION error.301302If EXT_texture_storage is not supported, ignore any references303to TexStorage2DEXT.304305Errors306307The error INVALID_OPERATION is generated by TexImage2D if <format> and308<internalformat> are DEPTH_COMPONENT and <type> is not UNSIGNED_SHORT,309or UNSIGNED_INT.310311The error INVALID_OPERATION is generated by TexSubImage2D if <format> is312DEPTH_COMPONENT and <type> is not UNSIGNED_SHORT, or UNSIGNED_INT.313314The error INVALID_OPERATION is generated by TexImage2D if <format> and315<internalformat> are not DEPTH_COMPONENT and <type> is UNSIGNED_SHORT,316or UNSIGNED_INT.317318The error INVALID_OPERATION is generated by TexSubImage2D if <format> is319not DEPTH_COMPONENT and <type> is UNSIGNED_SHORT, or UNSIGNED_INT.320321The error INVALID_OPERATION is generated by TexImage2D if <format> and322<internalformat> are DEPTH_STENCIL_OES and <type> is not323UNSIGNED_INT_24_8_OES.324325The error INVALID_OPERATION is generated by TexSubImage2D if <format>326is DEPTH_STENCIL_OES and <type> is not UNSIGNED_INT_24_8_OES.327328The error INVALID_OPERATION is generated by TexImage2D if <format> and329<internalformat> is not DEPTH_STENCIL_OES and <type> is330UNSIGNED_INT_24_8_OES.331332The error INVALID_OPERATION is generated by TexSubImage2D if <format>333is not DEPTH_STENCIL_OES and <type> is UNSIGNED_INT_24_8_OES.334335The error INVALID_OPERATION is generated in the following situations:336- TexImage2D is called with <format> and <internalformat> of337DEPTH_COMPONENT or DEPTH_STENCIL_OES and338- <target> is not TEXTURE_2D,339- <data> is not NULL, or340- <level> is not zero.341- TexSubImage2D is called with <format> of DEPTH_COMPONENT or342DEPTH_STENCIL_OES.343- TexStorage2DEXT is called with <internalformat> of DEPTH_COMPONENT16,344DEPTH_COMPONENT32_OES, or DEPTH24_STENCIL8_OES, and345- <target> is not TEXTURE_2D, or346- <levels> is not one.347- CopyTexImage2D is called with an <internalformat> that has a base348internal format of DEPTH_COMPONENT or DEPTH_STENCIL_OES.349- CopyTexSubImage2D is called with a target texture that has a base350internal format of DEPTH_COMPONENT or DEPTH_STENCIL_OES.351- GenerateMipmap is called on a texture that has a base internal format352of DEPTH_COMPONENT or DEPTH_STENCIL_OES.353354New State355356None.357358Issues3593601) What are the differences between this extension and OES_depth_texture361and OES_packed_depth_stencil?362363RESOLVED: This extension:364- does not support loading pre-baked depth stencil data via365TexImage2D or TexSubImage2D.366- allows variability in the y-, z-, and w-components of the sample367results from depth textures.368- only supports one level textures.369- explicitly lists the errors for unsupported functionality.370Since these were not clearly specified in the OES_depth_texture371extension there may be differences in error values between372implementations of OES_depth_texture and ANGLE_depth_texture.373This specification was also rebased to apply against the OpenGL ES 2.0374specification instead of the OpenGL specification, making it more375obvious what all the functionality changes are.3763772) Why does TexSubImage2D accept the new format/type combinations even378though it does not actually support loading data?379380RESOLVED: This was done to be more consistent with the OES_depth_texture381extension and to make it easier to add support for loading texture382data if it is possible to support in the future.3833843) Why are only 1-level depth textures supported?385386RESOLVED: The only use for multiple levels of depth textures would387be for fitlered texturing. However since it is not possible to388render to non-zero-level texture levels in OpenGL ES 2.0, and since389this extension forbids loading existing data and GenerateMipmap on390depth textures, it is impossible to initialize or specify contents391for non-zero levels of depth textures.392393Revision History39439502/25/2013 swoods revise to allow texture lookup to guarantee depth values396only in red channel of sample result.39706/04/2012 dgkoch fix errors, disallow multi-level depth textures.39805/30/2012 dgkoch minor updates and add issues.39905/23/2012 dgkoch intial revision based on OES_depth_texture and400OES_packed_depth_stencil and rebased against the ES 2.0 spec401402403404