15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci EXT_texture_compression_rgtc 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_EXT_texture_compression_rgtc 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContributors 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Mark J. Kilgard, NVIDIA 125bd8deadSopenharmony_ci Pat Brown, NVIDIA 135bd8deadSopenharmony_ci Yanjun Zhang, S3 145bd8deadSopenharmony_ci Attila Barsi, Holografika 155bd8deadSopenharmony_ci Jason Schmidt, NVIDIA 165bd8deadSopenharmony_ci Slawomir Grajewski, Intel 175bd8deadSopenharmony_ci Daniel Koch, NVIDIA 185bd8deadSopenharmony_ci 195bd8deadSopenharmony_ciContact 205bd8deadSopenharmony_ci 215bd8deadSopenharmony_ci Mark J. Kilgard, NVIDIA Corporation (mjk 'at' nvidia.com) 225bd8deadSopenharmony_ci 235bd8deadSopenharmony_ciStatus 245bd8deadSopenharmony_ci 255bd8deadSopenharmony_ci Shipping for GeForce 8 Series (November 2006, Release 95) 265bd8deadSopenharmony_ci 275bd8deadSopenharmony_ciVersion 285bd8deadSopenharmony_ci 295bd8deadSopenharmony_ci Date: March 28, 2017 305bd8deadSopenharmony_ci Revision: 2 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ciNumber 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ci OpenGL Extension #332 355bd8deadSopenharmony_ci OpenGL ES Extension #286 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ciDependencies 385bd8deadSopenharmony_ci 395bd8deadSopenharmony_ci OpenGL 1.3, ARB_texture_compression, or OpenGL ES 3.0 required 405bd8deadSopenharmony_ci 415bd8deadSopenharmony_ci This extension is written against the OpenGL 2.0 (September 7, 425bd8deadSopenharmony_ci 2004) specification. 435bd8deadSopenharmony_ci 445bd8deadSopenharmony_ci This extension interacts with OpenGL 2.0 and ARB_texture_non_power_of_two. 455bd8deadSopenharmony_ci 465bd8deadSopenharmony_ci This extension interacts with the OpenGL ES 3.2 specification. 475bd8deadSopenharmony_ci 485bd8deadSopenharmony_ciOverview 495bd8deadSopenharmony_ci 505bd8deadSopenharmony_ci This extension introduces four new block-based texture compression 515bd8deadSopenharmony_ci formats suited for unsigned and signed red and red-green textures 525bd8deadSopenharmony_ci (hence the name "rgtc" for Red-Green Texture Compression). 535bd8deadSopenharmony_ci 545bd8deadSopenharmony_ci These formats are designed to reduce the storage requirements 555bd8deadSopenharmony_ci and memory bandwidth required for red and red-green textures by 565bd8deadSopenharmony_ci a factor of 2-to-1 over conventional uncompressed luminance and 575bd8deadSopenharmony_ci luminance-alpha textures with 8-bit components (GL_LUMINANCE8 and 585bd8deadSopenharmony_ci GL_LUMINANCE8_ALPHA8). 595bd8deadSopenharmony_ci 605bd8deadSopenharmony_ci The compressed signed red-green format is reasonably suited for 615bd8deadSopenharmony_ci storing compressed normal maps. 625bd8deadSopenharmony_ci 635bd8deadSopenharmony_ci This extension uses the same compression format as the 645bd8deadSopenharmony_ci EXT_texture_compression_latc extension except the color data is stored 655bd8deadSopenharmony_ci in the red and green components rather than luminance and alpha. 665bd8deadSopenharmony_ci Representing compressed red and green components is consistent with 675bd8deadSopenharmony_ci the BC4 and BC5 compressed formats supported by DirectX 10. 685bd8deadSopenharmony_ci 695bd8deadSopenharmony_ciNew Procedures and Functions 705bd8deadSopenharmony_ci 715bd8deadSopenharmony_ci None. 725bd8deadSopenharmony_ci 735bd8deadSopenharmony_ciNew Tokens 745bd8deadSopenharmony_ci 755bd8deadSopenharmony_ci In OpenGL 2.0, these tokens are accepted by the <internalformat> parameter 765bd8deadSopenharmony_ci of TexImage2D, CopyTexImage2D, and CompressedTexImage2D and 775bd8deadSopenharmony_ci the <format> parameter of CompressedTexSubImage2D. 785bd8deadSopenharmony_ci 795bd8deadSopenharmony_ci In OpenGL ES 3.2, these tokens are accepted by the <internalFormat> 805bd8deadSopenharmony_ci parameter of TexImage2D, TexStorage2D, and CompressedTexImage2D and 815bd8deadSopenharmony_ci the <format> parameter of CompressedTexSubImage2D. 825bd8deadSopenharmony_ci 835bd8deadSopenharmony_ci COMPRESSED_RED_RGTC1_EXT 0x8DBB 845bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC 855bd8deadSopenharmony_ci COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD 865bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE 875bd8deadSopenharmony_ci 885bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 2.0 Specification (OpenGL Operation) 895bd8deadSopenharmony_ci 905bd8deadSopenharmony_ci None. 915bd8deadSopenharmony_ci 925bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization) 935bd8deadSopenharmony_ci 945bd8deadSopenharmony_ci -- Section 3.8.1, Texture Image Specification 955bd8deadSopenharmony_ci 965bd8deadSopenharmony_ci Add to Table 3.17 (page 155): Specific compressed internal formats 975bd8deadSopenharmony_ci 985bd8deadSopenharmony_ci Compressed Internal Format Base Internal Format 995bd8deadSopenharmony_ci ------------------------------------------- -------------------- 1005bd8deadSopenharmony_ci COMPRESSED_RED_RGTC1_EXT RGB 1015bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_RGTC1_EXT RGB 1025bd8deadSopenharmony_ci COMPRESSED_RED_GREEN_RGTC2_EXT RGB 1035bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT RGB 1045bd8deadSopenharmony_ci 1055bd8deadSopenharmony_ci -- Section 3.8.2, Alternative Texture Image Specification Commands 1065bd8deadSopenharmony_ci [Section 8.6 in OpenGL ES 3.2] 1075bd8deadSopenharmony_ci 1085bd8deadSopenharmony_ci Add to the end of the section (page 163): 1095bd8deadSopenharmony_ci 1105bd8deadSopenharmony_ci "If the internal format of the texture image 1115bd8deadSopenharmony_ci being modified is COMPRESSED_RED_RGTC1_EXT, 1125bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_RGTC1_EXT, COMPRESSED_RED_GREEN_RGTC2_EXT, 1135bd8deadSopenharmony_ci or COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT, the texture is stored 1145bd8deadSopenharmony_ci using one of the two RGTC compressed texture image encodings (see 1155bd8deadSopenharmony_ci appendix). Such images are easily edited along 4x4 texel boundaries, 1165bd8deadSopenharmony_ci so the limitations on TexSubImage2D or CopyTexSubImage2D parameters 1175bd8deadSopenharmony_ci are relaxed. TexSubImage2D and CopyTexSubImage2D will result in 1185bd8deadSopenharmony_ci an INVALID_OPERATION error only if one of the following conditions 1195bd8deadSopenharmony_ci occurs: 1205bd8deadSopenharmony_ci 1215bd8deadSopenharmony_ci * <width> is not a multiple of four, <width> plus <xoffset> is not 1225bd8deadSopenharmony_ci equal to TEXTURE_WIDTH, and either <xoffset> or <yoffset> is 1235bd8deadSopenharmony_ci non-zero; 1245bd8deadSopenharmony_ci 1255bd8deadSopenharmony_ci * <height> is not a multiple of four, <height> plus <yoffset> is not 1265bd8deadSopenharmony_ci equal to TEXTURE_HEIGHT, and either <xoffset> or <yoffset> is 1275bd8deadSopenharmony_ci non-zero; or 1285bd8deadSopenharmony_ci 1295bd8deadSopenharmony_ci * <xoffset> or <yoffset> is not a multiple of four. 1305bd8deadSopenharmony_ci 1315bd8deadSopenharmony_ci The contents of any 4x4 block of texels of an RGTC compressed texture 1325bd8deadSopenharmony_ci image that does not intersect the area being modified are preserved 1335bd8deadSopenharmony_ci during valid TexSubImage2D and CopyTexSubImage2D calls." 1345bd8deadSopenharmony_ci 1355bd8deadSopenharmony_ci -- Section 3.8.3, Compressed Texture Images [Section 8.7 in OpenGL ES 3.2] 1365bd8deadSopenharmony_ci 1375bd8deadSopenharmony_ci Add after the 4th paragraph (page 164) at the end of the 1385bd8deadSopenharmony_ci CompressedTexImage discussion: 1395bd8deadSopenharmony_ci 1405bd8deadSopenharmony_ci "If <internalformat> is COMPRESSED_RED_RGTC1_EXT, 1415bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_RGTC1_EXT, COMPRESSED_RED_GREEN_RGTC2_EXT, 1425bd8deadSopenharmony_ci or COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT, the compressed texture is 1435bd8deadSopenharmony_ci stored using one of several RGTC compressed texture image formats. 1445bd8deadSopenharmony_ci The RGTC texture compression algorithm supports only 2D images 1455bd8deadSopenharmony_ci without borders. CompressedTexImage1D and CompressedTexImage3D 1465bd8deadSopenharmony_ci produce an INVALID_ENUM error if <internalformat> is an RGTC format. 1475bd8deadSopenharmony_ci CompressedTexImage2D will produce an INVALID_OPERATION error if 1485bd8deadSopenharmony_ci <border> is non-zero. 1495bd8deadSopenharmony_ci 1505bd8deadSopenharmony_ci Add to the end of the section (page 166) at the end of the 1515bd8deadSopenharmony_ci CompressedTexSubImage discussion: 1525bd8deadSopenharmony_ci 1535bd8deadSopenharmony_ci "If the internal format of the texture image 1545bd8deadSopenharmony_ci being modified is COMPRESSED_RED_RGTC1_EXT, 1555bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_RGTC1_EXT, COMPRESSED_RED_GREEN_RGTC2_EXT, 1565bd8deadSopenharmony_ci or COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT, the texture is stored 1575bd8deadSopenharmony_ci using one of the several RGTC compressed texture image formats. 1585bd8deadSopenharmony_ci Since the RGTC texture compression algorithm supports only 2D images, 1595bd8deadSopenharmony_ci CompressedTexSubImage1D and CompressedTexSubImage3D produce an 1605bd8deadSopenharmony_ci INVALID_ENUM error if <format> is an RGTC format. Since RGTC images 1615bd8deadSopenharmony_ci are easily edited along 4x4 texel boundaries, the limitations on 1625bd8deadSopenharmony_ci CompressedTexSubImage2D are relaxed. CompressedTexSubImage2D will 1635bd8deadSopenharmony_ci result in an INVALID_OPERATION error only if one of the following 1645bd8deadSopenharmony_ci conditions occurs: 1655bd8deadSopenharmony_ci 1665bd8deadSopenharmony_ci * <width> is not a multiple of four, and <width> plus <xoffset> is not 1675bd8deadSopenharmony_ci equal to TEXTURE_WIDTH; 1685bd8deadSopenharmony_ci 1695bd8deadSopenharmony_ci * <height> is not a multiple of four, and <height> plus <yoffset> is 1705bd8deadSopenharmony_ci not equal to TEXTURE_HEIGHT; or 1715bd8deadSopenharmony_ci 1725bd8deadSopenharmony_ci * <xoffset> or <yoffset> is not a multiple of four. 1735bd8deadSopenharmony_ci 1745bd8deadSopenharmony_ci The contents of any 4x4 block of texels of an RGTC compressed texture 1755bd8deadSopenharmony_ci image that does not intersect the area being modified are preserved 1765bd8deadSopenharmony_ci during valid TexSubImage2D and CopyTexSubImage2D calls." 1775bd8deadSopenharmony_ci 1785bd8deadSopenharmony_ci -- Section 3.8.8, Texture Minification [Section 8.14 in OpenGL ES 3.2] 1795bd8deadSopenharmony_ci 1805bd8deadSopenharmony_ci Add a sentence to the last paragraph (page 174) just prior to the 1815bd8deadSopenharmony_ci "Mipmapping" subheading: 1825bd8deadSopenharmony_ci 1835bd8deadSopenharmony_ci "If the texture's internal format lacks components that exist in 1845bd8deadSopenharmony_ci the texture's base internal format, such components are considered 1855bd8deadSopenharmony_ci zero when the texture border color is sampled. (So despite the 1865bd8deadSopenharmony_ci RGB base internal format of the COMPRESSED_RED_RGTC1_EXT and 1875bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_RGTC1_EXT formats, the green and blue 1885bd8deadSopenharmony_ci components of the texture border color are always considered 1895bd8deadSopenharmony_ci zero. Likewise for the COMPRESSED_RED_GREEN_RGTC2_EXT, and 1905bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT formats, the blue component 1915bd8deadSopenharmony_ci is always considered zero.)" 1925bd8deadSopenharmony_ci 1935bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 2.0 Specification (Per-Fragment 1945bd8deadSopenharmony_ciOperations and the Frame Buffer) 1955bd8deadSopenharmony_ci 1965bd8deadSopenharmony_ci None. 1975bd8deadSopenharmony_ci 1985bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 2.0 Specification (Special Functions) 1995bd8deadSopenharmony_ci 2005bd8deadSopenharmony_ci None. 2015bd8deadSopenharmony_ci 2025bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 2.0 Specification (State and 2035bd8deadSopenharmony_ciState Requests) 2045bd8deadSopenharmony_ci 2055bd8deadSopenharmony_ci None. 2065bd8deadSopenharmony_ci 2075bd8deadSopenharmony_ciAdditions to Appendix A of the OpenGL 2.0 Specification (Invariance) 2085bd8deadSopenharmony_ci 2095bd8deadSopenharmony_ci None. 2105bd8deadSopenharmony_ci 2115bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications 2125bd8deadSopenharmony_ci 2135bd8deadSopenharmony_ci None. 2145bd8deadSopenharmony_ci 2155bd8deadSopenharmony_ciAdditions to Appendix C of the OpenGL ES 3.2 Specification (Compressed Texture 2165bd8deadSopenharmony_ciImage Formats) 2175bd8deadSopenharmony_ci 2185bd8deadSopenharmony_ci Add a new Section C.3 (RGTC Compressed Texture Image Formats) 2195bd8deadSopenharmony_ci 2205bd8deadSopenharmony_ci RGTC formats are described in the "RGTC Compressed Texture Image Formats" 2215bd8deadSopenharmony_ci chapter of the Khronos Data Format Specification. The mapping between 2225bd8deadSopenharmony_ci OpenGL ES RGTC formats and that specification is shown in table C.3. 2235bd8deadSopenharmony_ci 2245bd8deadSopenharmony_ci OpenGL ES format Data Format Specification 2255bd8deadSopenharmony_ci Description 2265bd8deadSopenharmony_ci ------------------------------- ------------------------- 2275bd8deadSopenharmony_ci COMPRESSED_RED_RGTC1_EXT BC4 unsigned 2285bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_RGTC1_EXT BC4 signed 2295bd8deadSopenharmony_ci COMPRESSED_RED_GREEN_RGTC2_EXT BC5 unsigned 2305bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT BC5 signed 2315bd8deadSopenharmony_ci 2325bd8deadSopenharmony_ciGLX Protocol 2335bd8deadSopenharmony_ci 2345bd8deadSopenharmony_ci None. 2355bd8deadSopenharmony_ci 2365bd8deadSopenharmony_ciDependencies on ARB_texture_compression 2375bd8deadSopenharmony_ci 2385bd8deadSopenharmony_ci If ARB_texture_compression is supported, all the 2395bd8deadSopenharmony_ci errors and accepted tokens for CompressedTexImage1D, 2405bd8deadSopenharmony_ci CompressedTexImage2D, CompressedTexImage3D, CompressedTexSubImage1D, 2415bd8deadSopenharmony_ci CompressedTexSubImage2D, and CompressedTexSubImage3D also apply 2425bd8deadSopenharmony_ci respectively to the ARB-suffixed CompressedTexImage1DARB, 2435bd8deadSopenharmony_ci CompressedTexImage2DARB, CompressedTexImage3DARB, 2445bd8deadSopenharmony_ci CompressedTexSubImage1DARB, CompressedTexSubImage2DARB, and 2455bd8deadSopenharmony_ci CompressedTexSubImage3DARB. 2465bd8deadSopenharmony_ci 2475bd8deadSopenharmony_ciDependencies on OpenGL 2.0 or ARB_texture_non_power_of_two 2485bd8deadSopenharmony_ci 2495bd8deadSopenharmony_ci If OpenGL 2.0 or ARB_texture_non_power_of_two is supported, compressed 2505bd8deadSopenharmony_ci texture images can have sizes that are neither multiples of four nor small 2515bd8deadSopenharmony_ci values like one or two. The original version of this specification didn't 2525bd8deadSopenharmony_ci allow TexSubImage2D and CompressedTexSubImage2D to update only a portion 2535bd8deadSopenharmony_ci of such images. The spec has been updated to allow such edits in the 2545bd8deadSopenharmony_ci spirit of the resolution of issue (3) of the EXT_texture_compression_s3tc 2555bd8deadSopenharmony_ci specification. See the "Implementation Note" section for more details. 2565bd8deadSopenharmony_ci 2575bd8deadSopenharmony_ciInteractions with the OpenGL ES 3.2 Specification 2585bd8deadSopenharmony_ci 2595bd8deadSopenharmony_ci If implemented in OpenGL ES, replace the addition to Table 3.17 2605bd8deadSopenharmony_ci in Section 3.8.1 with an addition to Table 8.17 in Section 8.7: 2615bd8deadSopenharmony_ci 2625bd8deadSopenharmony_ci Compressed Internal Format Base Block Border 3D Cube 2635bd8deadSopenharmony_ci Internal Width x Type Tex Map 2645bd8deadSopenharmony_ci Format Height Array 2655bd8deadSopenharmony_ci Tex 2665bd8deadSopenharmony_ci --------------------------------- -------- ------- ------ --- ----- 2675bd8deadSopenharmony_ci COMPRESSED_RED_RGTC1_EXT RED 4x4 unorm 2685bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_RGTC1_EXT RED 4x4 snorm 2695bd8deadSopenharmony_ci COMPRESSED_RED_GREEN_RGTC2_EXT RG 4x4 unorm 2705bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT RG 4x4 snorm 2715bd8deadSopenharmony_ci 2725bd8deadSopenharmony_ci 2735bd8deadSopenharmony_ci Also, add to Section 8.4, Table 8.2: Valid combinations of format, type, 2745bd8deadSopenharmony_ci and sized internalFormat 2755bd8deadSopenharmony_ci 2765bd8deadSopenharmony_ci External 2775bd8deadSopenharmony_ci Bytes 2785bd8deadSopenharmony_ci Format Type Per Pixel Internal Format 2795bd8deadSopenharmony_ci ------ ------------- --------- -------------------------------------- 2805bd8deadSopenharmony_ci RED UNSIGNED_BYTE 4 COMPRESSED_RED_RGTC1_EXT 2815bd8deadSopenharmony_ci RED SIGNED_BYTE 4 COMPRESSED_SIGNED_RED_RGTC1_EXT 2825bd8deadSopenharmony_ci RG UNSIGNED_BYTE 8 COMPRESSED_RED_GREEN_RGTC2_EXT 2835bd8deadSopenharmony_ci RG SIGNED_BYTE 8 COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 2845bd8deadSopenharmony_ci 2855bd8deadSopenharmony_ci 2865bd8deadSopenharmony_ci In OpenGL ES, queries to GL_NUM_COMPRESSED_TEXTURE_FORMATS and 2875bd8deadSopenharmony_ci GL_COMPRESSED_TEXTURE_FORMATS should return the RGTC formats. 2885bd8deadSopenharmony_ci 2895bd8deadSopenharmony_ci In OpenGL ES, INVALID_OPERATION is generated by TexImage2D and TexStorage2D 2905bd8deadSopenharmony_ci if an RGTC format is used as the <internalFormat> parameter with a <type> 2915bd8deadSopenharmony_ci and <format> combination NOT listed: 2925bd8deadSopenharmony_ci 2935bd8deadSopenharmony_ci InternalFormat Format Type 2945bd8deadSopenharmony_ci ---------------------- ---------- -------------- 2955bd8deadSopenharmony_ci COMPRESSED_RED_RGTC1_EXT RED UNSIGNED_BYTE 2965bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_RGTC1_EXT RED SIGNED_BYTE 2975bd8deadSopenharmony_ci COMPRESSED_RED_GREEN_RGTC2_EXT RG UNSIGNED_BYTE 2985bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT RG SIGNED_BYTE 2995bd8deadSopenharmony_ci 3005bd8deadSopenharmony_ciErrors 3015bd8deadSopenharmony_ci 3025bd8deadSopenharmony_ci INVALID_ENUM is generated by CompressedTexImage1D 3035bd8deadSopenharmony_ci or CompressedTexImage3D if <internalformat> is 3045bd8deadSopenharmony_ci COMPRESSED_RED_RGTC1_EXT, COMPRESSED_SIGNED_RED_RGTC1_EXT, 3055bd8deadSopenharmony_ci COMPRESSED_RED_GREEN_RGTC2_EXT, or 3065bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT. 3075bd8deadSopenharmony_ci 3085bd8deadSopenharmony_ci INVALID_OPERATION is generated by CompressedTexImage2D 3095bd8deadSopenharmony_ci if <internalformat> is COMPRESSED_RED_RGCT1_EXT, 3105bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_RGTC1_EXT, COMPRESSED_RED_GREEN_RGTC2_EXT, 3115bd8deadSopenharmony_ci or COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT and <border> is not equal 3125bd8deadSopenharmony_ci to zero. 3135bd8deadSopenharmony_ci 3145bd8deadSopenharmony_ci INVALID_ENUM is generated by CompressedTexSubImage1D 3155bd8deadSopenharmony_ci or CompressedTexSubImage3D if 3165bd8deadSopenharmony_ci <format> is COMPRESSED_RED_RGCT1_EXT, 3175bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_RGTC1_EXT, COMPRESSED_RED_GREEN_RGTC2_EXT, 3185bd8deadSopenharmony_ci or COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT. 3195bd8deadSopenharmony_ci 3205bd8deadSopenharmony_ci INVALID_OPERATION is generated by TexSubImage2D or CopyTexSubImage2D if 3215bd8deadSopenharmony_ci TEXTURE_INTERNAL_FORMAT is COMPRESSED_RED_RGCT1_EXT, 3225bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_RGTC1_EXT, COMPRESSED_RED_GREEN_RGTC2_EXT, or 3235bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT and any of the following apply: 3245bd8deadSopenharmony_ci 3255bd8deadSopenharmony_ci * <width> is not a multiple of four, <width> plus <xoffset> is not 3265bd8deadSopenharmony_ci equal to TEXTURE_WIDTH, and either <xoffset> or <yoffset> is 3275bd8deadSopenharmony_ci non-zero; 3285bd8deadSopenharmony_ci 3295bd8deadSopenharmony_ci * <height> is not a multiple of four, <height> plus <yoffset> is not 3305bd8deadSopenharmony_ci equal to TEXTURE_HEIGHT, and either <xoffset> or <yoffset> is 3315bd8deadSopenharmony_ci non-zero; or 3325bd8deadSopenharmony_ci 3335bd8deadSopenharmony_ci * <xoffset> or <yoffset> is not a multiple of four. 3345bd8deadSopenharmony_ci 3355bd8deadSopenharmony_ci INVALID_OPERATION is generated by CompressedTexSubImage2D if 3365bd8deadSopenharmony_ci TEXTURE_INTERNAL_FORMAT is COMPRESSED_RED_RGCT1_EXT, 3375bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_RGTC1_EXT, COMPRESSED_RED_GREEN_RGTC2_EXT, or 3385bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT and any of the following apply: 3395bd8deadSopenharmony_ci 3405bd8deadSopenharmony_ci * <width> is not a multiple of four, and <width> plus <xoffset> is not 3415bd8deadSopenharmony_ci equal to TEXTURE_WIDTH; 3425bd8deadSopenharmony_ci 3435bd8deadSopenharmony_ci * <height> is not a multiple of four, and <height> plus <yoffset> is 3445bd8deadSopenharmony_ci not equal to TEXTURE_HEIGHT; or 3455bd8deadSopenharmony_ci 3465bd8deadSopenharmony_ci * <xoffset> or <yoffset> is not a multiple of four. 3475bd8deadSopenharmony_ci 3485bd8deadSopenharmony_ci The following restrictions from the ARB_texture_compression 3495bd8deadSopenharmony_ci specification do not apply to RGTC texture formats, since subimage 3505bd8deadSopenharmony_ci modification is straightforward as long as the subimage is properly 3515bd8deadSopenharmony_ci aligned. 3525bd8deadSopenharmony_ci 3535bd8deadSopenharmony_ci DELETE: INVALID_OPERATION is generated by TexSubImage1D, TexSubImage2D, 3545bd8deadSopenharmony_ci DELETE: TexSubImage3D, CopyTexSubImage1D, CopyTexSubImage2D, or 3555bd8deadSopenharmony_ci DELETE: CopyTexSubImage3D if the internal format of the texture image is 3565bd8deadSopenharmony_ci DELETE: compressed and <xoffset>, <yoffset>, or <zoffset> does not equal 3575bd8deadSopenharmony_ci DELETE: -b, where b is value of TEXTURE_BORDER. 3585bd8deadSopenharmony_ci 3595bd8deadSopenharmony_ci DELETE: INVALID_VALUE is generated by CompressedTexSubImage1D, 3605bd8deadSopenharmony_ci DELETE: CompressedTexSubImage2D, or CompressedTexSubImage3D if the 3615bd8deadSopenharmony_ci DELETE: entire texture image is not being edited: if <xoffset>, 3625bd8deadSopenharmony_ci DELETE: <yoffset>, or <zoffset> is greater than -b, <xoffset> + <width> is 3635bd8deadSopenharmony_ci DELETE: less than w+b, <yoffset> + <height> is less than h+b, or <zoffset> 3645bd8deadSopenharmony_ci DELETE: + <depth> is less than d+b, where b is the value of 3655bd8deadSopenharmony_ci DELETE: TEXTURE_BORDER, w is the value of TEXTURE_WIDTH, h is the value of 3665bd8deadSopenharmony_ci DELETE: TEXTURE_HEIGHT, and d is the value of TEXTURE_DEPTH. 3675bd8deadSopenharmony_ci 3685bd8deadSopenharmony_ci See also errors in the GL_ARB_texture_compression specification. 3695bd8deadSopenharmony_ci 3705bd8deadSopenharmony_ciNew State 3715bd8deadSopenharmony_ci 3725bd8deadSopenharmony_ci 4 new state values are added for the per-texture object 3735bd8deadSopenharmony_ci GL_TEXTURE_INTERNAL_FORMAT state. 3745bd8deadSopenharmony_ci 3755bd8deadSopenharmony_ci In the "Textures" state table( page 278), increment the 3765bd8deadSopenharmony_ci TEXTURE_INTERNAL_FORMAT subscript for Z by 4 in the "Type" row. 3775bd8deadSopenharmony_ci 3785bd8deadSopenharmony_ci [NOTE: The OpenGL 2.0 specification actually should read "n x Z48*" 3795bd8deadSopenharmony_ci because of the 6 generic compressed internal formats in table 3.18.] 3805bd8deadSopenharmony_ci 3815bd8deadSopenharmony_ciNew Implementation Dependent State 3825bd8deadSopenharmony_ci 3835bd8deadSopenharmony_ci None 3845bd8deadSopenharmony_ci 3855bd8deadSopenharmony_ciAppendix 3865bd8deadSopenharmony_ci 3875bd8deadSopenharmony_ci RGTC Compressed Texture Image Formats 3885bd8deadSopenharmony_ci 3895bd8deadSopenharmony_ci Compressed texture images stored using the RGTC compressed image 3905bd8deadSopenharmony_ci encodings are represented as a collection of 4x4 texel blocks, 3915bd8deadSopenharmony_ci where each block contains 64 or 128 bits of texel data. The image 3925bd8deadSopenharmony_ci is encoded as a normal 2D raster image in which each 4x4 block is 3935bd8deadSopenharmony_ci treated as a single pixel. If an RGTC image has a width or height 3945bd8deadSopenharmony_ci that is not a multiple of four, the data corresponding to texels 3955bd8deadSopenharmony_ci outside the image are irrelevant and undefined. 3965bd8deadSopenharmony_ci 3975bd8deadSopenharmony_ci When an RGTC image with a width of <w>, height of <h>, and block 3985bd8deadSopenharmony_ci size of <blocksize> (8 or 16 bytes) is decoded, the corresponding 3995bd8deadSopenharmony_ci image size (in bytes) is: 4005bd8deadSopenharmony_ci 4015bd8deadSopenharmony_ci ceil(<w>/4) * ceil(<h>/4) * blocksize. 4025bd8deadSopenharmony_ci 4035bd8deadSopenharmony_ci When decoding an RGTC image, the block containing the texel at offset 4045bd8deadSopenharmony_ci (<x>, <y>) begins at an offset (in bytes) relative to the base of the 4055bd8deadSopenharmony_ci image of: 4065bd8deadSopenharmony_ci 4075bd8deadSopenharmony_ci blocksize * (ceil(<w>/4) * floor(<y>/4) + floor(<x>/4)). 4085bd8deadSopenharmony_ci 4095bd8deadSopenharmony_ci The data corresponding to a specific texel (<x>, <y>) are extracted 4105bd8deadSopenharmony_ci from a 4x4 texel block using a relative (x,y) value of 4115bd8deadSopenharmony_ci 4125bd8deadSopenharmony_ci (<x> modulo 4, <y> modulo 4). 4135bd8deadSopenharmony_ci 4145bd8deadSopenharmony_ci There are four distinct RGTC image formats: 4155bd8deadSopenharmony_ci 4165bd8deadSopenharmony_ci 4175bd8deadSopenharmony_ci COMPRESSED_RED_RGTC1: Each 4x4 block of texels consists of 4185bd8deadSopenharmony_ci 64 bits of unsigned red image data. 4195bd8deadSopenharmony_ci 4205bd8deadSopenharmony_ci Each red image data block is encoded as a sequence of 8 bytes, called 4215bd8deadSopenharmony_ci (in order of increasing address): 4225bd8deadSopenharmony_ci 4235bd8deadSopenharmony_ci red0, red1, bits_0, bits_1, bits_2, bits_3, bits_4, bits_5 4245bd8deadSopenharmony_ci 4255bd8deadSopenharmony_ci The 6 "bits_*" bytes of the block are decoded into a 48-bit bit 4265bd8deadSopenharmony_ci vector: 4275bd8deadSopenharmony_ci 4285bd8deadSopenharmony_ci bits = bits_0 + 4295bd8deadSopenharmony_ci 256 * (bits_1 + 4305bd8deadSopenharmony_ci 256 * (bits_2 + 4315bd8deadSopenharmony_ci 256 * (bits_3 + 4325bd8deadSopenharmony_ci 256 * (bits_4 + 4335bd8deadSopenharmony_ci 256 * bits_5)))) 4345bd8deadSopenharmony_ci 4355bd8deadSopenharmony_ci red0 and red1 are 8-bit unsigned integers that are unpacked to red 4365bd8deadSopenharmony_ci values RED0 and RED1 as though they were pixels with a <format> 4375bd8deadSopenharmony_ci of LUMINANCE and a type of UNSIGNED_BTYE. 4385bd8deadSopenharmony_ci 4395bd8deadSopenharmony_ci bits is a 48-bit unsigned integer, from which a three-bit control 4405bd8deadSopenharmony_ci code is extracted for a texel at location (x,y) in the block 4415bd8deadSopenharmony_ci using: 4425bd8deadSopenharmony_ci 4435bd8deadSopenharmony_ci code(x,y) = bits[3*(4*y+x)+2..3*(4*y+x)+0] 4445bd8deadSopenharmony_ci 4455bd8deadSopenharmony_ci where bit 47 is the most significant and bit 0 is the least 4465bd8deadSopenharmony_ci significant bit. 4475bd8deadSopenharmony_ci 4485bd8deadSopenharmony_ci The red value R for a texel at location (x,y) in the block is 4495bd8deadSopenharmony_ci given by: 4505bd8deadSopenharmony_ci 4515bd8deadSopenharmony_ci RED0, if red0 > red1 and code(x,y) == 0 4525bd8deadSopenharmony_ci RED1, if red0 > red1 and code(x,y) == 1 4535bd8deadSopenharmony_ci (6*RED0+ RED1)/7, if red0 > red1 and code(x,y) == 2 4545bd8deadSopenharmony_ci (5*RED0+2*RED1)/7, if red0 > red1 and code(x,y) == 3 4555bd8deadSopenharmony_ci (4*RED0+3*RED1)/7, if red0 > red1 and code(x,y) == 4 4565bd8deadSopenharmony_ci (3*RED0+4*RED1)/7, if red0 > red1 and code(x,y) == 5 4575bd8deadSopenharmony_ci (2*RED0+5*RED1)/7, if red0 > red1 and code(x,y) == 6 4585bd8deadSopenharmony_ci ( RED0+6*RED1)/7, if red0 > red1 and code(x,y) == 7 4595bd8deadSopenharmony_ci 4605bd8deadSopenharmony_ci RED0, if red0 <= red1 and code(x,y) == 0 4615bd8deadSopenharmony_ci RED1, if red0 <= red1 and code(x,y) == 1 4625bd8deadSopenharmony_ci (4*RED0+ RED1)/5, if red0 <= red1 and code(x,y) == 2 4635bd8deadSopenharmony_ci (3*RED0+2*RED1)/5, if red0 <= red1 and code(x,y) == 3 4645bd8deadSopenharmony_ci (2*RED0+3*RED1)/5, if red0 <= red1 and code(x,y) == 4 4655bd8deadSopenharmony_ci ( RED0+4*RED1)/5, if red0 <= red1 and code(x,y) == 5 4665bd8deadSopenharmony_ci MINRED, if red0 <= red1 and code(x,y) == 6 4675bd8deadSopenharmony_ci MAXRED, if red0 <= red1 and code(x,y) == 7 4685bd8deadSopenharmony_ci 4695bd8deadSopenharmony_ci MINRED and MAXRED are 0.0 and 1.0 respectively. 4705bd8deadSopenharmony_ci 4715bd8deadSopenharmony_ci Since the decoded texel has a red format, the resulting RGBA value 4725bd8deadSopenharmony_ci for the texel is (R,0,0,1). 4735bd8deadSopenharmony_ci 4745bd8deadSopenharmony_ci 4755bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_RGTC1: Each 4x4 block of texels consists of 4765bd8deadSopenharmony_ci 64 bits of signed red image data. The red values of a texel are 4775bd8deadSopenharmony_ci extracted in the same way as COMPRESSED_RED_RGTC1 except red0, red1, 4785bd8deadSopenharmony_ci RED0, RED1, MINRED, and MAXRED are signed values defined as follows: 4795bd8deadSopenharmony_ci 4805bd8deadSopenharmony_ci red0 and red1 are 8-bit signed (two's complement) integers. 4815bd8deadSopenharmony_ci 4825bd8deadSopenharmony_ci { red0 / 127.0, red0 > -128 4835bd8deadSopenharmony_ci RED0 = { 4845bd8deadSopenharmony_ci { -1.0, red0 == -128 4855bd8deadSopenharmony_ci 4865bd8deadSopenharmony_ci { red1 / 127.0, red1 > -128 4875bd8deadSopenharmony_ci RED1 = { 4885bd8deadSopenharmony_ci { -1.0, red1 == -128 4895bd8deadSopenharmony_ci 4905bd8deadSopenharmony_ci MINRED = -1.0 4915bd8deadSopenharmony_ci 4925bd8deadSopenharmony_ci MAXRED = 1.0 4935bd8deadSopenharmony_ci 4945bd8deadSopenharmony_ci CAVEAT for signed red0 and red1 values: the expressions "red0 > 4955bd8deadSopenharmony_ci red1" and "red0 <= red1" above are considered undefined (read: may 4965bd8deadSopenharmony_ci vary by implementation) when red0 equals -127 and red1 equals -128, 4975bd8deadSopenharmony_ci This is because if red0 were remapped to -127 prior to the comparison 4985bd8deadSopenharmony_ci to reduce the latency of a hardware decompressor, the expressions 4995bd8deadSopenharmony_ci would reverse their logic. Encoders for the signed LA formats should 5005bd8deadSopenharmony_ci avoid encoding blocks where red0 equals -127 and red1 equals -128. 5015bd8deadSopenharmony_ci 5025bd8deadSopenharmony_ci 5035bd8deadSopenharmony_ci COMPRESSED_RED_GREEN_RGTC2: Each 4x4 block of texels consists of 5045bd8deadSopenharmony_ci 64 bits of compressed unsigned red image data followed by 64 bits 5055bd8deadSopenharmony_ci of compressed unsigned green image data. 5065bd8deadSopenharmony_ci 5075bd8deadSopenharmony_ci The first 64 bits of compressed red are decoded exactly like 5085bd8deadSopenharmony_ci COMPRESSED_RED_RGTC1 above. 5095bd8deadSopenharmony_ci 5105bd8deadSopenharmony_ci The second 64 bits of compressed green are decoded exactly like 5115bd8deadSopenharmony_ci COMPRESSED_RED_RGTC1 above except the decoded value R for this 5125bd8deadSopenharmony_ci second block is considered the resulting green value G. 5135bd8deadSopenharmony_ci 5145bd8deadSopenharmony_ci Since the decoded texel has a red-green format, the resulting RGBA 5155bd8deadSopenharmony_ci value for the texel is (R,G,0,1). 5165bd8deadSopenharmony_ci 5175bd8deadSopenharmony_ci 5185bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_GREEN_RGTC2: Each 4x4 block of texels consists 5195bd8deadSopenharmony_ci of 64 bits of compressed signed red image data followed by 64 bits 5205bd8deadSopenharmony_ci of compressed signed green image data. 5215bd8deadSopenharmony_ci 5225bd8deadSopenharmony_ci The first 64 bits of compressed red are decoded exactly like 5235bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_RGTC1 above. 5245bd8deadSopenharmony_ci 5255bd8deadSopenharmony_ci The second 64 bits of compressed green are decoded exactly like 5265bd8deadSopenharmony_ci COMPRESSED_SIGNED_RED_RGTC1 above except the decoded value R 5275bd8deadSopenharmony_ci for this second block is considered the resulting green value G. 5285bd8deadSopenharmony_ci 5295bd8deadSopenharmony_ci Since this image has a red-green format, the resulting RGBA value is 5305bd8deadSopenharmony_ci (R,G,0,1). 5315bd8deadSopenharmony_ci 5325bd8deadSopenharmony_ciIssues 5335bd8deadSopenharmony_ci 5345bd8deadSopenharmony_ci 1) What should these new formats be called? 5355bd8deadSopenharmony_ci 5365bd8deadSopenharmony_ci RESOLVED: "rgtc" for Red-Green Texture Compression. 5375bd8deadSopenharmony_ci 5385bd8deadSopenharmony_ci 2) How should the uncompressed and filtered texels be returned by 5395bd8deadSopenharmony_ci texture fetches? 5405bd8deadSopenharmony_ci 5415bd8deadSopenharmony_ci RESOLVED: Red values show up as (R,0,0,1) where R is the red 5425bd8deadSopenharmony_ci value, green and blue are forced to 0, and alpha is forced to 1. 5435bd8deadSopenharmony_ci Likewise, red-green values show up as (R,G,0,1) where G is the 5445bd8deadSopenharmony_ci green value. 5455bd8deadSopenharmony_ci 5465bd8deadSopenharmony_ci Prior extensions such as NV_float_buffer and NV_texture_shader 5475bd8deadSopenharmony_ci have introduced formats such as GL_FLOAT_R_NV and GL_DSDT_NV where 5485bd8deadSopenharmony_ci one- and two-component texture formats show up as (X,0,0,1) or 5495bd8deadSopenharmony_ci (X,Y,0,1) RGBA texels. The RGTC formats mimic these two-component 5505bd8deadSopenharmony_ci formats. 5515bd8deadSopenharmony_ci 5525bd8deadSopenharmony_ci The (X,Y,0,1) convention, particularly with signed components, 5535bd8deadSopenharmony_ci is nice for normal maps because a normalized vector can be 5545bd8deadSopenharmony_ci formed by a shader program by computing sqrt(abs(1-X*X-Y*Y)) 5555bd8deadSopenharmony_ci for the Z component. 5565bd8deadSopenharmony_ci 5575bd8deadSopenharmony_ci While GL_RED is a valid external format, core OpenGL provides 5585bd8deadSopenharmony_ci no GL_RED_GREEN external format. Applications can either use 5595bd8deadSopenharmony_ci GL_RGB or GL_RGBA and pad out the blue and alpha components, 5605bd8deadSopenharmony_ci or use the two-component GL_LUMINANCE_ALPHA color format and 5615bd8deadSopenharmony_ci use the color matrix functionality to swizzle the luminance and 5625bd8deadSopenharmony_ci alpha values into red and green respectively. 5635bd8deadSopenharmony_ci 5645bd8deadSopenharmony_ci 3) Should red and red-green compression formats with signed 5655bd8deadSopenharmony_ci components be introduced when the core specification lacked 5665bd8deadSopenharmony_ci uncompressed red and red-green texture formats? 5675bd8deadSopenharmony_ci 5685bd8deadSopenharmony_ci RESOLVED: Yes, signed red and red-green compression formats 5695bd8deadSopenharmony_ci should be added. 5705bd8deadSopenharmony_ci 5715bd8deadSopenharmony_ci Signed red-green formats are suited for compressed normal maps. 5725bd8deadSopenharmony_ci Compressed normal maps may well be the dominant use of this 5735bd8deadSopenharmony_ci extension. 5745bd8deadSopenharmony_ci 5755bd8deadSopenharmony_ci Unsigned red-green formats require an extra "expand normal" 5765bd8deadSopenharmony_ci operation to convert [0,1] to [-1,+1]. Direct support for signed 5775bd8deadSopenharmony_ci red-green formats avoids this step in a shader program. 5785bd8deadSopenharmony_ci 5795bd8deadSopenharmony_ci 4) Should there be a mix of signed red and unsigned green or 5805bd8deadSopenharmony_ci vice versa? 5815bd8deadSopenharmony_ci 5825bd8deadSopenharmony_ci RESOLVED: No. 5835bd8deadSopenharmony_ci 5845bd8deadSopenharmony_ci NV_texture_shader provided an internal format 5855bd8deadSopenharmony_ci (GL_SIGNED_RGB_UNSIGNED_ALPHA_NV) with mixed signed and unsigned 5865bd8deadSopenharmony_ci components. The format saw little usage. There's no reason to 5875bd8deadSopenharmony_ci think a GL_SIGNED_RED_UNSIGNED_GREEN format would be any more 5885bd8deadSopenharmony_ci useful or popular. 5895bd8deadSopenharmony_ci 5905bd8deadSopenharmony_ci 5) How are signed integer values mapped to floating-point values? 5915bd8deadSopenharmony_ci 5925bd8deadSopenharmony_ci RESOLVED: A signed 8-bit two's complement value X is computed to 5935bd8deadSopenharmony_ci a floating-point value Xf with the formula: 5945bd8deadSopenharmony_ci 5955bd8deadSopenharmony_ci { X / 127.0, X > -128 5965bd8deadSopenharmony_ci Xf = { 5975bd8deadSopenharmony_ci { -1.0, X == -128 5985bd8deadSopenharmony_ci 5995bd8deadSopenharmony_ci This conversion means -1, 0, and +1 are all exactly representable, 6005bd8deadSopenharmony_ci however -128 and -127 both map to -1.0. Mapping -128 to -1.0 6015bd8deadSopenharmony_ci avoids the numerical awkwardness of have a representable value 6025bd8deadSopenharmony_ci slightly more negative than -1.0. 6035bd8deadSopenharmony_ci 6045bd8deadSopenharmony_ci This conversion is intentionally NOT the "byte" conversion listed 6055bd8deadSopenharmony_ci in Table 2.9 for component conversions. That conversion says: 6065bd8deadSopenharmony_ci 6075bd8deadSopenharmony_ci Xf = (2*X + 1) / 255.0 6085bd8deadSopenharmony_ci 6095bd8deadSopenharmony_ci The Table 2.9 conversion is incapable of exactly representing 6105bd8deadSopenharmony_ci zero. 6115bd8deadSopenharmony_ci 6125bd8deadSopenharmony_ci 6) How will signed components resulting 6135bd8deadSopenharmony_ci from GL_COMPRESSED_SIGNED_RED_RGTC1_EXT and 6145bd8deadSopenharmony_ci GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT texture fetches interact 6155bd8deadSopenharmony_ci with fragment coloring? 6165bd8deadSopenharmony_ci 6175bd8deadSopenharmony_ci RESOLVED: The specification language for this extension is silent 6185bd8deadSopenharmony_ci about clamping behavior leaving this to the core specification 6195bd8deadSopenharmony_ci and other extensions. The clamping or lack of clamping is left 6205bd8deadSopenharmony_ci to the core specification and other extensions. 6215bd8deadSopenharmony_ci 6225bd8deadSopenharmony_ci For assembly program extensions supporting texture fetches 6235bd8deadSopenharmony_ci (ARB_fragment_program, NV_fragment_program, NV_vertex_program3, 6245bd8deadSopenharmony_ci etc.) or the OpenGL Shading Language, these signed formats will 6255bd8deadSopenharmony_ci appear as expected with unclamped signed components as a result 6265bd8deadSopenharmony_ci of a texture fetch instruction. 6275bd8deadSopenharmony_ci 6285bd8deadSopenharmony_ci If ARB_color_buffer_float is supported, its clamping controls 6295bd8deadSopenharmony_ci will apply. 6305bd8deadSopenharmony_ci 6315bd8deadSopenharmony_ci NV_texture_shader extension, if supported, adds support for 6325bd8deadSopenharmony_ci fixed-point textures with signed components and relaxed the 6335bd8deadSopenharmony_ci fixed-function texture environment clamping appropriately. If the 6345bd8deadSopenharmony_ci NV_texture_shader extension is supported, its specified behavior 6355bd8deadSopenharmony_ci for the texture environment applies where intermediate values 6365bd8deadSopenharmony_ci are clamped to [-1,1] unless stated otherwise as in the case 6375bd8deadSopenharmony_ci of explicitly clamped to [0,1] for GL_COMBINE. or clamping the 6385bd8deadSopenharmony_ci linear interpolation weight to [0,1] for GL_DECAL and GL_BLEND. 6395bd8deadSopenharmony_ci 6405bd8deadSopenharmony_ci Otherwise, the conventional core texture environment clamps 6415bd8deadSopenharmony_ci incoming, intermediate, and output color components to [0,1]. 6425bd8deadSopenharmony_ci 6435bd8deadSopenharmony_ci This implies that the conventional texture environment 6445bd8deadSopenharmony_ci functionality of unextended OpenGL 1.5 or OpenGL 2.0 without 6455bd8deadSopenharmony_ci using GLSL (and with none of the extensions referred to above) 6465bd8deadSopenharmony_ci is unable to make proper use of the signed texture formats added 6475bd8deadSopenharmony_ci by this extension because the conventional texture environment 6485bd8deadSopenharmony_ci requires texture source colors to be clamped to [0,1]. Texture 6495bd8deadSopenharmony_ci filtering of these signed formats would be still signed, but 6505bd8deadSopenharmony_ci negative values generated post-filtering would be clamped to 6515bd8deadSopenharmony_ci zero by the core texture environment functionality. The 6525bd8deadSopenharmony_ci expectation is clearly that this extension would be co-implemented 6535bd8deadSopenharmony_ci with one of the previously referred to extensions or used with 6545bd8deadSopenharmony_ci GLSL for the new signed formats to be useful. 6555bd8deadSopenharmony_ci 6565bd8deadSopenharmony_ci 7) Should a specific normal map compression format be added? 6575bd8deadSopenharmony_ci 6585bd8deadSopenharmony_ci RESOLVED: No. 6595bd8deadSopenharmony_ci 6605bd8deadSopenharmony_ci It's probably short-sighted to design a format just for normal 6615bd8deadSopenharmony_ci maps. Indeed, NV_texture_shader added a GL_SIGNED_HILO_NV 6625bd8deadSopenharmony_ci format with exactly the kind of "hemisphere remap" useful for 6635bd8deadSopenharmony_ci normal maps and the format went basically unused. Instead, 6645bd8deadSopenharmony_ci this extension provides the mechanism for compressed normal maps 6655bd8deadSopenharmony_ci based on the more conventional red-green format. 6665bd8deadSopenharmony_ci 6675bd8deadSopenharmony_ci The GL_COMPRESSED_RED_GREEN_RGTC2_EXT and 6685bd8deadSopenharmony_ci GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT formats are sufficient 6695bd8deadSopenharmony_ci for normal maps with additional shader instructions used to 6705bd8deadSopenharmony_ci generate the 3rd component. 6715bd8deadSopenharmony_ci 6725bd8deadSopenharmony_ci 8) Should uncompressed signed red and red-green formats be added 6735bd8deadSopenharmony_ci by this extension? 6745bd8deadSopenharmony_ci 6755bd8deadSopenharmony_ci RESOLVED: No, this extension is focused on just adding compressed 6765bd8deadSopenharmony_ci texture formats. 6775bd8deadSopenharmony_ci 6785bd8deadSopenharmony_ci The NV_texture_shader extension adds such uncompressed signed 6795bd8deadSopenharmony_ci texture formats. A distinct multi-vendor extension for signed 6805bd8deadSopenharmony_ci fixed-point texture formats could provide all or a subset of 6815bd8deadSopenharmony_ci the signed fixed-point uncompressed texture formats introduced 6825bd8deadSopenharmony_ci by NV_texture_shader. 6835bd8deadSopenharmony_ci 6845bd8deadSopenharmony_ci 9) What compression ratios does this extension provide? 6855bd8deadSopenharmony_ci 6865bd8deadSopenharmony_ci The RGTC1 formats are 8 bytes (64 bits) per 4x4 pixel block. 6875bd8deadSopenharmony_ci A 4x4 block of GL_LUMINANCE8 data requires 16 bytes (1 byte 6885bd8deadSopenharmony_ci per texel). This is a 2-to-1 compression ratio. 6895bd8deadSopenharmony_ci 6905bd8deadSopenharmony_ci The RGTC2 formats are 16 bytes (128 bits) per 4x4 pixel block. 6915bd8deadSopenharmony_ci A 4x4 block of GL_LUMINANCE8_ALPHA8 data requires 32 bytes 6925bd8deadSopenharmony_ci (2 bytes per texel). This is again a 2-to-1 compression ratio. 6935bd8deadSopenharmony_ci 6945bd8deadSopenharmony_ci In contrast, the comparable compression ratio for the S3TC 6955bd8deadSopenharmony_ci formats is 4-to-1. 6965bd8deadSopenharmony_ci 6975bd8deadSopenharmony_ci Arguably, the lower compression ratio allows better compression 6985bd8deadSopenharmony_ci quality particularly because the RGTC formats compress each 6995bd8deadSopenharmony_ci component separately. 7005bd8deadSopenharmony_ci 7015bd8deadSopenharmony_ci 10) How do these new formats compare with the existing GL_LUMINANCE4, 7025bd8deadSopenharmony_ci GL_LUMINANCE4_ALPHA4, and GL_LUMINANCE6_ALPHA2 internal formats? 7035bd8deadSopenharmony_ci 7045bd8deadSopenharmony_ci RESOLVED: The existing GL_LUMINANCE4, GL_LUMINANCE4_ALPHA4, 7055bd8deadSopenharmony_ci and GL_LUMINANCE6_ALPHA2 internal formats provide a similar 7065bd8deadSopenharmony_ci 2-to-1 compression ratio but mandate a uniform quantization 7075bd8deadSopenharmony_ci for all components. In contrast, this extension provides a 7085bd8deadSopenharmony_ci compression format with 3-bit quantization over a specifiable 7095bd8deadSopenharmony_ci min/max range that can vary per 4x4 texel tile. 7105bd8deadSopenharmony_ci 7115bd8deadSopenharmony_ci Additionally, many OpenGL implementations do not natively support 7125bd8deadSopenharmony_ci the GL_LUMINANCE4, GL_LUMINANCE4_ALPHA4, and GL_LUMINANCE6_ALPHA2 7135bd8deadSopenharmony_ci internal formats but rather silently promote these formats 7145bd8deadSopenharmony_ci to store 8 bits per component, thereby eliminating any 7155bd8deadSopenharmony_ci storage/bandwidth advantage for these formats. 7165bd8deadSopenharmony_ci 7175bd8deadSopenharmony_ci 11) Does this extension require EXT_texture_compression_s3tc? 7185bd8deadSopenharmony_ci 7195bd8deadSopenharmony_ci RESOLVED: No. 7205bd8deadSopenharmony_ci 7215bd8deadSopenharmony_ci As written, this specification does not rely on wording of the 7225bd8deadSopenharmony_ci EXT_texture_compression_s3tc extension. For example, certain 7235bd8deadSopenharmony_ci discussion added to Sections 3.8.2 and 3.8.3 is quite similar 7245bd8deadSopenharmony_ci to corresponding EXT_texture_compression_s3tc language. 7255bd8deadSopenharmony_ci 7265bd8deadSopenharmony_ci 12) Should anything be said about the precision of texture filtering 7275bd8deadSopenharmony_ci for these new formats? 7285bd8deadSopenharmony_ci 7295bd8deadSopenharmony_ci RESOLVED: No precision requirements are part of the specification 7305bd8deadSopenharmony_ci language since OpenGL extensions typically leave precision 7315bd8deadSopenharmony_ci details to the implementation. 7325bd8deadSopenharmony_ci 7335bd8deadSopenharmony_ci Realistically, at least 8-bit filtering precision can be expected 7345bd8deadSopenharmony_ci from implementations (and probably more). 7355bd8deadSopenharmony_ci 7365bd8deadSopenharmony_ci 13) Should these formats be allowed to specify 3D texture images 7375bd8deadSopenharmony_ci when NV_texture_compression_vtc is supported? 7385bd8deadSopenharmony_ci 7395bd8deadSopenharmony_ci RESOLVED: The NV_texture_compression_vtc stacks 4x4 blocks into 7405bd8deadSopenharmony_ci 4x4x4 bricks. It may be more desirable to represent compressed 7415bd8deadSopenharmony_ci 3D textures as simply slices of 4x4 blocks. 7425bd8deadSopenharmony_ci 7435bd8deadSopenharmony_ci However the NV_texture_compression_vtc extension expects data 7445bd8deadSopenharmony_ci passed to the glCompressedTexImage commands to be "bricked" 7455bd8deadSopenharmony_ci rather than blocked slices. 7465bd8deadSopenharmony_ci 7475bd8deadSopenharmony_ci 14) How is the texture border color handled for the blue component 7485bd8deadSopenharmony_ci of an RGTC2 texture and the green and blue components of an 7495bd8deadSopenharmony_ci RGTC1 texture? 7505bd8deadSopenharmony_ci 7515bd8deadSopenharmony_ci RESOLVED: The base texture format is RGB for the RGTC1 and 7525bd8deadSopenharmony_ci RGTC2 texture formats. This would mean table 3.15 would be 7535bd8deadSopenharmony_ci used to determine how the texture border color is interpreted 7545bd8deadSopenharmony_ci and which components are considered. 7555bd8deadSopenharmony_ci 7565bd8deadSopenharmony_ci However since only red or red/green components exist for the 7575bd8deadSopenharmony_ci RGTC1 and RGTC2 formats, it makes little sense to require 7585bd8deadSopenharmony_ci the blue component be supplied by the texture border color and 7595bd8deadSopenharmony_ci hence be involved (meaningfully only when the border is sampled) 7605bd8deadSopenharmony_ci in texture filtering. 7615bd8deadSopenharmony_ci 7625bd8deadSopenharmony_ci For this reason, a statement is added to section 3.8.8 says that 7635bd8deadSopenharmony_ci if a texture's internal format lacks components that exist in 7645bd8deadSopenharmony_ci the texture's base internal format, such components contain 7655bd8deadSopenharmony_ci zero (ignoring the texture's corresponding texture border color 7665bd8deadSopenharmony_ci component value) when the texture border color is sampled. 7675bd8deadSopenharmony_ci 7685bd8deadSopenharmony_ci So the green and blue components of the filtered result of a 7695bd8deadSopenharmony_ci RGTC1 texture are always zero, even when the border is sampled. 7705bd8deadSopenharmony_ci Similarly the blue component of the filtered result of a RGTC2 7715bd8deadSopenharmony_ci texture is always zero, even when the border is sampled. 7725bd8deadSopenharmony_ci 7735bd8deadSopenharmony_ci 15) What should glGetTexLevelParameter return for 7745bd8deadSopenharmony_ci GL_TEXTURE_GREEN_SIZE and GL_TEXTURE_BLUE_SIZE for the RGTC1 7755bd8deadSopenharmony_ci formats? What should glGetTexLevelParameter return for 7765bd8deadSopenharmony_ci GL_TEXTURE_BLUE_SIZE for the RGTC2 formats? 7775bd8deadSopenharmony_ci 7785bd8deadSopenharmony_ci RESOLVED: Zero bits. 7795bd8deadSopenharmony_ci 7805bd8deadSopenharmony_ci These formats always return 0.0 for these respective components 7815bd8deadSopenharmony_ci and have no bits devoted to these components. 7825bd8deadSopenharmony_ci 7835bd8deadSopenharmony_ci Returning 8 bits for red size of RGTC1 and the red and green 7845bd8deadSopenharmony_ci sizes of RGTC2 makes sense because that's the maximum potential 7855bd8deadSopenharmony_ci precision for the uncompressed texels. 7865bd8deadSopenharmony_ci 7875bd8deadSopenharmony_ci 16) Should the token names contain R and RG or RED and RED_GREEN? 7885bd8deadSopenharmony_ci 7895bd8deadSopenharmony_ci RESOLVED: RED and RED_GREEN. 7905bd8deadSopenharmony_ci 7915bd8deadSopenharmony_ci Saying RGB and RGBA makes sense for three- and four-component 7925bd8deadSopenharmony_ci formats rather than spelling out the component names because 7935bd8deadSopenharmony_ci RGB and RGBA are used so commonly and spelling out the names it 7945bd8deadSopenharmony_ci too wordy. 7955bd8deadSopenharmony_ci 7965bd8deadSopenharmony_ci But for 1- and 2-component names, we follow the precedent by 7975bd8deadSopenharmony_ci GL_LUMINANCE and GL_LUMINANCE_ALPHA. This extension spells out 7985bd8deadSopenharmony_ci the component names of 1- and 2-component names. 7995bd8deadSopenharmony_ci 8005bd8deadSopenharmony_ci Another reason to avoid R and RG is the existing meaning of 8015bd8deadSopenharmony_ci the GL_R and GL_RED tokens. GL_RED already exists as a token 8025bd8deadSopenharmony_ci name for a single-component external format. GL_R also already 8035bd8deadSopenharmony_ci exists as a token name but refers to the R texture coordinate, 8045bd8deadSopenharmony_ci not the red color component. 8055bd8deadSopenharmony_ci 8065bd8deadSopenharmony_ci 17) Can you use the GL_RED external format with glTexImage2D and other 8075bd8deadSopenharmony_ci such commands to load textures with the 8085bd8deadSopenharmony_ci GL_COMPRESSED_RED_RGTC1_EXT or GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 8095bd8deadSopenharmony_ci internal formats? 8105bd8deadSopenharmony_ci 8115bd8deadSopenharmony_ci RESOLVED: Yes. 8125bd8deadSopenharmony_ci 8135bd8deadSopenharmony_ci GL_RED has been a valid external format parameter to glTexImage 8145bd8deadSopenharmony_ci and similar commands since OpenGL 1.0. 8155bd8deadSopenharmony_ci 8165bd8deadSopenharmony_ci 18) Should any of the generic compression GL_COMPRESSED_* tokens in 8175bd8deadSopenharmony_ci OpenGL 2.1 map to RGTC formats? 8185bd8deadSopenharmony_ci 8195bd8deadSopenharmony_ci RESOLVED: No. The RGTC formats are missing color components 8205bd8deadSopenharmony_ci so are not adequate implementations for any of the generic 8215bd8deadSopenharmony_ci compression formats. 8225bd8deadSopenharmony_ci 8235bd8deadSopenharmony_ci 19) Should the GL_NUM_COMPRESSED_TEXTURE_FORMATS and 8245bd8deadSopenharmony_ci GL_COMPRESSED_TEXTURE_FORMATS queries return the RGTC formats? 8255bd8deadSopenharmony_ci 8265bd8deadSopenharmony_ci RESOLVED: Not in OpenGL, yes in OpenGL ES. 8275bd8deadSopenharmony_ci 8285bd8deadSopenharmony_ci The OpenGL 2.1 specification says "The only values returned 8295bd8deadSopenharmony_ci by this query [GL_COMPRESSED_TEXTURE_FORMATS"] are those 8305bd8deadSopenharmony_ci corresponding to formats suitable for general-purpose usage. 8315bd8deadSopenharmony_ci The renderer will not enumerate formats with restrictions that 8325bd8deadSopenharmony_ci need to be specifically understood prior to use." 8335bd8deadSopenharmony_ci 8345bd8deadSopenharmony_ci Compressed textures with just red or red-green components are 8355bd8deadSopenharmony_ci not general-purpose so should not be returned by these queries 8365bd8deadSopenharmony_ci because they have restrictions. 8375bd8deadSopenharmony_ci 8385bd8deadSopenharmony_ci Applications that seek to use the RGTC formats should do so 8395bd8deadSopenharmony_ci by looking for this extension's name in the string returned by 8405bd8deadSopenharmony_ci glGetString(GL_EXTENSIONS) rather than 8415bd8deadSopenharmony_ci what GL_NUM_COMPRESSED_TEXTURE_FORMATS and 8425bd8deadSopenharmony_ci GL_COMPRESSED_TEXTURE_FORMATS return. 8435bd8deadSopenharmony_ci 8445bd8deadSopenharmony_ci The OpenGL ES 3.2 specification does not include the requirement 8455bd8deadSopenharmony_ci for general-purpose usage, and so these queries should return the 8465bd8deadSopenharmony_ci RGTC formats in an ES context. 8475bd8deadSopenharmony_ci 8485bd8deadSopenharmony_ciImplementation Note 8495bd8deadSopenharmony_ci 8505bd8deadSopenharmony_ci This extension allows TexSubImage2D and CompressedTexSubImage2D to perform 8515bd8deadSopenharmony_ci partial updates to compressed images, but generally requires that the 8525bd8deadSopenharmony_ci updated area be aligned to 4x4 block boundaries. If the width or height 8535bd8deadSopenharmony_ci is not a multiple of four, there will be 4x4 blocks at the edge of the 8545bd8deadSopenharmony_ci image that contain "extra" texels that are not part of the image. This 8555bd8deadSopenharmony_ci spec has an exception allowing edits that partially cover such blocks as 8565bd8deadSopenharmony_ci long as the edit covers all texels in the block belonging to the image. 8575bd8deadSopenharmony_ci For example, in a 2D texture of size 70x50, it is legal to update the 8585bd8deadSopenharmony_ci single partial block covering the four texels from (68,48) to (69,49) by 8595bd8deadSopenharmony_ci setting (<xoffset>, <yoffset>) to (68,48) and <width> and <height> to 2. 8605bd8deadSopenharmony_ci 8615bd8deadSopenharmony_ci This specification derived some of its language from the 8625bd8deadSopenharmony_ci EXT_texture_compression_s3tc specification. When that extension was 8635bd8deadSopenharmony_ci originally written, non-bordered textures were required to have widths and 8645bd8deadSopenharmony_ci heights that were powers of two. Therefore, the only cases where partial 8655bd8deadSopenharmony_ci blocks could occur were if the width or height of the texture image was 8665bd8deadSopenharmony_ci one or two. The original spec language allowed partial block edits only 8675bd8deadSopenharmony_ci if the width or height of the region edited was equal to the full texture 8685bd8deadSopenharmony_ci size. That language didn't handle cases such as the 70x50 example above. 8695bd8deadSopenharmony_ci 8705bd8deadSopenharmony_ci This specification was updated in April, 2009 to allow such edits. 8715bd8deadSopenharmony_ci Multiple OpenGL implementers correctly implemented the original 8725bd8deadSopenharmony_ci restriction, and partial edits that include partially covered tiles will 8735bd8deadSopenharmony_ci result in INVALID_OPERATION errors on older drivers. 8745bd8deadSopenharmony_ci 8755bd8deadSopenharmony_ciRevision History 8765bd8deadSopenharmony_ci 8775bd8deadSopenharmony_ci Revision 1.1, April 24, 2007: mjk 8785bd8deadSopenharmony_ci - Add caveat about how signed LA decompression happens when 8795bd8deadSopenharmony_ci lum0 equals -127 and lum1 equals -128. This caveat matches 8805bd8deadSopenharmony_ci a decoding allowance in DirectX 10. 8815bd8deadSopenharmony_ci 8825bd8deadSopenharmony_ci Revision 1.2, January 21, 2008: mjk 8835bd8deadSopenharmony_ci - Add issues #18 and #19. 8845bd8deadSopenharmony_ci 8855bd8deadSopenharmony_ci Revision 1.3, April 14, 2009: pbrown 8865bd8deadSopenharmony_ci - Add interaction with non-power-of-two textures from OpenGL 2.0 / 8875bd8deadSopenharmony_ci ARB_texture_non_power_of_two. Allow CompressedTexSubImage2D to 8885bd8deadSopenharmony_ci perform edits that include partial tiles at the edge of the image as 8895bd8deadSopenharmony_ci long as the specified width/height parameters line up with the edge. 8905bd8deadSopenharmony_ci Thanks to Emil Persson for finding this issue. 8915bd8deadSopenharmony_ci 8925bd8deadSopenharmony_ci Revision 2, March 28, 2017: jaschmidt 8935bd8deadSopenharmony_ci - Add interactions with the OpenGL ES 3.2 specification. 8945bd8deadSopenharmony_ci - repace incorrect references to COMPRESSED_LUMINANCE_LACT1_EXT with 8955bd8deadSopenharmony_ci correct references to COMPRESSED_RED_RGTC1_EXT. 896