xref: /aosp_15_r20/external/angle/extensions/ANGLE_stencil_texturing.txt (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1*8975f5c5SAndroid Build Coastguard WorkerName
2*8975f5c5SAndroid Build Coastguard Worker
3*8975f5c5SAndroid Build Coastguard Worker    ANGLE_stencil_texturing
4*8975f5c5SAndroid Build Coastguard Worker
5*8975f5c5SAndroid Build Coastguard WorkerName Strings
6*8975f5c5SAndroid Build Coastguard Worker
7*8975f5c5SAndroid Build Coastguard Worker    GL_ANGLE_stencil_texturing
8*8975f5c5SAndroid Build Coastguard Worker
9*8975f5c5SAndroid Build Coastguard WorkerContributors
10*8975f5c5SAndroid Build Coastguard Worker
11*8975f5c5SAndroid Build Coastguard Worker    Contributors to ARB_stencil_texturing
12*8975f5c5SAndroid Build Coastguard Worker    Members of the WebGL working group
13*8975f5c5SAndroid Build Coastguard Worker
14*8975f5c5SAndroid Build Coastguard WorkerStatus
15*8975f5c5SAndroid Build Coastguard Worker
16*8975f5c5SAndroid Build Coastguard Worker    Draft
17*8975f5c5SAndroid Build Coastguard Worker
18*8975f5c5SAndroid Build Coastguard WorkerVersion
19*8975f5c5SAndroid Build Coastguard Worker
20*8975f5c5SAndroid Build Coastguard Worker    Last Modified Date: March 1, 2023
21*8975f5c5SAndroid Build Coastguard Worker    Revision: 1
22*8975f5c5SAndroid Build Coastguard Worker
23*8975f5c5SAndroid Build Coastguard WorkerNumber
24*8975f5c5SAndroid Build Coastguard Worker
25*8975f5c5SAndroid Build Coastguard Worker    OpenGL ES Extension XX
26*8975f5c5SAndroid Build Coastguard Worker
27*8975f5c5SAndroid Build Coastguard WorkerDependencies
28*8975f5c5SAndroid Build Coastguard Worker
29*8975f5c5SAndroid Build Coastguard Worker    This extension is written against the OpenGL ES 3.0 Specification.
30*8975f5c5SAndroid Build Coastguard Worker
31*8975f5c5SAndroid Build Coastguard Worker    OpenGL ES 3.0 and OpenGL ES Shading Language 3.00 are required.
32*8975f5c5SAndroid Build Coastguard Worker
33*8975f5c5SAndroid Build Coastguard WorkerOverview
34*8975f5c5SAndroid Build Coastguard Worker
35*8975f5c5SAndroid Build Coastguard Worker    This extension allows texturing of the stencil component of a packed depth
36*8975f5c5SAndroid Build Coastguard Worker    stencil texture. Stencil values are returned as unsigned integers. It is
37*8975f5c5SAndroid Build Coastguard Worker    not possible to sample both depth and stencil values from the same
38*8975f5c5SAndroid Build Coastguard Worker    texture, and this extension allows the app to select which is sampled for
39*8975f5c5SAndroid Build Coastguard Worker    the bound texture.
40*8975f5c5SAndroid Build Coastguard Worker
41*8975f5c5SAndroid Build Coastguard Worker    This extension provides similar functionality to that of OpenGL ES 3.1.
42*8975f5c5SAndroid Build Coastguard Worker
43*8975f5c5SAndroid Build Coastguard WorkerNew Procedures and Functions
44*8975f5c5SAndroid Build Coastguard Worker
45*8975f5c5SAndroid Build Coastguard Worker    None
46*8975f5c5SAndroid Build Coastguard Worker
47*8975f5c5SAndroid Build Coastguard WorkerNew Tokens
48*8975f5c5SAndroid Build Coastguard Worker
49*8975f5c5SAndroid Build Coastguard Worker    Accepted by the <pname> parameter of TexParameter* and GetTexParameter*:
50*8975f5c5SAndroid Build Coastguard Worker
51*8975f5c5SAndroid Build Coastguard Worker        DEPTH_STENCIL_TEXTURE_MODE_ANGLE                 0x90EA
52*8975f5c5SAndroid Build Coastguard Worker        STENCIL_INDEX_ANGLE                              0x1901
53*8975f5c5SAndroid Build Coastguard Worker
54*8975f5c5SAndroid Build Coastguard WorkerAdditions to the OpenGL ES 3.0 Specification
55*8975f5c5SAndroid Build Coastguard Worker
56*8975f5c5SAndroid Build Coastguard WorkerChanges to Section 3.9.2.1 (Texture Access), page 167
57*8975f5c5SAndroid Build Coastguard Worker
58*8975f5c5SAndroid Build Coastguard WorkerAdd a new new bullet point on page 168:
59*8975f5c5SAndroid Build Coastguard Worker
60*8975f5c5SAndroid Build Coastguard Worker    "* The sampler used in a texture lookup function is one of the shadow
61*8975f5c5SAndroid Build Coastguard Worker    sampler types, the texture object's internal format is DEPTH_STENCIL,
62*8975f5c5SAndroid Build Coastguard Worker    and the DEPTH_STENCIL_TEXTURE_MODE_ANGLE is not DEPTH_COMPONENT."
63*8975f5c5SAndroid Build Coastguard Worker
64*8975f5c5SAndroid Build Coastguard WorkerThen change the following paragraph that reads:
65*8975f5c5SAndroid Build Coastguard Worker
66*8975f5c5SAndroid Build Coastguard Worker    "The stencil texture internal component is ignored if the base internal
67*8975f5c5SAndroid Build Coastguard Worker    format is DEPTH_STENCIL."
68*8975f5c5SAndroid Build Coastguard Worker
69*8975f5c5SAndroid Build Coastguard WorkerTo the following:
70*8975f5c5SAndroid Build Coastguard Worker
71*8975f5c5SAndroid Build Coastguard Worker    "The stencil index texture internal component is ignored if the base
72*8975f5c5SAndroid Build Coastguard Worker    internal format is DEPTH_STENCIL and the value of
73*8975f5c5SAndroid Build Coastguard Worker    DEPTH_STENCIL_TEXTURE_MODE_ANGLE is not STENCIL_INDEX_ANGLE.
74*8975f5c5SAndroid Build Coastguard Worker
75*8975f5c5SAndroid Build Coastguard Worker    Texture lookups involving texture objects with an internal format
76*8975f5c5SAndroid Build Coastguard Worker    of DEPTH_STENCIL can read the stencil value as described in section
77*8975f5c5SAndroid Build Coastguard Worker    3.8 by setting the DEPTH_STENCIL_TEXTURE_MODE_ANGLE to STENCIL_INDEX_ANGLE.
78*8975f5c5SAndroid Build Coastguard Worker    The stencil value is read as an integer and assigned to R_t. An unsigned
79*8975f5c5SAndroid Build Coastguard Worker    integer sampler should be used to lookup the stencil component, otherwise
80*8975f5c5SAndroid Build Coastguard Worker    the results are undefined."
81*8975f5c5SAndroid Build Coastguard Worker
82*8975f5c5SAndroid Build Coastguard WorkerChanges to Section 3.8.7 (Texture Parameters), page 150
83*8975f5c5SAndroid Build Coastguard Worker
84*8975f5c5SAndroid Build Coastguard WorkerIn Table 3.20 (Texture parameters and their values) add the following
85*8975f5c5SAndroid Build Coastguard Workerentry:
86*8975f5c5SAndroid Build Coastguard Worker
87*8975f5c5SAndroid Build Coastguard Worker    "
88*8975f5c5SAndroid Build Coastguard Worker    Name                              Type  Legal Values
89*8975f5c5SAndroid Build Coastguard Worker    -------------                     ----  ------------------------------------
90*8975f5c5SAndroid Build Coastguard Worker    DEPTH_STENCIL_TEXTURE_MODE_ANGLE  enum  DEPTH_COMPONENT, STENCIL_INDEX_ANGLE
91*8975f5c5SAndroid Build Coastguard Worker    "
92*8975f5c5SAndroid Build Coastguard Worker
93*8975f5c5SAndroid Build Coastguard WorkerChanges to Section 3.8.12 (Combined Depth/Stencil Textures), page 160
94*8975f5c5SAndroid Build Coastguard Worker
95*8975f5c5SAndroid Build Coastguard WorkerModify the paragraph to read:
96*8975f5c5SAndroid Build Coastguard Worker
97*8975f5c5SAndroid Build Coastguard Worker    "If the texture image has a base internal format of DEPTH_STENCIL, then
98*8975f5c5SAndroid Build Coastguard Worker    the stencil index texture component is ignored by default. The texture
99*8975f5c5SAndroid Build Coastguard Worker    value <T> does not include a stencil index component, but includes
100*8975f5c5SAndroid Build Coastguard Worker    only the depth component.
101*8975f5c5SAndroid Build Coastguard Worker
102*8975f5c5SAndroid Build Coastguard Worker    In order to access the stencil index texture component, the
103*8975f5c5SAndroid Build Coastguard Worker    DEPTH_STENCIL_TEXTURE_MODE_ANGLE texture parameter should be set to
104*8975f5c5SAndroid Build Coastguard Worker    STENCIL_INDEX_ANGLE. When this mode is set the depth component is ignored
105*8975f5c5SAndroid Build Coastguard Worker    and the texture value includes only the stencil index component.
106*8975f5c5SAndroid Build Coastguard Worker    The stencil index value is treated as an unsigned integer texture and
107*8975f5c5SAndroid Build Coastguard Worker    returns an unsigned integer value when sampled. When sampling the stencil
108*8975f5c5SAndroid Build Coastguard Worker    index only NEAREST filtering is supported.
109*8975f5c5SAndroid Build Coastguard Worker    The DEPTH_STENCIL_TEXTURE_MODE_ANGLE is ignored for non depth/stencil
110*8975f5c5SAndroid Build Coastguard Worker    textures."
111*8975f5c5SAndroid Build Coastguard Worker
112*8975f5c5SAndroid Build Coastguard WorkerChanges to Section 3.8.13 (Texture Completeness), page 161
113*8975f5c5SAndroid Build Coastguard Worker
114*8975f5c5SAndroid Build Coastguard WorkerAdd a new bullet point for the conditions that cause the texture
115*8975f5c5SAndroid Build Coastguard Workerto not be complete:
116*8975f5c5SAndroid Build Coastguard Worker
117*8975f5c5SAndroid Build Coastguard Worker    "* The internal format of the texture is DEPTH_STENCIL, the value of
118*8975f5c5SAndroid Build Coastguard Worker    DEPTH_STENCIL_TEXTURE_MODE_ANGLE for the texture is STENCIL_INDEX_ANGLE,
119*8975f5c5SAndroid Build Coastguard Worker    and either the magnification filter is not NEAREST or the minification
120*8975f5c5SAndroid Build Coastguard Worker    filter is neither NEAREST nor NEAREST_MIPMAP_NEAREST."
121*8975f5c5SAndroid Build Coastguard Worker
122*8975f5c5SAndroid Build Coastguard WorkerChanges to Section 3.8.15 (Texture Comparison Modes), page 163
123*8975f5c5SAndroid Build Coastguard Worker
124*8975f5c5SAndroid Build Coastguard WorkerModify the following paragraph:
125*8975f5c5SAndroid Build Coastguard Worker
126*8975f5c5SAndroid Build Coastguard Worker    "Let Dt be the depth texture value and St be the stencil index component
127*8975f5c5SAndroid Build Coastguard Worker    of a depth/stencil texture. If there is no stencil component the value of
128*8975f5c5SAndroid Build Coastguard Worker    St is undefined. Let Dref be the reference value..."
129*8975f5c5SAndroid Build Coastguard Worker
130*8975f5c5SAndroid Build Coastguard WorkerInsert a new paragraph after the paragraphs that ends:
131*8975f5c5SAndroid Build Coastguard Worker
132*8975f5c5SAndroid Build Coastguard Worker    "Then the effective texture value is computed as follows:
133*8975f5c5SAndroid Build Coastguard Worker        If the base internal format is DEPTH_STENCIL and the value of
134*8975f5c5SAndroid Build Coastguard Worker    DEPTH_STENCIL_TEXTURE_MODE_ANGLE is STENCIL_INDEX_ANGLE, then
135*8975f5c5SAndroid Build Coastguard Worker            r = St
136*8975f5c5SAndroid Build Coastguard Worker        Otherwise, if the value of TEXTURE_COMPARE_MODE is NONE, then
137*8975f5c5SAndroid Build Coastguard Worker            r = Dt
138*8975f5c5SAndroid Build Coastguard Worker        Otherwise, if the value of TEXTURE_COMPARE_MODE is
139*8975f5c5SAndroid Build Coastguard Worker    COMPARE_REF_TO_TEXTURE, then r depends on the texture comparison
140*8975f5c5SAndroid Build Coastguard Worker    function as shown in table 3.23.
141*8975f5c5SAndroid Build Coastguard Worker        The resulting r is assigned ..."
142*8975f5c5SAndroid Build Coastguard Worker
143*8975f5c5SAndroid Build Coastguard WorkerNew State
144*8975f5c5SAndroid Build Coastguard Worker
145*8975f5c5SAndroid Build Coastguard Worker    (Table 6.9, Textures) add the following entry:
146*8975f5c5SAndroid Build Coastguard Worker
147*8975f5c5SAndroid Build Coastguard Worker    Get Value                        Type  Get Command        Initial Value    Description                 Section
148*8975f5c5SAndroid Build Coastguard Worker    -------------------------------- ----  -----------------  ---------------  --------------------------  -------
149*8975f5c5SAndroid Build Coastguard Worker    DEPTH_STENCIL_TEXTURE_MODE_ANGLE  Z2   GetTexParameteriv  DEPTH_COMPONENT  Depth stencil texture mode  3.8.7
150*8975f5c5SAndroid Build Coastguard Worker
151*8975f5c5SAndroid Build Coastguard WorkerRevision History
152*8975f5c5SAndroid Build Coastguard Worker
153*8975f5c5SAndroid Build Coastguard Worker    3/1/2023   First revision
154