15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci ARB_stencil_texturing 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_ARB_stencil_texturing 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Piers Daniell, NVIDIA Corporation (pdaniell 'at' nvidia.com) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciContributors 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci Bruce Merry 165bd8deadSopenharmony_ci Jeff Bolz, NVIDIA 175bd8deadSopenharmony_ci Pat Brown, NVIDIA 185bd8deadSopenharmony_ci 195bd8deadSopenharmony_ciNotice 205bd8deadSopenharmony_ci 215bd8deadSopenharmony_ci Copyright (c) 2012-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. 375bd8deadSopenharmony_ci Approved by the ARB on 2012/06/12. 385bd8deadSopenharmony_ci 395bd8deadSopenharmony_ciVersion 405bd8deadSopenharmony_ci 415bd8deadSopenharmony_ci Last Modified Date: March 19, 2013 425bd8deadSopenharmony_ci Revision: 5 435bd8deadSopenharmony_ci 445bd8deadSopenharmony_ciNumber 455bd8deadSopenharmony_ci 465bd8deadSopenharmony_ci ARB Extension #138 475bd8deadSopenharmony_ci 485bd8deadSopenharmony_ciDependencies 495bd8deadSopenharmony_ci 505bd8deadSopenharmony_ci OpenGL 1.1, ARB_depth_texture and EXT_packed_depth_stencil are required. 515bd8deadSopenharmony_ci 525bd8deadSopenharmony_ci This extension is written against The OpenGL 4.2 (Compatibility Profile) 535bd8deadSopenharmony_ci specification. 545bd8deadSopenharmony_ci 555bd8deadSopenharmony_ciOverview 565bd8deadSopenharmony_ci 575bd8deadSopenharmony_ci This extension allows texturing of the stencil component of a packed depth 585bd8deadSopenharmony_ci stencil texture. Stencil values are returned as unsigned integers. It is 595bd8deadSopenharmony_ci not possible to sample both depth and stencil values from the same 605bd8deadSopenharmony_ci texture, and this extension allows the app to select which is sampled for 615bd8deadSopenharmony_ci the bound texture. 625bd8deadSopenharmony_ci 635bd8deadSopenharmony_ciNew Procedures and Functions 645bd8deadSopenharmony_ci 655bd8deadSopenharmony_ci None 665bd8deadSopenharmony_ci 675bd8deadSopenharmony_ciNew Tokens 685bd8deadSopenharmony_ci 695bd8deadSopenharmony_ci Accepted by the <pname> parameter of TexParameter* and GetTexParameter*: 705bd8deadSopenharmony_ci 715bd8deadSopenharmony_ci DEPTH_STENCIL_TEXTURE_MODE 0x90EA 725bd8deadSopenharmony_ci 735bd8deadSopenharmony_ciAdditions to the OpenGL 4.2 (Compatibility Profile) Specification 745bd8deadSopenharmony_ci 755bd8deadSopenharmony_ciChanges to Section 2.14.12 (Shader Execution), page 144 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ciAdd a new new bullet point on page 149: 785bd8deadSopenharmony_ci 795bd8deadSopenharmony_ci "* The sampler used in a texture lookup function is one of the shadow 805bd8deadSopenharmony_ci sampler types, the texture object's internal format is DEPTH_STENCIL, 815bd8deadSopenharmony_ci and the DEPTH_STENCIL_TEXTURE_MODE is not DEPTH_COMPONENT." 825bd8deadSopenharmony_ci 835bd8deadSopenharmony_ciThen change the following paragraph that reads: 845bd8deadSopenharmony_ci 855bd8deadSopenharmony_ci "The stencil index texture internal component is ignored if the base 865bd8deadSopenharmony_ci internal format is DEPTH_STENCIL." 875bd8deadSopenharmony_ci 885bd8deadSopenharmony_ciTo the following: 895bd8deadSopenharmony_ci 905bd8deadSopenharmony_ci "The stencil index texture internal component is ignored if the base 915bd8deadSopenharmony_ci internal format is DEPTH_STENCIL and the DEPTH_STENCIL_TEXTURE_MODE 925bd8deadSopenharmony_ci is not STENCIL_INDEX. 935bd8deadSopenharmony_ci 945bd8deadSopenharmony_ci Texture lookups involving texture objects with an internal format of 955bd8deadSopenharmony_ci DEPTH_STENCIL can read the stencil value as described in section 965bd8deadSopenharmony_ci 3.10.18 by setting the DEPTH_STENCIL_TEXTURE_MODE to STENCIL_INDEX. 975bd8deadSopenharmony_ci The stencil value is read as an integer and assigned to R_t. An unsigned 985bd8deadSopenharmony_ci integer sampler should be used to lookup the stencil component, otherwise 995bd8deadSopenharmony_ci the results are undefined." 1005bd8deadSopenharmony_ci 1015bd8deadSopenharmony_ciChanges to Section 3.10.8 (Texture Parameters), page 322 1025bd8deadSopenharmony_ci 1035bd8deadSopenharmony_ciIn Table 3.22 (Texture parameters and their values) add the following 1045bd8deadSopenharmony_cientry: 1055bd8deadSopenharmony_ci 1065bd8deadSopenharmony_ci " 1075bd8deadSopenharmony_ci Name Type Legal Values 1085bd8deadSopenharmony_ci ------------- ---- ------------------------------ 1095bd8deadSopenharmony_ci DEPTH_STENCIL_TEXTURE_MODE enum DEPTH_COMPONENT, STENCIL_INDEX 1105bd8deadSopenharmony_ci " 1115bd8deadSopenharmony_ci 1125bd8deadSopenharmony_ciChanges to Section 3.10.13 (Combined Depth/Stencil Textures), page 342 1135bd8deadSopenharmony_ci 1145bd8deadSopenharmony_ciModify the paragraph to read: 1155bd8deadSopenharmony_ci 1165bd8deadSopenharmony_ci "If the texture image has a base internal format of DEPTH_STENCIL, then 1175bd8deadSopenharmony_ci the stencil index texture component is ignored by default. The texture 1185bd8deadSopenharmony_ci value <T> does not include a stencil index component, but includes 1195bd8deadSopenharmony_ci only the depth component. In order to access the stencil index texture 1205bd8deadSopenharmony_ci component the DEPTH_STENCIL_TEXTURE_MODE texture parameter should be 1215bd8deadSopenharmony_ci set to STENCIL_INDEX. When this mode is set the depth component is ignored 1225bd8deadSopenharmony_ci and the texture value includes only the stencil index component. The 1235bd8deadSopenharmony_ci stencil index value is treated as an unsigned integer texture and 1245bd8deadSopenharmony_ci returns an unsigned integer value when sampled. When sampling the stencil 1255bd8deadSopenharmony_ci index only NEAREST filtering is supported. The DEPTH_STENCIL_TEXTURE_MODE 1265bd8deadSopenharmony_ci is ignored for non depth/stencil textures." 1275bd8deadSopenharmony_ci 1285bd8deadSopenharmony_ciChanges to Section 3.10.14 (Texture Completeness), page 343 1295bd8deadSopenharmony_ci 1305bd8deadSopenharmony_ciAdd a new bullet point for the conditions that cause the texture 1315bd8deadSopenharmony_cito not be complete: 1325bd8deadSopenharmony_ci 1335bd8deadSopenharmony_ci "* The internal format of the texture is DEPTH_STENCIL, the 1345bd8deadSopenharmony_ci DEPTH_STENCIL_TEXTURE_MODE for the texture is STENCIL_INDEX and either the 1355bd8deadSopenharmony_ci magnification filter or the minification filter is not NEAREST." 1365bd8deadSopenharmony_ci 1375bd8deadSopenharmony_ciChanges to Section 3.10.18 (Texture Comparison Modes), page 356 1385bd8deadSopenharmony_ci 1395bd8deadSopenharmony_ciModify the following paragraph: 1405bd8deadSopenharmony_ci 1415bd8deadSopenharmony_ci "Let Dt be the depth texture value and St be the stencil index component 1425bd8deadSopenharmony_ci of a depth/stencil texture. If there is no stencil component the value of 1435bd8deadSopenharmony_ci St is undefined. Let Dref be the reference value..." 1445bd8deadSopenharmony_ci 1455bd8deadSopenharmony_ciInsert a new paragraph after the paragraphs that ends: 1465bd8deadSopenharmony_ci 1475bd8deadSopenharmony_ci "Then the effective texture value is computed as follows: 1485bd8deadSopenharmony_ci If the base internal format is DEPTH_STENCIL and the value of 1495bd8deadSopenharmony_ci DEPTH_STENCIL_TEXTURE_MODE is STENCIL_INDEX, then 1505bd8deadSopenharmony_ci r = St 1515bd8deadSopenharmony_ci Otherwise if the value of TEXTURE_COMPARE_MODE is NONE, then 1525bd8deadSopenharmony_ci r = Dt 1535bd8deadSopenharmony_ci Otherwise if the value of TEXTURE_COMPARE_MODE is 1545bd8deadSopenharmony_ci COMPARE_REF_TO_TEXTURE, then r depends on the texture comparison 1555bd8deadSopenharmony_ci function as shown in table 3.31. 1565bd8deadSopenharmony_ci The resulting r is assigned ..." 1575bd8deadSopenharmony_ci 1585bd8deadSopenharmony_ciAdditions to Chapter 8 of the OpenGL Shading Language 4.20.6 Specification 1595bd8deadSopenharmony_ci 1605bd8deadSopenharmony_ciInsert a new paragraph at the end of Section 8.9: 1615bd8deadSopenharmony_ci 1625bd8deadSopenharmony_ci "For depth/stencil textures, the sampler type should match the component 1635bd8deadSopenharmony_ci being accessed as set through the OpenGL API. When the depth/stencil texture 1645bd8deadSopenharmony_ci mode is set to DEPTH_COMPONENT, a floating-point sampler type should be used. 1655bd8deadSopenharmony_ci When the depth/stencil texture mode is set to STENCIL_INDEX, an unsigned integer 1665bd8deadSopenharmony_ci sampler type should be used. Doing a texture lookup with an unsupported 1675bd8deadSopenharmony_ci combination will return undefined values." 1685bd8deadSopenharmony_ci 1695bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications 1705bd8deadSopenharmony_ci 1715bd8deadSopenharmony_ci None 1725bd8deadSopenharmony_ci 1735bd8deadSopenharmony_ciErrors 1745bd8deadSopenharmony_ci 1755bd8deadSopenharmony_ci None 1765bd8deadSopenharmony_ci 1775bd8deadSopenharmony_ciNew State 1785bd8deadSopenharmony_ci 1795bd8deadSopenharmony_ci (Table 6.24, Textures) add the following entry: 1805bd8deadSopenharmony_ci 1815bd8deadSopenharmony_ci Get Value Type Get Command Initial Value Description Section 1825bd8deadSopenharmony_ci ------------- ---- ----------- ------------- ----------- ------- 1835bd8deadSopenharmony_ci DEPTH_STENCIL_TEXTURE_MODE n*Z2 GetTexParameteriv DEPTH_COMPONENT Depth stencil texture mode 3.10.8 1845bd8deadSopenharmony_ci 1855bd8deadSopenharmony_ciNew Implementation Dependent State 1865bd8deadSopenharmony_ci 1875bd8deadSopenharmony_ci None 1885bd8deadSopenharmony_ci 1895bd8deadSopenharmony_ciIssues 1905bd8deadSopenharmony_ci 1915bd8deadSopenharmony_ci 1) Should we support combined depth/stencil in one lookup? 1925bd8deadSopenharmony_ci 1935bd8deadSopenharmony_ci RESOLVED: No because depth is float and stencil is integer and we 1945bd8deadSopenharmony_ci have no way to return both with the existing samplers. Also some 1955bd8deadSopenharmony_ci implementations may not have an easy way to retrive both depth and 1965bd8deadSopenharmony_ci stencil in one lookup. 1975bd8deadSopenharmony_ci 1985bd8deadSopenharmony_ci 2) How does this interact with texture filters (e.g., LINEAR)? 1995bd8deadSopenharmony_ci 2005bd8deadSopenharmony_ci RESOLVED: Sampling the stencil values will behave like integer textures. 2015bd8deadSopenharmony_ci There is no filtering. 2025bd8deadSopenharmony_ci 2035bd8deadSopenharmony_ci 3) I assume DEPTH_STENCIL_TEXTURE_MODE is ignored unless the texture 2045bd8deadSopenharmony_ci itself has a DEPTH_STENCIL internal format? 2055bd8deadSopenharmony_ci 2065bd8deadSopenharmony_ci RESOLVED: Correct. 2075bd8deadSopenharmony_ci 2085bd8deadSopenharmony_ciRevision History 2095bd8deadSopenharmony_ci 2105bd8deadSopenharmony_ci Rev. Date Author Changes 2115bd8deadSopenharmony_ci ---- -------- -------- ----------------------------------------------- 2125bd8deadSopenharmony_ci 5 03/19/13 Jon Leech Fix STENCIL_COMPONENT -> STENCIL_INDEX typo 2135bd8deadSopenharmony_ci (Bug 10077). 2145bd8deadSopenharmony_ci 2155bd8deadSopenharmony_ci 4 05/04/12 pdaniell Add missing spec stating how the stencil value 2165bd8deadSopenharmony_ci is assigned to the color vector result of the 2175bd8deadSopenharmony_ci texture lookup function. Clarified the filtering 2185bd8deadSopenharmony_ci used for stencil index sampling. 2195bd8deadSopenharmony_ci 2205bd8deadSopenharmony_ci 3 05/03/12 pdaniell Add enum value. Use DEPTH_COMPONENT and 2215bd8deadSopenharmony_ci STENCIL_INDEX instead of DEPTH and STENCIL for 2225bd8deadSopenharmony_ci the valid DEPTH_STENCIL_TEXTURE_MODEs. These 2235bd8deadSopenharmony_ci better represent "Pixel Formats". 2245bd8deadSopenharmony_ci 2255bd8deadSopenharmony_ci 2 03/15/12 pdaniell Fixes based on feedback from Bruce Merry. 2265bd8deadSopenharmony_ci 2275bd8deadSopenharmony_ci 1 10/25/11 pdaniell Initial version. 228