Name NV_texture_compression_s3tc_update Name Strings GL_NV_texture_compression_s3tc_update Contact Ian Stewart, NVIDIA Corporation (istewart 'at' nvidia.com) Contributors Nicholas Haemel, NVIDIA Corporation Acorn Pooley, NVIDIA Corporation Antti Rasmus, NVIDIA Corporation Musawir Shah, NVIDIA Corporation Status Complete. Version Last Modified Date: Sep 27, 2012 NVIDIA Revision: 2 Number OpenGL ES Extension #95 Dependencies This specification is written against the OpenGL ES 2.0.25 specification. Depends on the GL_NV_texture_compression_s3tc extension. Overview This extension allows for full or partial image updates to a compressed 2D texture from an uncompressed texel data buffer using TexImage2D and TexSubImage2D. Consquently, if a compressed internal format is used, all the restrictions associated with compressed textures will apply. These include sub-image updates aligned to 4x4 pixel blocks and the restriction on usage as render targets. IP Status NVIDIA Proprietary New Procedures and Functions None New Tokens None Additions to Chapter 3 of the OpenGL ES 2.0.25 Specification (Rasterization) Modify Section 3.7.1, Texture Image Specification (change last paragraph on Page 67 as follows) Components are then selected from the resulting R, G, B, or A values to obtain a texture with the base internal format specified by , which must match except when is TEXTURE_2D and is one of the following compressed formats: COMPRESSED_RGB_S3TC_DXT1_NV, COMPRESSED_RGBA_S3TC_DXT1_NV, COMPRESSED_RGBA_S3TC_DXT3_NV, or COMPRESSED_RGBA_S3TC_DXT5_NV. In this case, conversion from only RGB and RGBA formats are supported during texture image processing. values other than RBA or RGBA will result in the INVALID_OPERATION error. In all other cases where does not match , the error INVALID_OPERATION is generated. Table 3.8 summarizes the mapping of R, G, B, and A values to texture components, as a function of the base internal format of the texture image. may be one of the five internal format symbolic constants listed in table 3.8 or the four compressed formats: COMPRESSED_RGB_S3TC_DXT1_NV, COMPRESSED_RGBA_S3TC_DXT1_NV, COMPRESSED_RGBA_S3TC_DXT3_NV, or COMPRESSED_RGBA_S3TC_DXT5_NV. Specifying a value for that is not one of the above values generates the error INVALID_VALUE. When a compressed is specified, a compressed texture is created and all the associated restrictions mentioned in Section 3.7.3 are imposed. Note that when encoding an RGBA image into a format using 1-bit alpha, any texels with an alpha component less than 0.5 end up with an alpha of 0.0 and any texels with an alpha component greater than or equal to 0.5 end up with an alpha of 1.0. When encoding an RGBA image into the COMPRESSED_RGBA_S3TC_DXT1_NV format, the resulting red, green, and blue components of any texels with a final alpha of 0.0 will automatically be zero (black). If this behavior is not desired by an application, it should not use COMPRESSED_RGBA_S3TC_DXT1_NV. Modify Section 3.7.2, Alternate Texture Image Specification Commands (add to the end of section) When the internal format of the texture object is COMPRESSED_RGB_S3TC_DXT1_NV, COMPRESSED_RGBA_S3TC_DXT1_NV, COMPRESSED_RGBA_S3TC_DXT3_NV, or COMPRESSED_RGBA_S3TC_DXT5_NV, the update region specified in TexSubImage2D must be aligned to 4x4 pixel blocks. If or are not multiples of 4 an INVALID_OPERATION error is generated. If is not a multiple of 4 and + is not equal to the width of the LOD then an INVALID_OPERATION error is generated. If is not a multiple of 4 and + is not equal to the height of the LOD then an INVALID_OPERATION error is generated. Additions to Chapter 4 of the OpenGL ES 2.0.25 Specification (Per-Fragment Operations and the Framebuffer) Modify Section 4.4.3, Attaching Texture Images to a Framebuffer (add after last paragraph on Page 113) If is not zero and the internal format of the corresponding texture object is a compressed format, an INVALID_OPERATION error is generated. Errors INVALID_OPERATION is generated by TexImage2D and TexSubImage2D if TEXTURE_INTERNAL_FORMAT is COMPRESSED_RGB_S3TC_DXT1_NV, COMPRESSED_RGBA_S3TC_DXT1_NV, COMPRESSED_RGBA_S3TC_DXT3_NV, or COMPRESSED_RGBA_S3TC_DXT5_NV and is not RGB or RGBA. If or are not multiples of 4 an INVALID_OPERATION error is generated. If is not a multiple of 4 and + is not equal to the width of the LOD then an INVALID_OPERATION error is generated. If is not a multiple of 4 and + is not equal to the height of the LOD then an INVALID_OPERATION error is generated. Issues 1) Should sub-image updates be aligned to 4x4 pixel blocks? RESOLUTION: Yes. Relaxing this restriction would otherwise require CPU read-back of pixels at the 4x4 compression block boundary. 2) Should we support binding of compressed textures as render targets? RESOLUTION: No. Writing to directly to compressed formats not possible using hardware. Supporting this feature would involve read-back of the texture and re-compression on the CPU, which would be prohibitively slow. 3) Should we support mip map generation? RESOLUTION: No. Mip map generation is not supported for compressed textures. However, uploading to specific mip level is supported. Revision History Rev. Date Author Changes ---- -------- --------- ------------------------------------- 2 09/27/12 istewart Changed all EXT references to NV. Added note about DXT1 alpha encoding. Fixed TexSubImage2D error conditions. 1 04/06/11 mshah First revision.