xref: /aosp_15_r20/external/angle/extensions/ANGLE_depth_texture.txt (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1*8975f5c5SAndroid Build Coastguard WorkerName
2*8975f5c5SAndroid Build Coastguard Worker
3*8975f5c5SAndroid Build Coastguard Worker    ANGLE_depth_texture
4*8975f5c5SAndroid Build Coastguard Worker
5*8975f5c5SAndroid Build Coastguard WorkerName Strings
6*8975f5c5SAndroid Build Coastguard Worker
7*8975f5c5SAndroid Build Coastguard Worker    GL_ANGLE_depth_texture
8*8975f5c5SAndroid Build Coastguard Worker
9*8975f5c5SAndroid Build Coastguard WorkerContributors
10*8975f5c5SAndroid Build Coastguard Worker
11*8975f5c5SAndroid Build Coastguard Worker    Nicolas Capens, TransGaming
12*8975f5c5SAndroid Build Coastguard Worker    Daniel Koch, TransGaming
13*8975f5c5SAndroid Build Coastguard Worker    Shannon Woods, TransGaming
14*8975f5c5SAndroid Build Coastguard Worker    Kenneth Russell, Google
15*8975f5c5SAndroid Build Coastguard Worker    Vangelis Kokkevis, Google
16*8975f5c5SAndroid Build Coastguard Worker    Gregg Tavares, Google
17*8975f5c5SAndroid Build Coastguard Worker    Contributors to OES_depth_texture
18*8975f5c5SAndroid Build Coastguard Worker    Contributors to OES_packed_depth_stencil
19*8975f5c5SAndroid Build Coastguard Worker
20*8975f5c5SAndroid Build Coastguard WorkerContact
21*8975f5c5SAndroid Build Coastguard Worker
22*8975f5c5SAndroid Build Coastguard Worker    Shannon Woods, TransGaming (shannon 'dot' woods 'at' transgaming.com)
23*8975f5c5SAndroid Build Coastguard Worker
24*8975f5c5SAndroid Build Coastguard WorkerStatus
25*8975f5c5SAndroid Build Coastguard Worker
26*8975f5c5SAndroid Build Coastguard Worker    Implemented in ANGLE.
27*8975f5c5SAndroid Build Coastguard Worker
28*8975f5c5SAndroid Build Coastguard WorkerVersion
29*8975f5c5SAndroid Build Coastguard Worker
30*8975f5c5SAndroid Build Coastguard Worker    Last Modified Date: February 25, 2013
31*8975f5c5SAndroid Build Coastguard Worker    Revision: #4
32*8975f5c5SAndroid Build Coastguard Worker
33*8975f5c5SAndroid Build Coastguard WorkerNumber
34*8975f5c5SAndroid Build Coastguard Worker
35*8975f5c5SAndroid Build Coastguard Worker    TBD
36*8975f5c5SAndroid Build Coastguard Worker
37*8975f5c5SAndroid Build Coastguard WorkerDependencies
38*8975f5c5SAndroid Build Coastguard Worker
39*8975f5c5SAndroid Build Coastguard Worker    OpenGL ES 2.0 is required.
40*8975f5c5SAndroid Build Coastguard Worker    This extension is written against the OpenGL ES 2.0.25 specification
41*8975f5c5SAndroid Build Coastguard Worker
42*8975f5c5SAndroid Build Coastguard Worker    OES_packed_depth_stencil affects the definition of this extension.
43*8975f5c5SAndroid Build Coastguard Worker
44*8975f5c5SAndroid Build Coastguard Worker    EXT_texture_storage affects the definition of this extension.
45*8975f5c5SAndroid Build Coastguard Worker
46*8975f5c5SAndroid Build Coastguard WorkerOverview
47*8975f5c5SAndroid Build Coastguard Worker
48*8975f5c5SAndroid Build Coastguard Worker    This extension defines support for 2D depth and depth-stencil
49*8975f5c5SAndroid Build Coastguard Worker    textures in an OpenGL ES implementation.
50*8975f5c5SAndroid Build Coastguard Worker
51*8975f5c5SAndroid Build Coastguard Worker    This extension incorporates the depth texturing functionality of
52*8975f5c5SAndroid Build Coastguard Worker    OES_depth_texture and OES_packed_depth_stencil, but does not
53*8975f5c5SAndroid Build Coastguard Worker    provide the ability to load existing data via TexImage2D or
54*8975f5c5SAndroid Build Coastguard Worker    TexSubImage2D. This extension also allows implementation
55*8975f5c5SAndroid Build Coastguard Worker    variability in which components from a sampled depth texture
56*8975f5c5SAndroid Build Coastguard Worker    contain the depth data. Depth textures created with this
57*8975f5c5SAndroid Build Coastguard Worker    extension only support 1 level.
58*8975f5c5SAndroid Build Coastguard Worker
59*8975f5c5SAndroid Build Coastguard WorkerNew Procedures and Functions
60*8975f5c5SAndroid Build Coastguard Worker
61*8975f5c5SAndroid Build Coastguard Worker    None
62*8975f5c5SAndroid Build Coastguard Worker
63*8975f5c5SAndroid Build Coastguard WorkerNew Tokens
64*8975f5c5SAndroid Build Coastguard Worker
65*8975f5c5SAndroid Build Coastguard Worker    Accepted by the <format> parameter of TexImage2D and TexSubImage2D and
66*8975f5c5SAndroid Build Coastguard Worker    <internalformat> parameter of TexImage2D:
67*8975f5c5SAndroid Build Coastguard Worker
68*8975f5c5SAndroid Build Coastguard Worker        DEPTH_COMPONENT             0x1902
69*8975f5c5SAndroid Build Coastguard Worker        DEPTH_STENCIL_OES           0x84F9
70*8975f5c5SAndroid Build Coastguard Worker
71*8975f5c5SAndroid Build Coastguard Worker    Accepted by the <type> parameter of TexImage2D, TexSubImage2D:
72*8975f5c5SAndroid Build Coastguard Worker
73*8975f5c5SAndroid Build Coastguard Worker        UNSIGNED_SHORT              0x1403
74*8975f5c5SAndroid Build Coastguard Worker        UNSIGNED_INT                0x1405
75*8975f5c5SAndroid Build Coastguard Worker        UNSIGNED_INT_24_8_OES       0x84FA
76*8975f5c5SAndroid Build Coastguard Worker
77*8975f5c5SAndroid Build Coastguard Worker    Accepted by the <internalformat> parameter of TexStorage2DEXT:
78*8975f5c5SAndroid Build Coastguard Worker
79*8975f5c5SAndroid Build Coastguard Worker        DEPTH_COMPONENT16           0x81A5
80*8975f5c5SAndroid Build Coastguard Worker        DEPTH_COMPONENT32_OES       0x81A7
81*8975f5c5SAndroid Build Coastguard Worker        DEPTH24_STENCIL8_OES        0x88F0
82*8975f5c5SAndroid Build Coastguard Worker
83*8975f5c5SAndroid Build Coastguard WorkerAdditions to Chapter 2 of the OpenGL ES 2.0 Specification (OpenGL Operation)
84*8975f5c5SAndroid Build Coastguard Worker
85*8975f5c5SAndroid Build Coastguard Worker    Update Section 2.10.5 "Shader Execution" in the subsection titled
86*8975f5c5SAndroid Build Coastguard Worker    "Texture Access" add a new paragraph before the last paragraph add
87*8975f5c5SAndroid Build Coastguard Worker    this line:
88*8975f5c5SAndroid Build Coastguard Worker
89*8975f5c5SAndroid Build Coastguard Worker    "The stencil index texture internal component is ignored if the base
90*8975f5c5SAndroid Build Coastguard Worker    internal format is DEPTH_STENCIL_OES.
91*8975f5c5SAndroid Build Coastguard Worker
92*8975f5c5SAndroid Build Coastguard Worker    If a vertex shader uses..."
93*8975f5c5SAndroid Build Coastguard Worker
94*8975f5c5SAndroid Build Coastguard WorkerAdditions to Chapter 3 of the OpenGL ES 2.0 specification (Rasterization)
95*8975f5c5SAndroid Build Coastguard Worker
96*8975f5c5SAndroid Build Coastguard Worker    Add the following rows to Table 3.2 (page 62):
97*8975f5c5SAndroid Build Coastguard Worker
98*8975f5c5SAndroid Build Coastguard Worker      type Parameter           GL Data Type    Special
99*8975f5c5SAndroid Build Coastguard Worker      ------------------------------------------------
100*8975f5c5SAndroid Build Coastguard Worker      ...                      ...              ...
101*8975f5c5SAndroid Build Coastguard Worker      UNSIGNED_SHORT           ushort           No
102*8975f5c5SAndroid Build Coastguard Worker      UNSIGNED_INT             uint             No
103*8975f5c5SAndroid Build Coastguard Worker      UNSIGNED_INT_24_8_OES    uint             Yes
104*8975f5c5SAndroid Build Coastguard Worker
105*8975f5c5SAndroid Build Coastguard Worker    Add the following rows to Table 3.3 (page 62):
106*8975f5c5SAndroid Build Coastguard Worker
107*8975f5c5SAndroid Build Coastguard Worker      Format Name       Element Meaning and Order      Target Buffer
108*8975f5c5SAndroid Build Coastguard Worker      ------------------------------------------------------------------
109*8975f5c5SAndroid Build Coastguard Worker      ...               ...                            ...
110*8975f5c5SAndroid Build Coastguard Worker      DEPTH_COMPONENT   Depth                          Depth
111*8975f5c5SAndroid Build Coastguard Worker      DEPTH_STENCIL_OES Depth and Stencil Index        Depth and Stencil
112*8975f5c5SAndroid Build Coastguard Worker      ...               ...                            ...
113*8975f5c5SAndroid Build Coastguard Worker
114*8975f5c5SAndroid Build Coastguard Worker    Add a row to Table 3.5 "Packed pixel formats" (page 64):
115*8975f5c5SAndroid Build Coastguard Worker
116*8975f5c5SAndroid Build Coastguard Worker      type Parameter               GL Type  Components  Pixel Formats
117*8975f5c5SAndroid Build Coastguard Worker      ------------------------------------------------------------------
118*8975f5c5SAndroid Build Coastguard Worker      ...                          ...      ...         ...
119*8975f5c5SAndroid Build Coastguard Worker      UNSIGNED_INT_24_8_OES        uint     2           DEPTH_STENCIL_OES
120*8975f5c5SAndroid Build Coastguard Worker
121*8975f5c5SAndroid Build Coastguard Worker    Add a new table after Table 3.6 (page 64):
122*8975f5c5SAndroid Build Coastguard Worker
123*8975f5c5SAndroid Build Coastguard Worker    UNSIGNED_INT_24_8_OES
124*8975f5c5SAndroid Build Coastguard Worker
125*8975f5c5SAndroid Build Coastguard Worker       31 30 29 28 27 26 ... 12 11 10 9 8 7 6 5 4 3 2 1 0
126*8975f5c5SAndroid Build Coastguard Worker      +----------------------------------+---------------+
127*8975f5c5SAndroid Build Coastguard Worker      |           1st Component          | 2nd Component |
128*8975f5c5SAndroid Build Coastguard Worker      +----------------------------------+---------------+
129*8975f5c5SAndroid Build Coastguard Worker
130*8975f5c5SAndroid Build Coastguard Worker      Table 3.6.B: UNSIGNED_INT formats
131*8975f5c5SAndroid Build Coastguard Worker
132*8975f5c5SAndroid Build Coastguard Worker    Add a row to Table 3.7 "Packed pixel field assignments" (page 65):
133*8975f5c5SAndroid Build Coastguard Worker
134*8975f5c5SAndroid Build Coastguard Worker      Format            |  1st     2nd     3rd     4th
135*8975f5c5SAndroid Build Coastguard Worker      ------------------+-------------------------------
136*8975f5c5SAndroid Build Coastguard Worker      ...               |  ...     ...     ...     ...
137*8975f5c5SAndroid Build Coastguard Worker      DEPTH_STENCIL_OES |  depth   stencil N/A     N/A
138*8975f5c5SAndroid Build Coastguard Worker
139*8975f5c5SAndroid Build Coastguard Worker    Add the following paragraph to the end of the section "Conversion to
140*8975f5c5SAndroid Build Coastguard Worker    floating-point" (page 65):
141*8975f5c5SAndroid Build Coastguard Worker
142*8975f5c5SAndroid Build Coastguard Worker    "For groups of components that contain both standard components and index
143*8975f5c5SAndroid Build Coastguard Worker    elements, such as DEPTH_STENCIL_OES, the index elements are not converted."
144*8975f5c5SAndroid Build Coastguard Worker
145*8975f5c5SAndroid Build Coastguard Worker    In section 3.7.1 "Texture Image Specification", update page 67 to
146*8975f5c5SAndroid Build Coastguard Worker    say:
147*8975f5c5SAndroid Build Coastguard Worker
148*8975f5c5SAndroid Build Coastguard Worker    "The selected groups are processed as described in section 3.6.2, stopping
149*8975f5c5SAndroid Build Coastguard Worker    just before final conversion.  Each R, G, B, A, or depth value so generated
150*8975f5c5SAndroid Build Coastguard Worker    is clamped to [0, 1], while the stencil index values are masked by 2^n-1,
151*8975f5c5SAndroid Build Coastguard Worker    where n is the number of stencil bits in the internal format resolution
152*8975f5c5SAndroid Build Coastguard Worker    (see below).
153*8975f5c5SAndroid Build Coastguard Worker
154*8975f5c5SAndroid Build Coastguard Worker    Components are then selected from the resulting R, G, B, A, depth, or
155*8975f5c5SAndroid Build Coastguard Worker    stencil index values to obtain a texture with the base internal format
156*8975f5c5SAndroid Build Coastguard Worker    specified by <internalformat>.  Table 3.8 summarizes the mapping of R, G,
157*8975f5c5SAndroid Build Coastguard Worker    B, A, depth, or stencil values to texture components, as a function of the
158*8975f5c5SAndroid Build Coastguard Worker    base internal format of the texture image.  <internalformat> may be
159*8975f5c5SAndroid Build Coastguard Worker    specified as one of the internal format symbolic constants listed in
160*8975f5c5SAndroid Build Coastguard Worker    table 3.8. Specifying a value for <internalformat> that is not one of the
161*8975f5c5SAndroid Build Coastguard Worker    above values generates the error INVALID_VALUE. If <internalformat> does
162*8975f5c5SAndroid Build Coastguard Worker    not match <format>, the error INVALID_OPERATION is generated.
163*8975f5c5SAndroid Build Coastguard Worker
164*8975f5c5SAndroid Build Coastguard Worker    Textures with a base internal format of DEPTH_COMPONENT or
165*8975f5c5SAndroid Build Coastguard Worker    DEPTH_STENCIL_OES are supported by texture image specification commands
166*8975f5c5SAndroid Build Coastguard Worker    only if <target> is TEXTURE_2D.  Using these formats in conjunction with
167*8975f5c5SAndroid Build Coastguard Worker    any other <target> will result in an INVALID_OPERATION error.
168*8975f5c5SAndroid Build Coastguard Worker
169*8975f5c5SAndroid Build Coastguard Worker    Textures with a base internal format of DEPTH_COMPONENT or
170*8975f5c5SAndroid Build Coastguard Worker    DEPTH_STENCIL_OES only support one level of image data.  Specifying a
171*8975f5c5SAndroid Build Coastguard Worker    non-zero value for <level> will result in an INVALID_OPERATION error.
172*8975f5c5SAndroid Build Coastguard Worker
173*8975f5c5SAndroid Build Coastguard Worker    Textures with a base internal format of DEPTH_COMPONENT or DEPTH_STENCIL_OES
174*8975f5c5SAndroid Build Coastguard Worker    require either depth component data or depth/stencil component data.
175*8975f5c5SAndroid Build Coastguard Worker    Textures with other base internal formats require RGBA component data.  The
176*8975f5c5SAndroid Build Coastguard Worker    error INVALID_OPERATION is generated if the base internal format is
177*8975f5c5SAndroid Build Coastguard Worker    DEPTH_COMPONENT or DEPTH_STENCIL_OES and <format> is not DEPTH_COMPONENT or
178*8975f5c5SAndroid Build Coastguard Worker    DEPTH_STENCIL_OES, or if the base internal format is not DEPTH_COMPONENT or
179*8975f5c5SAndroid Build Coastguard Worker    DEPTH_STENCIL_OES and <format> is DEPTH_COMPONENT or DEPTH_STENCIL_OES.
180*8975f5c5SAndroid Build Coastguard Worker
181*8975f5c5SAndroid Build Coastguard Worker    Textures with a base internal format of DEPTH_COMPONENT or
182*8975f5c5SAndroid Build Coastguard Worker    DEPTH_STENCIL_OES do not support loading image data via the TexImage
183*8975f5c5SAndroid Build Coastguard Worker    commands. They can only have their contents specified by rendering
184*8975f5c5SAndroid Build Coastguard Worker    to them. The INVALID_OPERATION error is generated by the TexImage2D
185*8975f5c5SAndroid Build Coastguard Worker    command if <data> is not NULL for such textures."
186*8975f5c5SAndroid Build Coastguard Worker
187*8975f5c5SAndroid Build Coastguard Worker    Add a row to table 3.8 (page 68), and update the title of the
188*8975f5c5SAndroid Build Coastguard Worker    second column:
189*8975f5c5SAndroid Build Coastguard Worker
190*8975f5c5SAndroid Build Coastguard Worker      Base Internal Format  RGBA, Depth and Stencil Values  Internal Components
191*8975f5c5SAndroid Build Coastguard Worker      -------------------------------------------------------------------------
192*8975f5c5SAndroid Build Coastguard Worker      ...                   ...                             ...
193*8975f5c5SAndroid Build Coastguard Worker      DEPTH_COMPONENT       Depth                           D
194*8975f5c5SAndroid Build Coastguard Worker      DEPTH_STENCIL_OES     Depth,Stencil                   D,S
195*8975f5c5SAndroid Build Coastguard Worker      ...                   ...                             ...
196*8975f5c5SAndroid Build Coastguard Worker
197*8975f5c5SAndroid Build Coastguard Worker    Update the caption for table 3.8 (page 68)
198*8975f5c5SAndroid Build Coastguard Worker
199*8975f5c5SAndroid Build Coastguard Worker    "Table 3.8: Conversion from RGBA, depth, and stencil pixel components to
200*8975f5c5SAndroid Build Coastguard Worker    internal texture components.  Texture components R, G, B, A, and L are
201*8975f5c5SAndroid Build Coastguard Worker    converted back to RGBA colors during filtering as shown in table 3.12.
202*8975f5c5SAndroid Build Coastguard Worker    Texture components D are converted to RGBA colors as described in
203*8975f5c5SAndroid Build Coastguard Worker    section 3.7.8-1/2."
204*8975f5c5SAndroid Build Coastguard Worker
205*8975f5c5SAndroid Build Coastguard Worker    Add the following to section 3.7.2 "Alternate Texture Image Specification
206*8975f5c5SAndroid Build Coastguard Worker    Commands":
207*8975f5c5SAndroid Build Coastguard Worker
208*8975f5c5SAndroid Build Coastguard Worker    "CopyTexImage2D and CopyTexSubImage2D generate the INVALID_OPERATION
209*8975f5c5SAndroid Build Coastguard Worker    error if the base internal format of the destination texture is
210*8975f5c5SAndroid Build Coastguard Worker    DEPTH_COMPONENT or DEPTH_STENCIL_OES.
211*8975f5c5SAndroid Build Coastguard Worker
212*8975f5c5SAndroid Build Coastguard Worker    TexSubImage2D generates the INVALID_OPERATION error if the base internal
213*8975f5c5SAndroid Build Coastguard Worker    format of the texture is DEPTH_COMPONENT or DEPTH_STENCIL_OES."
214*8975f5c5SAndroid Build Coastguard Worker
215*8975f5c5SAndroid Build Coastguard Worker    Add a new section between sections 3.7.8 and 3.7.9:
216*8975f5c5SAndroid Build Coastguard Worker
217*8975f5c5SAndroid Build Coastguard Worker    "3.7.8-1/2 Depth/Stencil Textures
218*8975f5c5SAndroid Build Coastguard Worker
219*8975f5c5SAndroid Build Coastguard Worker    If the currently bound texture's base internal format is DEPTH_COMPONENT or
220*8975f5c5SAndroid Build Coastguard Worker    DEPTH_STENCIL_OES, then the output of the texture unit is as described
221*8975f5c5SAndroid Build Coastguard Worker    below. Otherwise, the texture unit operates in the normal manner.
222*8975f5c5SAndroid Build Coastguard Worker
223*8975f5c5SAndroid Build Coastguard Worker    Let <D_t> be the depth texture value, provided by the shader's texture lookup
224*8975f5c5SAndroid Build Coastguard Worker    function. Then the effective texture value is computed as follows:
225*8975f5c5SAndroid Build Coastguard Worker            <Tau> = <D_t>
226*8975f5c5SAndroid Build Coastguard Worker
227*8975f5c5SAndroid Build Coastguard Worker    If the texture image has a base internal format of DEPTH_STENCIL_OES, then
228*8975f5c5SAndroid Build Coastguard Worker    the stencil index texture component is ignored.  The texture value <Tau> does
229*8975f5c5SAndroid Build Coastguard Worker    not include a stencil index component, but includes only the depth
230*8975f5c5SAndroid Build Coastguard Worker    component.
231*8975f5c5SAndroid Build Coastguard Worker
232*8975f5c5SAndroid Build Coastguard Worker    The resulting <Tau> is assigned to <R_t>. In some implementations, <Tau> is
233*8975f5c5SAndroid Build Coastguard Worker    also assigned to <G_t>, <B_t>, or <A_t>. Thus in table 3.12, textures with
234*8975f5c5SAndroid Build Coastguard Worker    depth component data behave as if their base internal format is RGBA, with
235*8975f5c5SAndroid Build Coastguard Worker    values in <G_t>, <B_t>, and <A_t> being implementation dependent."
236*8975f5c5SAndroid Build Coastguard Worker
237*8975f5c5SAndroid Build Coastguard Worker    Add the following to section 3.7.11 "Mipmap Generation":
238*8975f5c5SAndroid Build Coastguard Worker
239*8975f5c5SAndroid Build Coastguard Worker    "If the level zero array contains depth or depth-stencil data, the
240*8975f5c5SAndroid Build Coastguard Worker     error INVALID_OPERATION is generated."
241*8975f5c5SAndroid Build Coastguard Worker
242*8975f5c5SAndroid Build Coastguard Worker    Insert a new paragraph after the first paragraph of the "Texture Access"
243*8975f5c5SAndroid Build Coastguard Worker    subsection of section 3.8.2 on page 87, which says:
244*8975f5c5SAndroid Build Coastguard Worker
245*8975f5c5SAndroid Build Coastguard Worker    "Texture lookups involving textures with depth component data generate
246*8975f5c5SAndroid Build Coastguard Worker    a texture source color by using depth data directly, as described in
247*8975f5c5SAndroid Build Coastguard Worker    section 3.7.8-1/2.  The stencil texture internal component is ignored
248*8975f5c5SAndroid Build Coastguard Worker    if the base internal format is DEPTH_STENCIL_OES."
249*8975f5c5SAndroid Build Coastguard Worker
250*8975f5c5SAndroid Build Coastguard WorkerAdditions to Chapter 4 of the OpenGL ES 2.0 specification (Per-Fragment
251*8975f5c5SAndroid Build Coastguard WorkerOperations and the Framebuffer)
252*8975f5c5SAndroid Build Coastguard Worker
253*8975f5c5SAndroid Build Coastguard Worker    In section 4.4.5 "Framebuffer Completeness", replace the the 3rd
254*8975f5c5SAndroid Build Coastguard Worker    paragraph with the following text:
255*8975f5c5SAndroid Build Coastguard Worker
256*8975f5c5SAndroid Build Coastguard Worker     "* An internal format is color-renderable if it is one of the formats
257*8975f5c5SAndroid Build Coastguard Worker        from table 4.5 noted as color-renderable or if it is unsized format
258*8975f5c5SAndroid Build Coastguard Worker        RGBA or RGB. No other formats, including compressed internal formats,
259*8975f5c5SAndroid Build Coastguard Worker        are color-renderable.
260*8975f5c5SAndroid Build Coastguard Worker
261*8975f5c5SAndroid Build Coastguard Worker      * An internal format is depth-renderable if it is one of the sized
262*8975f5c5SAndroid Build Coastguard Worker        internal formats from table 4.5 noted as depth-renderable, if it
263*8975f5c5SAndroid Build Coastguard Worker        is the unsized format DEPTH_COMPONENT or if it is the internal
264*8975f5c5SAndroid Build Coastguard Worker        format value of DEPTH24_STENCIL8_OES. No other formats are
265*8975f5c5SAndroid Build Coastguard Worker        depth-renderable.
266*8975f5c5SAndroid Build Coastguard Worker
267*8975f5c5SAndroid Build Coastguard Worker      * An internal format is stencil-renderable if it is one of the sized
268*8975f5c5SAndroid Build Coastguard Worker        internal formats from table 4.5 noted as stencil-renderable or if it
269*8975f5c5SAndroid Build Coastguard Worker        is DEPTH24_STENCIL8_OES. No other formats are stencil-renderable."
270*8975f5c5SAndroid Build Coastguard Worker
271*8975f5c5SAndroid Build Coastguard WorkerAdditions to Chapter 5 of the OpenGL ES 2.0 Specification (Special
272*8975f5c5SAndroid Build Coastguard WorkerFunctions)
273*8975f5c5SAndroid Build Coastguard Worker
274*8975f5c5SAndroid Build Coastguard Worker    None.
275*8975f5c5SAndroid Build Coastguard Worker
276*8975f5c5SAndroid Build Coastguard WorkerAdditions to Chapter 6 of the OpenGL ES 2.0 Specification (State and State
277*8975f5c5SAndroid Build Coastguard WorkerRequests)
278*8975f5c5SAndroid Build Coastguard Worker
279*8975f5c5SAndroid Build Coastguard Worker    None.
280*8975f5c5SAndroid Build Coastguard Worker
281*8975f5c5SAndroid Build Coastguard WorkerInteractions with OES_packed_depth_stencil
282*8975f5c5SAndroid Build Coastguard Worker
283*8975f5c5SAndroid Build Coastguard Worker    If OES_packed_depth_stencil is not supported, mentions of
284*8975f5c5SAndroid Build Coastguard Worker    DEPTH_STENCIL_OES and UNSIGNED_INT_24_8_OES as a format/type combinations
285*8975f5c5SAndroid Build Coastguard Worker    for TexImage2D and TexSubImage2D are omitted. Mentions of
286*8975f5c5SAndroid Build Coastguard Worker    the internal format DEPTH24_STENCIL8_OES are also omitted.
287*8975f5c5SAndroid Build Coastguard Worker
288*8975f5c5SAndroid Build Coastguard WorkerInteractions with EXT_texture_storage
289*8975f5c5SAndroid Build Coastguard Worker
290*8975f5c5SAndroid Build Coastguard Worker    If EXT_texture_storage is supported the following internalformat
291*8975f5c5SAndroid Build Coastguard Worker    to format/type mappings are used:
292*8975f5c5SAndroid Build Coastguard Worker
293*8975f5c5SAndroid Build Coastguard Worker        <internalformat>       <format>           <type>
294*8975f5c5SAndroid Build Coastguard Worker        ----------------       --------           ------
295*8975f5c5SAndroid Build Coastguard Worker        DEPTH_COMPONENT16      DEPTH_COMPONENT    UNSIGNED_SHORT
296*8975f5c5SAndroid Build Coastguard Worker        DEPTH_COMPONENT32_OES  DEPTH_COMPONENT    UNSIGNED_INT
297*8975f5c5SAndroid Build Coastguard Worker        DEPTH24_STENCIL8_OES   DEPTH_STENCIL_OES  UNSIGNED_INT
298*8975f5c5SAndroid Build Coastguard Worker
299*8975f5c5SAndroid Build Coastguard Worker    Textures with the above <internalformats> only support one level of
300*8975f5c5SAndroid Build Coastguard Worker    image data. Specifying a value other than one for the <levels> parameter
301*8975f5c5SAndroid Build Coastguard Worker    to TexStorage2DEXT will result in an INVALID_OPERATION error.
302*8975f5c5SAndroid Build Coastguard Worker
303*8975f5c5SAndroid Build Coastguard Worker    If EXT_texture_storage is not supported, ignore any references
304*8975f5c5SAndroid Build Coastguard Worker    to TexStorage2DEXT.
305*8975f5c5SAndroid Build Coastguard Worker
306*8975f5c5SAndroid Build Coastguard WorkerErrors
307*8975f5c5SAndroid Build Coastguard Worker
308*8975f5c5SAndroid Build Coastguard Worker    The error INVALID_OPERATION is generated by TexImage2D if <format> and
309*8975f5c5SAndroid Build Coastguard Worker    <internalformat> are DEPTH_COMPONENT and <type> is not UNSIGNED_SHORT,
310*8975f5c5SAndroid Build Coastguard Worker    or UNSIGNED_INT.
311*8975f5c5SAndroid Build Coastguard Worker
312*8975f5c5SAndroid Build Coastguard Worker    The error INVALID_OPERATION is generated by TexSubImage2D if <format> is
313*8975f5c5SAndroid Build Coastguard Worker    DEPTH_COMPONENT and <type> is not UNSIGNED_SHORT, or UNSIGNED_INT.
314*8975f5c5SAndroid Build Coastguard Worker
315*8975f5c5SAndroid Build Coastguard Worker    The error INVALID_OPERATION is generated by TexImage2D if <format> and
316*8975f5c5SAndroid Build Coastguard Worker    <internalformat> are not DEPTH_COMPONENT and <type> is UNSIGNED_SHORT,
317*8975f5c5SAndroid Build Coastguard Worker    or UNSIGNED_INT.
318*8975f5c5SAndroid Build Coastguard Worker
319*8975f5c5SAndroid Build Coastguard Worker    The error INVALID_OPERATION is generated by TexSubImage2D if <format> is
320*8975f5c5SAndroid Build Coastguard Worker    not DEPTH_COMPONENT and <type> is UNSIGNED_SHORT, or UNSIGNED_INT.
321*8975f5c5SAndroid Build Coastguard Worker
322*8975f5c5SAndroid Build Coastguard Worker    The error INVALID_OPERATION is generated by TexImage2D if <format> and
323*8975f5c5SAndroid Build Coastguard Worker    <internalformat> are DEPTH_STENCIL_OES and <type> is not
324*8975f5c5SAndroid Build Coastguard Worker    UNSIGNED_INT_24_8_OES.
325*8975f5c5SAndroid Build Coastguard Worker
326*8975f5c5SAndroid Build Coastguard Worker    The error INVALID_OPERATION is generated by TexSubImage2D if <format>
327*8975f5c5SAndroid Build Coastguard Worker    is DEPTH_STENCIL_OES and <type> is not UNSIGNED_INT_24_8_OES.
328*8975f5c5SAndroid Build Coastguard Worker
329*8975f5c5SAndroid Build Coastguard Worker    The error INVALID_OPERATION is generated by TexImage2D if <format> and
330*8975f5c5SAndroid Build Coastguard Worker    <internalformat> is not DEPTH_STENCIL_OES and <type> is
331*8975f5c5SAndroid Build Coastguard Worker    UNSIGNED_INT_24_8_OES.
332*8975f5c5SAndroid Build Coastguard Worker
333*8975f5c5SAndroid Build Coastguard Worker    The error INVALID_OPERATION is generated by TexSubImage2D if <format>
334*8975f5c5SAndroid Build Coastguard Worker    is not DEPTH_STENCIL_OES and <type> is UNSIGNED_INT_24_8_OES.
335*8975f5c5SAndroid Build Coastguard Worker
336*8975f5c5SAndroid Build Coastguard Worker    The error INVALID_OPERATION is generated in the following situations:
337*8975f5c5SAndroid Build Coastguard Worker    - TexImage2D is called with <format> and <internalformat> of
338*8975f5c5SAndroid Build Coastguard Worker      DEPTH_COMPONENT or DEPTH_STENCIL_OES and
339*8975f5c5SAndroid Build Coastguard Worker       - <target> is not TEXTURE_2D,
340*8975f5c5SAndroid Build Coastguard Worker       - <data> is not NULL, or
341*8975f5c5SAndroid Build Coastguard Worker       - <level> is not zero.
342*8975f5c5SAndroid Build Coastguard Worker    - TexSubImage2D is called with <format> of DEPTH_COMPONENT or
343*8975f5c5SAndroid Build Coastguard Worker      DEPTH_STENCIL_OES.
344*8975f5c5SAndroid Build Coastguard Worker    - TexStorage2DEXT is called with <internalformat> of DEPTH_COMPONENT16,
345*8975f5c5SAndroid Build Coastguard Worker      DEPTH_COMPONENT32_OES, or DEPTH24_STENCIL8_OES, and
346*8975f5c5SAndroid Build Coastguard Worker       - <target> is not TEXTURE_2D, or
347*8975f5c5SAndroid Build Coastguard Worker       - <levels> is not one.
348*8975f5c5SAndroid Build Coastguard Worker    - CopyTexImage2D is called with an <internalformat> that has a base
349*8975f5c5SAndroid Build Coastguard Worker      internal format of DEPTH_COMPONENT or DEPTH_STENCIL_OES.
350*8975f5c5SAndroid Build Coastguard Worker    - CopyTexSubImage2D is called with a target texture that has a base
351*8975f5c5SAndroid Build Coastguard Worker      internal format of DEPTH_COMPONENT or DEPTH_STENCIL_OES.
352*8975f5c5SAndroid Build Coastguard Worker    - GenerateMipmap is called on a texture that has a base internal format
353*8975f5c5SAndroid Build Coastguard Worker      of DEPTH_COMPONENT or DEPTH_STENCIL_OES.
354*8975f5c5SAndroid Build Coastguard Worker
355*8975f5c5SAndroid Build Coastguard WorkerNew State
356*8975f5c5SAndroid Build Coastguard Worker
357*8975f5c5SAndroid Build Coastguard Worker    None.
358*8975f5c5SAndroid Build Coastguard Worker
359*8975f5c5SAndroid Build Coastguard WorkerIssues
360*8975f5c5SAndroid Build Coastguard Worker
361*8975f5c5SAndroid Build Coastguard Worker    1) What are the differences between this extension and OES_depth_texture
362*8975f5c5SAndroid Build Coastguard Worker       and OES_packed_depth_stencil?
363*8975f5c5SAndroid Build Coastguard Worker
364*8975f5c5SAndroid Build Coastguard Worker       RESOLVED: This extension:
365*8975f5c5SAndroid Build Coastguard Worker         - does not support loading pre-baked depth stencil data via
366*8975f5c5SAndroid Build Coastguard Worker           TexImage2D or TexSubImage2D.
367*8975f5c5SAndroid Build Coastguard Worker         - allows variability in the y-, z-, and w-components of the sample
368*8975f5c5SAndroid Build Coastguard Worker           results from depth textures.
369*8975f5c5SAndroid Build Coastguard Worker         - only supports one level textures.
370*8975f5c5SAndroid Build Coastguard Worker         - explicitly lists the errors for unsupported functionality.
371*8975f5c5SAndroid Build Coastguard Worker           Since these were not clearly specified in the OES_depth_texture
372*8975f5c5SAndroid Build Coastguard Worker           extension there may be differences in error values between
373*8975f5c5SAndroid Build Coastguard Worker           implementations of OES_depth_texture and ANGLE_depth_texture.
374*8975f5c5SAndroid Build Coastguard Worker       This specification was also rebased to apply against the OpenGL ES 2.0
375*8975f5c5SAndroid Build Coastguard Worker       specification instead of the OpenGL specification, making it more
376*8975f5c5SAndroid Build Coastguard Worker       obvious what all the functionality changes are.
377*8975f5c5SAndroid Build Coastguard Worker
378*8975f5c5SAndroid Build Coastguard Worker    2) Why does TexSubImage2D accept the new format/type combinations even
379*8975f5c5SAndroid Build Coastguard Worker       though it does not actually support loading data?
380*8975f5c5SAndroid Build Coastguard Worker
381*8975f5c5SAndroid Build Coastguard Worker       RESOLVED: This was done to be more consistent with the OES_depth_texture
382*8975f5c5SAndroid Build Coastguard Worker       extension and to make it easier to add support for loading texture
383*8975f5c5SAndroid Build Coastguard Worker       data if it is possible to support in the future.
384*8975f5c5SAndroid Build Coastguard Worker
385*8975f5c5SAndroid Build Coastguard Worker    3) Why are only 1-level depth textures supported?
386*8975f5c5SAndroid Build Coastguard Worker
387*8975f5c5SAndroid Build Coastguard Worker       RESOLVED: The only use for multiple levels of depth textures would
388*8975f5c5SAndroid Build Coastguard Worker       be for fitlered texturing. However since it is not possible to
389*8975f5c5SAndroid Build Coastguard Worker       render to non-zero-level texture levels in OpenGL ES 2.0, and since
390*8975f5c5SAndroid Build Coastguard Worker       this extension forbids loading existing data and GenerateMipmap on
391*8975f5c5SAndroid Build Coastguard Worker       depth textures, it is impossible to initialize or specify contents
392*8975f5c5SAndroid Build Coastguard Worker       for non-zero levels of depth textures.
393*8975f5c5SAndroid Build Coastguard Worker
394*8975f5c5SAndroid Build Coastguard WorkerRevision History
395*8975f5c5SAndroid Build Coastguard Worker
396*8975f5c5SAndroid Build Coastguard Worker    02/25/2013  swoods  revise to allow texture lookup to guarantee depth values
397*8975f5c5SAndroid Build Coastguard Worker                        only in red channel of sample result.
398*8975f5c5SAndroid Build Coastguard Worker    06/04/2012  dgkoch  fix errors, disallow multi-level depth textures.
399*8975f5c5SAndroid Build Coastguard Worker    05/30/2012  dgkoch  minor updates and add issues.
400*8975f5c5SAndroid Build Coastguard Worker    05/23/2012  dgkoch  intial revision based on OES_depth_texture and
401*8975f5c5SAndroid Build Coastguard Worker                        OES_packed_depth_stencil and rebased against the ES 2.0 spec
402*8975f5c5SAndroid Build Coastguard Worker
403