15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    ARB_texture_stencil8
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_ARB_texture_stencil8
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Jeff Bolz, NVIDIA Corporation (jbolz 'at' nvidia.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciContributors
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    Piers Daniell, NVIDIA
165bd8deadSopenharmony_ci    Daniel Koch, NVIDIA
175bd8deadSopenharmony_ci    Jon Leech
185bd8deadSopenharmony_ci
195bd8deadSopenharmony_ciNotice
205bd8deadSopenharmony_ci
215bd8deadSopenharmony_ci    Copyright (c) 2013 The Khronos Group Inc. Copyright terms at
225bd8deadSopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
235bd8deadSopenharmony_ci
245bd8deadSopenharmony_ciSpecification Update Policy
255bd8deadSopenharmony_ci
265bd8deadSopenharmony_ci    Khronos-approved extension specifications are updated in response to
275bd8deadSopenharmony_ci    issues and bugs prioritized by the Khronos OpenGL Working Group. For
285bd8deadSopenharmony_ci    extensions which have been promoted to a core Specification, fixes will
295bd8deadSopenharmony_ci    first appear in the latest version of that core Specification, and will
305bd8deadSopenharmony_ci    eventually be backported to the extension document. This policy is
315bd8deadSopenharmony_ci    described in more detail at
325bd8deadSopenharmony_ci        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
335bd8deadSopenharmony_ci
345bd8deadSopenharmony_ciStatus
355bd8deadSopenharmony_ci
365bd8deadSopenharmony_ci    Complete. Approved by the ARB on June 3, 2013.
375bd8deadSopenharmony_ci    Ratified by the Khronos Board of Promoters on July 19, 2013.
385bd8deadSopenharmony_ci
395bd8deadSopenharmony_ciVersion
405bd8deadSopenharmony_ci
415bd8deadSopenharmony_ci    Last Modified Date:         August 26, 2013
425bd8deadSopenharmony_ci    Revision:                   5
435bd8deadSopenharmony_ci
445bd8deadSopenharmony_ciNumber
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ci    ARB Extension #150
475bd8deadSopenharmony_ci
485bd8deadSopenharmony_ciDependencies
495bd8deadSopenharmony_ci
505bd8deadSopenharmony_ci    This extension is written against the OpenGL 4.3 specification
515bd8deadSopenharmony_ci    (Compatibility Profile).
525bd8deadSopenharmony_ci
535bd8deadSopenharmony_ciOverview
545bd8deadSopenharmony_ci
555bd8deadSopenharmony_ci    This extension accepts STENCIL_INDEX8 as a texture internal format, and
565bd8deadSopenharmony_ci    adds STENCIL_INDEX8 to the required internal format list. This removes the
575bd8deadSopenharmony_ci    need to use renderbuffers if a stencil-only format is desired.
585bd8deadSopenharmony_ci
595bd8deadSopenharmony_ciNew Procedures and Functions
605bd8deadSopenharmony_ci
615bd8deadSopenharmony_ci    None.
625bd8deadSopenharmony_ci
635bd8deadSopenharmony_ciNew Tokens
645bd8deadSopenharmony_ci
655bd8deadSopenharmony_ci    Accepted by the <format> parameter of TexImage3D, TexImage2D, TexImage1D,
665bd8deadSopenharmony_ci    TexSubImage3D, TexSubImage2D, TexSubImage1D, or GetTexImage:
675bd8deadSopenharmony_ci
685bd8deadSopenharmony_ci        STENCIL_INDEX           0x1901  /* existing enum */
695bd8deadSopenharmony_ci
705bd8deadSopenharmony_ci    Accepted by the <internalformat> parameter of TexImage3D, TexImage2D,
715bd8deadSopenharmony_ci    TexImage1D, CopyTexImage2D, CopyTexImage1D, TexStorage3D, TexStorage2D,
725bd8deadSopenharmony_ci    TexStorage1D, TexImage3DMultisample, TexImage2DMultisample,
735bd8deadSopenharmony_ci    TexStorage3DMultisample, TexStorage2DMultisample:
745bd8deadSopenharmony_ci
755bd8deadSopenharmony_ci        STENCIL_INDEX8          0x8D48  /* existing enum */
765bd8deadSopenharmony_ci
775bd8deadSopenharmony_ciAdditions to Chapter 8 of the OpenGL 4.3 (Compatibility Profile) Specification
785bd8deadSopenharmony_ci(Textures and Samplers)
795bd8deadSopenharmony_ci
805bd8deadSopenharmony_ci    Modify Section 8.5 Texture Image Specification, p. 205
815bd8deadSopenharmony_ci
825bd8deadSopenharmony_ci    In the first paragraph, replace "The <format> STENCIL_INDEX is not allowed"
835bd8deadSopenharmony_ci    with "An INVALID_OPERATION error is generated if the <format> is
845bd8deadSopenharmony_ci    STENCIL_INDEX and the base internal format is not STENCIL_INDEX."
855bd8deadSopenharmony_ci
865bd8deadSopenharmony_ci
875bd8deadSopenharmony_ci    Modify the last paragraph of p. 207 to include STENCIL_INDEX:
885bd8deadSopenharmony_ci
895bd8deadSopenharmony_ci    "Textures with a base internal format of DEPTH_COMPONENT, DEPTH_STENCIL,
905bd8deadSopenharmony_ci    or STENCIL_INDEX are supported by texture image specification commands
915bd8deadSopenharmony_ci    only if <target> is TEXTURE_1D, TEXTURE_2D, TEXTURE_1D_ARRAY,
925bd8deadSopenharmony_ci    TEXTURE_2D_ARRAY, TEXTURE_RECTANGLE, TEXTURE_CUBE_MAP,
935bd8deadSopenharmony_ci    TEXTURE_CUBE_MAP_ARRAY, TEXTURE_2D_MULTISAMPLE,
945bd8deadSopenharmony_ci    TEXTURE_2D_MULTISAMPLE_ARRAY, PROXY_TEXTURE_1D, PROXY_TEXTURE_2D,
955bd8deadSopenharmony_ci    PROXY_TEXTURE_1D_ARRAY, PROXY_TEXTURE_2D_ARRAY, PROXY_TEXTURE_RECTANGLE,
965bd8deadSopenharmony_ci    PROXY_TEXTURE_CUBE_MAP, PROXY_TEXTURE_CUBE_MAP_ARRAY,
975bd8deadSopenharmony_ci    PROXY_TEXTURE_2D_MULTISAMPLE or PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY."
985bd8deadSopenharmony_ci
995bd8deadSopenharmony_ci    Add a row to Table 8.18: Conversion from RGBA, depth, and stencil pixel
1005bd8deadSopenharmony_ci    components to internal texture, table, or filter components
1015bd8deadSopenharmony_ci
1025bd8deadSopenharmony_ci        Base Internal Format    RGBA, Depth, and Stencil Values     Internal Components
1035bd8deadSopenharmony_ci
1045bd8deadSopenharmony_ci        STENCIL_INDEX           Stencil                             S
1055bd8deadSopenharmony_ci
1065bd8deadSopenharmony_ci
1075bd8deadSopenharmony_ci    Add to the list of required texture internal formats:
1085bd8deadSopenharmony_ci
1095bd8deadSopenharmony_ci        - Stencil formats: STENCIL_INDEX8
1105bd8deadSopenharmony_ci
1115bd8deadSopenharmony_ci
1125bd8deadSopenharmony_ci    Add rows to Table 8.21: Correspondence of sized internal depth and stencil
1135bd8deadSopenharmony_ci    formats to base internal formats, internal data type, and desired component
1145bd8deadSopenharmony_ci    resolutions for each sized internal format
1155bd8deadSopenharmony_ci
1165bd8deadSopenharmony_ci        Sized Internal Format       Base Internal Format    D bits      S bits
1175bd8deadSopenharmony_ci
1185bd8deadSopenharmony_ci        STENCIL_INDEX8              STENCIL_INDEX           <blank>     8
1195bd8deadSopenharmony_ci
1205bd8deadSopenharmony_ci    Modify Section 8.6 Alternate Texture Image Specification Commands, p. 222
1215bd8deadSopenharmony_ci
1225bd8deadSopenharmony_ci    ...The image is taken from the framebuffer exactly as if these arguments
1235bd8deadSopenharmony_ci    were passed to CopyPixels (see section 18.3) with argument type set to
1245bd8deadSopenharmony_ci    COLOR, DEPTH, DEPTH_STENCIL, or STENCIL_INDEX, depending on internalformat,
1255bd8deadSopenharmony_ci    stopping after pixel transfer processing is complete.
1265bd8deadSopenharmony_ci
1275bd8deadSopenharmony_ci    Modify Section 8.11 Texture Queries, p. 246
1285bd8deadSopenharmony_ci
1295bd8deadSopenharmony_ci    If format is DEPTH_COMPONENT, DEPTH_STENCIL, or STENCIL_INDEX then each
1305bd8deadSopenharmony_ci    depth component and/or stencil index is assigned with the same ordering of
1315bd8deadSopenharmony_ci    rows and images.
1325bd8deadSopenharmony_ci
1335bd8deadSopenharmony_ci    Modifications to the errors section for GetTexImage, p. 247,
1345bd8deadSopenharmony_ci
1355bd8deadSopenharmony_ci    Delete the following error:
1365bd8deadSopenharmony_ci
1375bd8deadSopenharmony_ci    An INVALID_ENUM error is generated if <format> is STENCIL_INDEX.
1385bd8deadSopenharmony_ci
1395bd8deadSopenharmony_ci    Add a bullet to the list of reasons for INVALID_OPERATION error:
1405bd8deadSopenharmony_ci
1415bd8deadSopenharmony_ci    - <format> is STENCIL_INDEX and the base internal format is not
1425bd8deadSopenharmony_ci      STENCIL_INDEX or DEPTH_STENCIL.
1435bd8deadSopenharmony_ci
1445bd8deadSopenharmony_ci    Modify 8.17 Texture Completeness, p. 263
1455bd8deadSopenharmony_ci
1465bd8deadSopenharmony_ci    Modify the bullet point on p. 263 describing required texture filter
1475bd8deadSopenharmony_ci    modes for an integer texture in order to determine texture completeness,
1485bd8deadSopenharmony_ci    to add STENCIL_INDEX textures explicitly:
1495bd8deadSopenharmony_ci
1505bd8deadSopenharmony_ci    - The internal format of the texture is integer (see tables 8.19-8.20)
1515bd8deadSopenharmony_ci      or STENCIL_INDEX, and either the magnification filter is not NEAREST,
1525bd8deadSopenharmony_ci      or the minification filter is neither NEAREST nor
1535bd8deadSopenharmony_ci      NEAREST_MIPMAP_NEAREST.
1545bd8deadSopenharmony_ci
1555bd8deadSopenharmony_ci    Modify 8.22.1 Depth Texture Comparison Mode, p. 278
1565bd8deadSopenharmony_ci
1575bd8deadSopenharmony_ci    - If the base internal format is STENCIL_INDEX, then r = St
1585bd8deadSopenharmony_ci
1595bd8deadSopenharmony_ciAdditions to Chapter 11 of the OpenGL 4.3 (Compatibility Profile) Specification
1605bd8deadSopenharmony_ci(Programmable Vertex Processing)
1615bd8deadSopenharmony_ci
1625bd8deadSopenharmony_ci    Modify 11.1.3.5 Texture Access p. 390
1635bd8deadSopenharmony_ci
1645bd8deadSopenharmony_ci    Texture lookups involving texture objects with an internal format of DEPTH_-
1655bd8deadSopenharmony_ci    STENCIL can read the stencil value as described in section 8.22 by setting
1665bd8deadSopenharmony_ci    the DEPTH_STENCIL_TEXTURE_MODE to STENCIL_COMPONENT. Textures with a
1675bd8deadSopenharmony_ci    STENCIL_INDEX base internal format may also be used to read stencil data.
1685bd8deadSopenharmony_ci    The stencil value is read as an integer and assigned to Rt. An unsigned
1695bd8deadSopenharmony_ci    integer sampler must be used to lookup the stencil component, otherwise
1705bd8deadSopenharmony_ci    the results are undefined.
1715bd8deadSopenharmony_ci
1725bd8deadSopenharmony_ci
1735bd8deadSopenharmony_ciAdditions to Chapter 15 of the OpenGL 4.3 (Compatibility Profile) Specification
1745bd8deadSopenharmony_ci(Programmable Fragment Processing)
1755bd8deadSopenharmony_ci
1765bd8deadSopenharmony_ci    Modify 15.2.1 Texture Access, p.510
1775bd8deadSopenharmony_ci
1785bd8deadSopenharmony_ci    Repace the paragraph "The stencil index texture internal component is
1795bd8deadSopenharmony_ci    ignored if the base internal format is DEPTH_STENCIL" with:
1805bd8deadSopenharmony_ci
1815bd8deadSopenharmony_ci    Texture lookups involving textures with stencil index data generate a
1825bd8deadSopenharmony_ci    texture base color Cb by using stencil values St directly, if either the
1835bd8deadSopenharmony_ci    texture has a base internal format of STENCIL_INDEX or the texture has a
1845bd8deadSopenharmony_ci    base internal format of DEPTH_STENCIL and a DEPTH_STENCIL_TEXTURE_MODE
1855bd8deadSopenharmony_ci    of STENCIL_COMPONENT.
1865bd8deadSopenharmony_ci
1875bd8deadSopenharmony_ci
1885bd8deadSopenharmony_ciNew Implementation Dependent State
1895bd8deadSopenharmony_ci
1905bd8deadSopenharmony_ci    None.
1915bd8deadSopenharmony_ci
1925bd8deadSopenharmony_ciNew State
1935bd8deadSopenharmony_ci
1945bd8deadSopenharmony_ci    None.
1955bd8deadSopenharmony_ci
1965bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications
1975bd8deadSopenharmony_ci
1985bd8deadSopenharmony_ci    None.
1995bd8deadSopenharmony_ci
2005bd8deadSopenharmony_ciGLX Protocol
2015bd8deadSopenharmony_ci
2025bd8deadSopenharmony_ci    None.
2035bd8deadSopenharmony_ci
2045bd8deadSopenharmony_ciModifications to the OpenGL Shading Language Specification, Version 4.30
2055bd8deadSopenharmony_ci
2065bd8deadSopenharmony_ci    None.
2075bd8deadSopenharmony_ci
2085bd8deadSopenharmony_ciErrors
2095bd8deadSopenharmony_ci
2105bd8deadSopenharmony_ci    An INVALID_OPERATION error is generated by GetTexImage if <format>
2115bd8deadSopenharmony_ci    is STENCIL_INDEX and the base internal format is not STENCIL_INDEX or
2125bd8deadSopenharmony_ci    DEPTH_STENCIL.
2135bd8deadSopenharmony_ci
2145bd8deadSopenharmony_ci    An INVALID_OPERATION error is generated by TexImage3D, TexImage2D,
2155bd8deadSopenharmony_ci    TexImage1D, TexSubImage3D, TexSubImage2D, or TexSubImage1D
2165bd8deadSopenharmony_ci    if <format> is STENCIL_INDEX and the base internal format is not
2175bd8deadSopenharmony_ci    <STENCIL_INDEX>.
2185bd8deadSopenharmony_ci
2195bd8deadSopenharmony_ci    An INVALID_OPERATION error is generated by TexImage3D, TexImage2D,
2205bd8deadSopenharmony_ci    TexImage1D, TexSubImage3D, TexSubImage2D, or TexSubImage1D if
2215bd8deadSopenharmony_ci    <format> is STENCIL_INDEX and <target> is not one of TEXTURE_1D,
2225bd8deadSopenharmony_ci    TEXTURE_2D, TEXTURE_1D_ARRAY, TEXTURE_2D_ARRAY, TEXTURE_RECTANGLE,
2235bd8deadSopenharmony_ci    TEXTURE_CUBE_MAP, TEXTURE_CUBE_MAP_ARRAY, PROXY_TEXTURE_1D,
2245bd8deadSopenharmony_ci    PROXY_TEXTURE_2D, PROXY_TEXTURE_1D_ARRAY, PROXY_TEXTURE_2D_ARRAY,
2255bd8deadSopenharmony_ci    PROXY_TEXTURE_RECTANGLE, PROXY_TEXTURE_CUBE_MAP, or
2265bd8deadSopenharmony_ci    PROXY_TEXTURE_CUBE_MAP_ARRAY.
2275bd8deadSopenharmony_ci
2285bd8deadSopenharmony_ciIssues
2295bd8deadSopenharmony_ci
2305bd8deadSopenharmony_ci
2315bd8deadSopenharmony_ci    (1) What is the interaction with ARB_stencil_texturing's
2325bd8deadSopenharmony_ci        DEPTH_STENCIL_TEXTURE_MODE?
2335bd8deadSopenharmony_ci
2345bd8deadSopenharmony_ci    RESOLVED: That piece of state is ignored because the base internal format
2355bd8deadSopenharmony_ci    of a STENCIL_INDEX texture is not DEPTH_STENCIL.
2365bd8deadSopenharmony_ci
2375bd8deadSopenharmony_ci    (2) Does the presence of this extension imply that the implementation
2385bd8deadSopenharmony_ci    supports a true 8-bit stencil buffer?
2395bd8deadSopenharmony_ci
2405bd8deadSopenharmony_ci    RESOLVED: No, some OpenGL implementations may internally expand a
2415bd8deadSopenharmony_ci    format like STENCIL_INDEX8 to DEPTH24_STENCIL8, but will make such a format
2425bd8deadSopenharmony_ci    behave as if there were no depth bits.  Additionally, implementations may
2435bd8deadSopenharmony_ci    not support independent depth and stencil attachments; a framebuffer with a
2445bd8deadSopenharmony_ci    STENCIL_INDEX8 stencil attachment and a DEPTH_COMPONENT24 depth attachment
2455bd8deadSopenharmony_ci    may be treated as unsupported (FRAMEBUFFER_UNSUPPORTED).
2465bd8deadSopenharmony_ci
2475bd8deadSopenharmony_ci    (3) Should we support stencil formats that have a number of bits that is
2485bd8deadSopenharmony_ci    not exactly supported in the implementation? 8-bits is universally
2495bd8deadSopenharmony_ci    supported, but 1/4/16-bits are not.
2505bd8deadSopenharmony_ci
2515bd8deadSopenharmony_ci    RESOLVED: Only accept STENCIL_INDEX8, which is universally supported.
2525bd8deadSopenharmony_ci
2535bd8deadSopenharmony_ciRevision History
2545bd8deadSopenharmony_ci
2555bd8deadSopenharmony_ci    Rev.    Date    Author    Changes
2565bd8deadSopenharmony_ci    ----  --------  --------  -----------------------------------------------
2575bd8deadSopenharmony_ci     1    03/20/13  jbolz     Internal revisions.
2585bd8deadSopenharmony_ci     2    05/30/13  dgkoch    Add tokens and errors section.
2595bd8deadSopenharmony_ci                              Update errors for GetTexImage.
2605bd8deadSopenharmony_ci     3    06/28/13  Jon Leech Fix dates in revision history. Change filter
2615bd8deadSopenharmony_ci                              modes for texture completeness (Bug 10372).
2625bd8deadSopenharmony_ci     4    08/08/13  pdaniell  Fix the functions that accept STENCIL_INDEX8 as
2635bd8deadSopenharmony_ci                              an <internalformat> parameter (Bug 10558).
2645bd8deadSopenharmony_ci     5    08/26/13  pdaniell  Fix the list of texture targets that support
2655bd8deadSopenharmony_ci                              stencil (and depth and depth/stencil) textures
2665bd8deadSopenharmony_ci                              to include the multisample targets (Bug 10558).
267