1Name 2 3 NV_sRGB_formats 4 5Name Strings 6 7 GL_NV_sRGB_formats 8 9Contributors 10 11 Contributors to ARB_framebuffer_sRGB and EXT_texture_sRGB 12 Mathias Heyer, NVIDIA 13 Jussi Rasanen, NVIDIA 14 Greg Roth, NVIDIA 15 16Contact 17 18 Greg Roth, NVIDIA (groth 'at' nvidia.com) 19 20Status 21 22 Complete 23 24Version 25 26 Date: 17 Jan, 2013 27 Revision: 5 28 29Number 30 31 OpenGL ES Extension #148 32 33Dependencies 34 35 OpenGL ES 2.0 is required. 36 37 This extension is written against the OpenGL ES 2.0.25 38 specification. 39 40 Requires EXT_sRGB. 41 42 OES_compressed_ETC1_RGB8_texture affects the definition of this 43 extension. 44 45 EXT_texture_storage affects the definition of this extension. 46 47 NV_texture_array affects the definition of this extension. 48 49 NV_texture_compression_s3tc affects the definition of this 50 extension. 51 52 NV_texture_compression_s3tc_update affects the definition of this 53 extension. 54 55Overview 56 57 This extension adds new uncompressed and compressed color texture 58 formats with nonlinear sRGB color components. 59 60 Luminance and luminance alpha provide support for textures 61 containing sRGB values with identical red, green, and blue 62 components. 63 64 Compressed texture formats using S3TC and ETC1 compression 65 algorithms are also added to provide compressed sRGB texture 66 options. 67 68 Finally, sized variant of sRGB, sLuminace, and sLuminance_alpha are 69 provided for immutable textures defined using the EXT_texture_storage 70 extension. 71 72New Procedures and Functions 73 74 None 75 76New Tokens 77 78 Accepted by the <format> and <internalformat> parameter of 79 TexImage2D, and TexImage3DNV. These are also accepted by <format> 80 parameter of TexSubImage2D and TexSubImage3DNV: 81 82 SLUMINANCE_NV 0x8C46 83 SLUMINANCE_ALPHA_NV 0x8C44 84 85 Accepted by the <internalformat> parameter of RenderbufferStorage, 86 TexStorage2DEXT, and TexStorage3DEXT: 87 SRGB8_NV 0x8C41 88 89 Accepted by the <internalformat> parameter of TexStorage2DEXT and 90 TexStorage3DEXT: 91 SLUMINANCE8_NV 0x8C47 92 SLUMINANCE8_ALPHA8_NV 0x8C45 93 94 Accepted by the <internalformat> parameters of TexImage2D, 95 TexImage3DNV, CompressedTexImage2D, and CompressedTexImage3DNV as 96 well as the <format> parameter of TexSubImage2D, TexSubImage3DNV, 97 CompressedTexSubImage2D, and CompressedTexSubImage3DNV: 98 99 COMPRESSED_SRGB_S3TC_DXT1_NV 0x8C4C 100 COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV 0x8C4D 101 COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV 0x8C4E 102 COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV 0x8C4F 103 104 Accepted by the <internalformat> parameter of CompressedTexImage2D, 105 and CompressedTexImage3DNV: 106 107 ETC1_SRGB8_NV 0x88EE 108 109Additions to Chapter 3 of the OpenGL ES 2.0.25 Specification 110(Rasterization) 111 112Modify Section 3.7.1, "Texture Image Specification": 113 114 Add 2 new rows to Table 3.3, "TexImage2D and ReadPixels formats": 115 116 Element Meaning 117 Format Name and Order Target Buffer 118 ---------------- --------------- ------------- 119 SLUMINANCE_NV Luminance Color 120 SLUMINANCE_ALPHA_NV Luminance, A Color 121 122 Add 2 new rows to Table 3.4, "Valid pixel format and type 123 combinations": 124 125 Format Type Bytes per Pixel 126 ---------------- --------------- --------------- 127 SLUMINANCE_NV UNSIGNED_BYTE 1 128 SLUMINANCE_ALPHA_NV UNSIGNED_BYTE 2 129 130 Add 2 new rows to "Valid combinations of format, type, and sized 131 internal-format" Table: 132 133 Internal Format Format Type 134 ---------------- -------- ------ 135 SLUMINANCE8_NV SLUMINANCE_NV UNSIGNED_BYTE 136 SLUMINANCE8_ALPHA8_NV SLUMINANCE_ALPHA_NV UNSIGNED_BYTE 137 138 139 Add 5 new rows to "Specific Compressed Internal Formats" Table 140 141 Compressed Internal Format Base Internal Format 142 ----------------------------------- -------------------- 143 COMPRESSED_SRGB_S3TC_DXT1_NV RGB 144 COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV RGBA 145 COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV RGBA 146 COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV RGBA 147 ETC1_SRGB8_NV RGB 148 149 Modify Section 3.7.2 "Alternate Texture Image Specification 150 Commands" 151 152 Modify the first sentence of the last paragraph (added by 153 NV_texture_compression_s3tc_update): 154 155 When the internal format of the texture object is 156 COMPRESSED_RGB_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT1_EXT, 157 COMPRESSED_RGBA_S3TC_DXT3_EXT, COMPRESSED_RGBA_S3TC_DXT5_EXT, 158 COMPRESSED_SRGB_S3TC_DXT1_NV, COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV 159 COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV, or COMPRESSED_SRGB_ALPHA_- 160 S3TC_DXT5_NV the update region specified in TexSubImage2D must be 161 aligned to 4x4 pixel blocks. ... 162 163 Modify Section 3.7.3 "Compressed Texture Images" 164 165 Add to the description of CompressedTexImage* 166 167 If <internalformat> is COMPRESSED_SRGB_S3TC_DXT1_NV, 168 COMPRESSED_SRGBA_S3TC_DXT1_NV, COMPRESSED_SRGBA_S3TC_DXT3_NV, or 169 COMPRESSED_SRGBA_S3TC_DXT5_NV, the compressed texture is stored 170 using one of several S3TC compressed texture image formats. The 171 S3TC texture compression algorithm supports only 2D images. 172 CompressedTexImage3DNV produce an INVALID_OPERATION error if 173 <internalformat> is an S3TC format and <target> is not TEXTURE_- 174 2D_ARRAY_NV. 175 176 If <internalformat> is ETC1_SRGB8_NV, the compressed texture is an 177 ETC1 compressed texture. 178 179 Change the penultimate paragraph describing CompressedTexSubImage* 180 (added by NV_texture_compression_s3tc): 181 182 If the internal format is one of COMPRESSED_RGB_S3TC_DXT1_NV, 183 COMPRESSED_RGBA_S3TC_DXT1_NV, COMPRESSED_RGBA_S3TC_DXT3_NV, 184 COMPRESSED_RGBA_S3TC_DXT5_NV, COMPRESSED_SRGBA_S3TC_DXT1_NV, 185 COMPRESSED_SRGBA_S3TC_DXT3_NV, or COMPRESSED_SRGBA_S3TC_DXT5_NV 186 the compressed texture is stored using one of several S3TC 187 compressed texture image formats ... 188 189 Modify Section 3.7.14, "sRGB Texture Color Conversion": 190 191 Change the first sentence to: 192 193 "If the currently bound texture's internal format is one 194 of SRGB_EXT, SRGB_ALPHA_EXT, SLUMINANCE_ALPHA_NV, SLUMINANCE_NV, 195 COMPRESSED_SRGB_S3TC_DXT1_NV, COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV, 196 COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV, COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV, 197 or ETC1_SRGB8_NV the red, green, and blue components are converted 198 from an sRGB color space to a linear color space as part of 199 filtering described in sections 3.7.7 and 3.7.8. ..." 200 201Additions to Chapter 4 of the OpenGL ES 2.0.25 Specification (Per- 202Fragment Operations and the Framebuffer) 203 204 The following should be added to table 4.5 "Renderbuffer Image 205 formats": 206 207 SRGB8_NV color_renderable 8 8 8 - - - 208 209Additions to Chapter 6 of the OpenGL ES 2.0.25 Specification (State and 210State Requests) 211 212 In section 6.1.3, modify the last sentence of the description of 213 GetFramebufferAttachmentParameteriv: 214 215 "... For framebuffer objects, components are sRGB-encoded if the 216 internal format of a color attachment is SRGB_EXT, SRGB8_NV, 217 SRGB_ALPHA_EXT, SRGB8_ALPHA8_EXT, SLUMINANCE_NV, SLUMINANCE8_NV, 218 SLUMINANCE_ALPHA_NV, SLUMINANCE8_ALPHA8_NV, COMPRESSED_SRGB_S3TC_- 219 DXT1_NV, COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV, COMPRESSED_SRGB_ALPHA_- 220 S3TC_DXT3_NV, COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV, or ETC1_SRGB8_NV." 221 222Dependencies on OES_compressed_ETC1_RGB8_texture 223 224 If OES_compressed_ETC1_RGB8_texture is not supported, ignore all 225 references to ETC1_SRGB8_NV. 226 227Dependencies on EXT_texture_storage 228 229 If EXT_texture_storage is not supported, ignore all references to 230 glTexStorage2DEXT and TexStorage3DEXT functions, additions to the 231 "Valid combinations of format, type, and sized internal-format" 232 Table, and LUMINANCE8_NV and LUMINANCE8_ALPHA8_NV tokens. 233 234Dependencies on NV_texture_array 235 236 If NV_texture_array is not supported, ignore all references to 237 TexImage3DNV, TexSubImage3DNV, CompressedTexImage3DNV, and 238 CompressedTexSubImage3DNV. 239 240Dependencies on NV_texture_compression_s3tc 241 242 If EXT_texture_compression_s3tc is not supported, ignore the new 243 COMPRESSED_*_S3TC_DXT* tokens, the additions to the "Compressed 244 Internal Format" table, errors related to the COMPRESSED_*_S3TC_DXT* 245 tokens, and related discussion. Also ignore edits to decription 246 of CompressedTexSubImage*. 247 248Dependencies on NV_texture_compression_s3tc_update 249 250 If NV_texture_compression_s3tc_update is not supported, passing 251 COMPRESSED_SRGB_NV, COMPRESSED_SRGB_ALPHA_NV, 252 COMPRESSED_SLUMINANCE_NV, COMPRESSED_SLUMINANCE_ALPHA_NV, 253 COMPRESSED_SRGB_S3TC_DXT1_NV, COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV, 254 COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV, or COMPRESSED_SRGB_ALPHA_S3TC_- 255 DXT5_NV to the <internalformat> parameter of TexImage2D, 256 TexImage3DNV, is not supported and will produce an INVALID_VALUE 257 258Errors 259 260 INVALID_OPERATION is generated by CompressedTexSubImage* if 261 <internalformat> is COMPRESSED_SRGB_S3TC_DXT1_NV, 262 COMPRESSED_SRGBA_S3TC_DXT1_NV, COMPRESSED_SRGBA_S3TC_DXT3_NV, or 263 COMPRESSED_SRGBA_S3TC_DXT5_NV and any of the following apply: 264 * <width> is not a multiple of four, and <width> plus 265 <xoffset> is not equal to the texture width; 266 * <height> is not a multiple of four, and <height> plus 267 <yoffset> is not equal to the texture height; or 268 * <xoffset> or <yoffset> is not a multiple of four. 269 270 INVALID_OPERATION is generated by CompressedTexImage3DNV if 271 <internalformat> is COMPRESSED_SRGB_S3TC_DXT1_NV, COMPRESSED_SRGB_- 272 ALPHA_S3TC_DXT1_NV, COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV, 273 COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV, or ETC1_SRGB8_NV and <target> is 274 not TEXTURE_IMAGE_2D_ARRAY_NV. 275 276 INVALID_OPERATION is generated by CompressedTexSubImage2D, 277 TexSubImage2D, CompressedTexSubImage3DNV, or TexSubImage3DNV, if the 278 texture image <level> bound to <target> has internal format 279 ETC1_SRGB8_NV. 280 281New State 282 283 None 284 285New Implementation Dependent State 286 287 None 288 289Issues 290 291 1) Should this be one extension or two? 292 293 RESOLVED: one. Desktop GL divided this functionality between 294 texture_sRGB and framebuffer_sRGB, but the ES extension EXT_sRGB 295 which took some features from each of those was only one. For 296 consistency with EXT_sRGB, this is a single extension. 297 298 2) Should inherently incomplete compressed sRGB texture attachments 299 still return sRGB for FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 300 queries? 301 302 RESOLVED: Yes. Just because they are incomplete doesn't mean they 303 aren't attached. Such a query might be performed to determine 304 why an FBO is incomplete. 305 306 3) Should formats for sRGB luminance values be supported? 307 308 RESOLVED: Yes. Implementations can always support luminance 309 and luminance-alpha sRGB formats as an RGB8 or RGBA8 format with 310 replicated R, G, and B values. 311 312 For lack of a better term, "SLUMINANCE" will be used within 313 token names to indicate sRGB values with identical red, green, 314 and blue components. 315 316 4) Should all component sizes be supported for sRGB components or 317 just 8-bit? 318 319 RESOLVED: Just 8-bit. For sRGB values with more than 8 bit of 320 precision, a linear representation may be easier to work with 321 and adequately represent dim values. Storing 5-bit and 6-bit 322 values in sRGB form is unnecessary because applications 323 sophisticated enough to sRGB to maintain color precision will 324 demand at least 8-bit precision for sRGB values. 325 326 Because hardware tables are required sRGB conversions, it doesn't 327 make sense to burden hardware with conversions that are unlikely 328 when 8-bit is the norm for sRGB values. 329 330 5) Should generic compressed sRGB formats be supported? 331 332 RESOLVED: Yes. Implementations are free simply to use 333 uncompressed sRGB formats to implement the GL_COMPRESSED_SRGB_* 334 formats. 335 336 6) Should S3TC compressed sRGB formats be supported? 337 338 RESOLVED: Yes, but only if EXT_texture_compression_s3tc is also 339 advertised. For competitive reasons, we expect OpenGL ES will 340 need an S3TC-based block compression format for sRGB data. 341 342 Rather than expose a separate "sRGB_compression" extension, 343 it makes more sense to specify a dependency between 344 EXT_texture_compression_s3tc and this extension such that when 345 BOTH extensions are exposed, the GL_COMPRESSED_SRGB*_S3TC_DXT*_NV 346 tokens are accepted. 347 348 We avoid explicitly requiring S3TC formats when EXT_texture_sRGB 349 is advertised to avoid IP encumbrances. 350 351 7) How is the texture border color handled for sRGB formats? 352 (Only relevant if NV_texture_border_clamp is supported. 353 354 RESOLVED: The texture border color is specified as four 355 floating-point values. Given that the texture border color can 356 be specified at such high precision, it is always treated as a 357 linear RGBA value. 358 359 Only texel components are converted from the sRGB encoding to a 360 linear RGB value ahead of texture filtering. The border color 361 can be used "as is" without any conversion. 362 363 By keeping the texture border color specified as a linear 364 RGB value at the API level allows developers to specify the 365 high-precision texture border color in a single consistent color 366 space without concern for how the sRGB conversion is implemented 367 in relation to filtering. 368 369 An implementation that does post-filtering sRGB conversion is 370 likely to convert the texture border color to sRGB within 371 the driver so it can be filtered with the sRGB values coming 372 from texels and then the filtered sRGB value is converted to 373 linear RGB. 374 375 By maintaining the texture border color always in linear RGB, 376 we avoid developers having to know if an implementation is 377 performing the sRGB conversion (ideally) pre-filtering or (less 378 ideally) post-filtering. 379 380 8) Should sRGB framebuffer support affect the pixel path? 381 382 RESOLVED: No. 383 384 sRGB conversion only applies to color reads for blending and 385 color writes. Color reads for glReadPixels have no sRGB 386 conversion applied. 387 388 389Revision History 390 391 Rev. Date Author Changes 392 ---- -------- --------- ------------------------------------- 393 5 17 Jan 2013 groth Add sized L and LA sRGB formats 394 Drastically flesh out interactions. 395 4 11 sep 2012 groth Further clarify interactions 396 3 21 Aug 2012 groth Reorganzied issues. Clarified some. 397 2 15 Aug 2012 groth Clarified mheyer feedback. 398 1 13 Aug 2012 groth Initial draft based off EXT_texture_sRGB 399