1Name 2 3 NV_texture_compression_s3tc_update 4 5Name Strings 6 7 GL_NV_texture_compression_s3tc_update 8 9Contact 10 11 Ian Stewart, NVIDIA Corporation (istewart 'at' nvidia.com) 12 13Contributors 14 15 Nicholas Haemel, NVIDIA Corporation 16 Acorn Pooley, NVIDIA Corporation 17 Antti Rasmus, NVIDIA Corporation 18 Musawir Shah, NVIDIA Corporation 19 20Status 21 22 Complete. 23 24Version 25 26 Last Modified Date: Sep 27, 2012 27 NVIDIA Revision: 2 28 29Number 30 31 OpenGL ES Extension #95 32 33Dependencies 34 35 This specification is written against the OpenGL ES 2.0.25 36 specification. 37 38 Depends on the GL_NV_texture_compression_s3tc extension. 39 40Overview 41 42 This extension allows for full or partial image updates to a 43 compressed 2D texture from an uncompressed texel data buffer using 44 TexImage2D and TexSubImage2D. Consquently, if a compressed internal 45 format is used, all the restrictions associated with compressed 46 textures will apply. These include sub-image updates aligned to 4x4 47 pixel blocks and the restriction on usage as render targets. 48 49IP Status 50 51 NVIDIA Proprietary 52 53New Procedures and Functions 54 55 None 56 57New Tokens 58 59 None 60 61Additions to Chapter 3 of the OpenGL ES 2.0.25 Specification (Rasterization) 62 63 Modify Section 3.7.1, Texture Image Specification 64 65 (change last paragraph on Page 67 as follows) 66 67 Components are then selected from the resulting R, G, B, or A values 68 to obtain a texture with the base internal format specified by 69 <internalformat>, which must match <format> except when <target> is 70 TEXTURE_2D and <internalformat> is one of the following compressed 71 formats: COMPRESSED_RGB_S3TC_DXT1_NV, 72 COMPRESSED_RGBA_S3TC_DXT1_NV, COMPRESSED_RGBA_S3TC_DXT3_NV, or 73 COMPRESSED_RGBA_S3TC_DXT5_NV. In this case, conversion from only 74 RGB and RGBA formats are supported during texture image processing. 75 <format> values other than RBA or RGBA will result in the 76 INVALID_OPERATION error. In all other cases where <internalformat> 77 does not match <format>, the error INVALID_OPERATION is generated. 78 Table 3.8 summarizes the mapping of R, G, B, and A values to texture 79 components, as a function of the base internal format of the texture 80 image. <internalformat> may be one of the five internal format 81 symbolic constants listed in table 3.8 or the four compressed 82 formats: COMPRESSED_RGB_S3TC_DXT1_NV, 83 COMPRESSED_RGBA_S3TC_DXT1_NV, COMPRESSED_RGBA_S3TC_DXT3_NV, or 84 COMPRESSED_RGBA_S3TC_DXT5_NV. Specifying a value for 85 <internalformat> that is not one of the above values generates the 86 error INVALID_VALUE. When a compressed <internalformat> is 87 specified, a compressed texture is created and all the associated 88 restrictions mentioned in Section 3.7.3 are imposed. 89 90 Note that when encoding an RGBA image into a format using 1-bit 91 alpha, any texels with an alpha component less than 0.5 end up 92 with an alpha of 0.0 and any texels with an alpha component 93 greater than or equal to 0.5 end up with an alpha of 1.0. When 94 encoding an RGBA image into the COMPRESSED_RGBA_S3TC_DXT1_NV 95 format, the resulting red, green, and blue components of any 96 texels with a final alpha of 0.0 will automatically be zero 97 (black). If this behavior is not desired by an application, it 98 should not use COMPRESSED_RGBA_S3TC_DXT1_NV. 99 100 Modify Section 3.7.2, Alternate Texture Image Specification Commands 101 102 (add to the end of section) 103 104 When the internal format of the texture object is 105 COMPRESSED_RGB_S3TC_DXT1_NV, COMPRESSED_RGBA_S3TC_DXT1_NV, 106 COMPRESSED_RGBA_S3TC_DXT3_NV, or COMPRESSED_RGBA_S3TC_DXT5_NV, the 107 update region specified in TexSubImage2D must be aligned to 4x4 108 pixel blocks. If <xoffset> or <yoffset> are not multiples of 4 an 109 INVALID_OPERATION error is generated. If <width> is not a multiple 110 of 4 and <xoffset> + <width> is not equal to the width of the LOD 111 then an INVALID_OPERATION error is generated. If <height> is not 112 a multiple of 4 and <yoffset> + <height> is not equal to the 113 height of the LOD then an INVALID_OPERATION error is generated. 114 115Additions to Chapter 4 of the OpenGL ES 2.0.25 Specification (Per-Fragment 116Operations and the Framebuffer) 117 118 Modify Section 4.4.3, Attaching Texture Images to a Framebuffer 119 120 (add after last paragraph on Page 113) 121 122 If <texture> is not zero and the internal format of the 123 corresponding texture object is a compressed format, an 124 INVALID_OPERATION error is generated. 125 126Errors 127 128 INVALID_OPERATION is generated by TexImage2D and TexSubImage2D if 129 TEXTURE_INTERNAL_FORMAT is COMPRESSED_RGB_S3TC_DXT1_NV, 130 COMPRESSED_RGBA_S3TC_DXT1_NV, COMPRESSED_RGBA_S3TC_DXT3_NV, or 131 COMPRESSED_RGBA_S3TC_DXT5_NV and <format> is not RGB or RGBA. 132 133 If <xoffset> or <yoffset> are not multiples of 4 an 134 INVALID_OPERATION error is generated. 135 136 If <width> is not a multiple of 4 and <xoffset> + <width> is not 137 equal to the width of the LOD then an INVALID_OPERATION error is 138 generated. 139 140 If <height> is not a multiple of 4 and <yoffset> + <height> is not 141 equal to the height of the LOD then an INVALID_OPERATION error is 142 generated. 143 144Issues 145 146 1) Should sub-image updates be aligned to 4x4 pixel blocks? 147 148 RESOLUTION: Yes. Relaxing this restriction would otherwise require 149 CPU read-back of pixels at the 4x4 compression block boundary. 150 151 2) Should we support binding of compressed textures as render targets? 152 153 RESOLUTION: No. Writing to directly to compressed formats not 154 possible using hardware. Supporting this feature would involve 155 read-back of the texture and re-compression on the CPU, which would 156 be prohibitively slow. 157 158 3) Should we support mip map generation? 159 160 RESOLUTION: No. Mip map generation is not supported for compressed 161 textures. However, uploading to specific mip level is supported. 162 163Revision History 164 165 Rev. Date Author Changes 166 ---- -------- --------- ------------------------------------- 167 2 09/27/12 istewart Changed all EXT references to NV. 168 Added note about DXT1 alpha encoding. 169 Fixed TexSubImage2D error conditions. 170 1 04/06/11 mshah First revision. 171