1Name 2 3 ARB_texture_storage 4 5Name Strings 6 7 GL_ARB_texture_storage 8 9Contact 10 11 Bruce Merry (bmerry 'at' gmail.com) 12 Ian Romanick, Intel (ian.d.romanick 'at' intel.com) 13 14Contributors 15 16 Jeremy Sandmel, Apple 17 Bruce Merry, ARM 18 Tom Olson, ARM 19 Benji Bowman, Imagination Technologies 20 Ian Romanick, Intel 21 Jeff Bolz, NVIDIA 22 Pat Brown, NVIDIA 23 Maurice Ribble, Qualcomm 24 Lingjun Chen, Qualcomm 25 Daniel Koch, Transgaming Inc 26 Mark Kilgard, NVIDIA 27 28Notice 29 30 Copyright (c) 2011-2013 The Khronos Group Inc. Copyright terms at 31 http://www.khronos.org/registry/speccopyright.html 32 33Specification Update Policy 34 35 Khronos-approved extension specifications are updated in response to 36 issues and bugs prioritized by the Khronos OpenGL Working Group. For 37 extensions which have been promoted to a core Specification, fixes will 38 first appear in the latest version of that core Specification, and will 39 eventually be backported to the extension document. This policy is 40 described in more detail at 41 https://www.khronos.org/registry/OpenGL/docs/update_policy.php 42 43Status 44 45 Complete. Approved by the ARB on 2011/06/20. 46 Approved by the Khronos Promoters on 2011/07/29. 47 48Version 49 50 Last Modified Date: August 7, 2013 51 Author Revision: 26 52 53Number 54 55 ARB Extension #117 56 57Dependencies 58 59 OpenGL ES 1.0, OpenGL ES 2.0 or OpenGL 1.2 is required. 60 61 OES_texture_npot, OES_texture_cube_map, OES_texture_3D, 62 OES_depth_texture, OES_packed_depth_stencil, 63 OES_compressed_paletted_texture, EXT_texture_type_2_10_10_10_REV, 64 EXT_texture3D, OES_texture_npot, APPLE_texture_2D_limited_npot, 65 ARB_texture_cube_map, ARB_texture_cube_map_array, 66 ARB_texture_rectangle, SGIS_generate_mipmap, 67 EXT_direct_state_access, OES_EGL_image, WGL_ARB_render_texture, 68 GLX_EXT_texture_from_pixmap, and core specifications that 69 incorporate these extensions affect the definition of this 70 extension. 71 72 This extension is written against the OpenGL 3.2 Core Profile 73 specification. 74 75Overview 76 77 The texture image specification commands in OpenGL allow each level 78 to be separately specified with different sizes, formats, types and 79 so on, and only imposes consistency checks at draw time. This adds 80 overhead for implementations. 81 82 This extension provides a mechanism for specifying the entire 83 structure of a texture in a single call, allowing certain 84 consistency checks and memory allocations to be done up front. Once 85 specified, the format and dimensions of the image array become 86 immutable, to simplify completeness checks in the implementation. 87 88 When using this extension, it is no longer possible to supply texture 89 data using TexImage*. Instead, data can be uploaded using TexSubImage*, 90 or produced by other means (such as render-to-texture, mipmap generation, 91 or rendering to a sibling EGLImage). 92 93 This extension has complicated interactions with other extensions. 94 The goal of most of these interactions is to ensure that a texture 95 is always mipmap complete (and cube complete for cubemap textures). 96 97IP Status 98 99 No known IP claims 100 101New Procedures and Functions 102 103 void TexStorage1D(enum target, sizei levels, 104 enum internalformat, 105 sizei width); 106 107 void TexStorage2D(enum target, sizei levels, 108 enum internalformat, 109 sizei width, sizei height); 110 111 void TexStorage3D(enum target, sizei levels, 112 enum internalformat, 113 sizei width, sizei height, sizei depth); 114 115 When EXT_direct_state_access is present: 116 117 void TextureStorage1DEXT(uint texture, enum target, sizei levels, 118 enum internalformat, 119 sizei width); 120 121 void TextureStorage2DEXT(uint texture, enum target, sizei levels, 122 enum internalformat, 123 sizei width, sizei height); 124 125 void TextureStorage3DEXT(uint texture, enum target, sizei levels, 126 enum internalformat, 127 sizei width, sizei height, sizei depth); 128 129New Types 130 131 None 132 133New Tokens 134 135 Accepted by the <value> parameter of GetTexParameter{if}v: 136 137 TEXTURE_IMMUTABLE_FORMAT 0x912F 138 139 Accepted by the <internalformat> parameter of TexStorage* when 140 implemented on OpenGL ES: 141 142 ALPHA8_EXT 0x803C 143 LUMINANCE8_EXT 0x8040 144 LUMINANCE8_ALPHA8_EXT 0x8045 145 146Additions to Chapter 2 of the OpenGL 3.2 Core Profile Specification 147(OpenGL Operation) 148 149 None 150 151Additions to Chapter 3 of the OpenGL 3.2 Core Profile Specification 152(Rasterization) 153 154 After section 3.8.1 (Texture Image Specification) add a new 155 subsection called "Immutable-format texture images": 156 157 "An alterative set of commands is provided for specifying the 158 properties of all levels of a texture at once. Once a texture is 159 specified with such a command, the format and dimensions of all 160 levels becomes immutable, unless it is a proxy texture (since 161 otherwise it would no longer be possible to use the proxy). The 162 contents of the images and the parameters can still be modified. 163 Such a texture is referred to as an "immutable-format" texture. The 164 immutability status of a texture can be determined by calling 165 GetTexParameter with <pname> TEXTURE_IMMUTABLE_FORMAT. 166 167 Each of the commands below is described by pseudo-code which 168 indicates the effect on the dimensions and format of the texture. 169 For all of the commands, the following apply in addition to the 170 pseudo-code: 171 172 - If the default texture object is bound to <target>, an 173 INVALID_OPERATION error is generated. 174 - If executing the pseudo-code would lead to an error, the error is 175 generated and the command will have no effect. 176 - Any existing levels that are not replaced are reset to their 177 initial state. 178 - If <width>, <height>, <depth> or <levels> is less than 1, the 179 error INVALID_VALUE is generated. 180 - The pixel unpack buffer should be considered to be zero i.e., 181 the image contents are unspecified. 182 - Since no pixel data are provided, the <format> and <type> values 183 used in the pseudo-code are irrelevant; they can be considered to 184 be any values that are legal to use with <internalformat>. 185 - If the command is successful, TEXTURE_IMMUTABLE_FORMAT becomes 186 TRUE. 187 - If <internalformat> is a specific compressed texture format, then 188 references to TexImage* should be replaced by CompressedTexImage*, 189 with <format>, <type> and <data> replaced by any valid <imageSize> and 190 <data>. If there is no <imageSize> for which this command would have 191 been valid, an INVALID_OPERATION error is generated [fn: This 192 condition is not required for OpenGL, but is necessary for OpenGL 193 ES which does not support on-the-fly compression.] 194 - If <internalformat> is one of the internal formats listed in table 195 3.11, an INVALID_ENUM error is generated. 196 197 The command 198 199 void TexStorage1D(enum target, sizei levels, 200 enum internalformat, 201 sizei width); 202 203 specifies all the levels of a one-dimensional texture (or proxy) at 204 the same time. It is described by the pseudo-code below: 205 206 for (i = 0; i < levels; i++) 207 { 208 TexImage1D(target, i, internalformat, width, 0, 209 format, type, NULL); 210 width = max(1, floor(width / 2)); 211 } 212 213 If <target> is not TEXTURE_1D or PROXY_TEXTURE_1D then INVALID_ENUM 214 is generated. If <levels> is greater than floor(log_2(width)) + 1 215 then INVALID_OPERATION is generated. 216 217 The command 218 219 void TexStorage2D(enum target, sizei levels, 220 enum internalformat, 221 sizei width, sizei height); 222 223 specifies all the levels of a two-dimensional, cube-map, 224 one-dimension array or rectangle texture (or proxy) at the same 225 time. The pseudo-code depends on the <target>: 226 227 [PROXY_]TEXTURE_2D, [PROXY_]TEXTURE_RECTANGLE or 228 PROXY_TEXTURE_CUBE_MAP: 229 230 for (i = 0; i < levels; i++) 231 { 232 TexImage2D(target, i, internalformat, width, height, 0, 233 format, type, NULL); 234 width = max(1, floor(width / 2)); 235 height = max(1, floor(height / 2)); 236 } 237 238 TEXTURE_CUBE_MAP: 239 240 for (i = 0; i < levels; i++) 241 { 242 for face in (+X, -X, +Y, -Y, +Z, -Z) 243 { 244 TexImage2D(face, i, internalformat, width, height, 0, 245 format, type, NULL); 246 } 247 width = max(1, floor(width / 2)); 248 height = max(1, floor(height / 2)); 249 } 250 251 [PROXY_]TEXTURE_1D_ARRAY: 252 253 for (i = 0; i < levels; i++) 254 { 255 TexImage2D(target, i, internalformat, width, height, 0, 256 format, type, NULL); 257 width = max(1, floor(width / 2)); 258 } 259 260 If <target> is not one of those listed above, the error INVALID_ENUM 261 is generated. 262 263 The error INVALID_OPERATION is generated if any of the following 264 conditions hold: 265 - <target> is [PROXY_]TEXTURE_1D_ARRAY and <levels> is greater than 266 floor(log_2(width)) + 1 267 - <target> is not [PROXY_]TEXTURE_1D_ARRAY and <levels> is greater 268 than floor(log_2(max(width, height))) + 1 269 270 The command 271 272 void TexStorage3D(enum target, sizei levels, enum internalformat, 273 sizei width, sizei height, sizei depth); 274 275 specifies all the levels of a three-dimensional, two-dimensional 276 array texture, or cube-map array texture (or proxy). The pseudo-code 277 depends on <target>: 278 279 [PROXY_]TEXTURE_3D: 280 281 for (i = 0; i < levels; i++) 282 { 283 TexImage3D(target, i, internalformat, width, height, depth, 0, 284 format, type, NULL); 285 width = max(1, floor(width / 2)); 286 height = max(1, floor(height / 2)); 287 depth = max(1, floor(depth / 2)); 288 } 289 290 [PROXY_]TEXTURE_2D_ARRAY, [PROXY_]TEXTURE_CUBE_MAP_ARRAY: 291 292 for (i = 0; i < levels; i++) 293 { 294 TexImage3D(target, i, internalformat, width, height, depth, 0, 295 format, type, NULL); 296 width = max(1, floor(width / 2)); 297 height = max(1, floor(height / 2)); 298 } 299 300 If <target> is not one of those listed above, the error INVALID_ENUM 301 is generated. 302 303 The error INVALID_OPERATION is generated if any of the following 304 conditions hold: 305 - <target> is [PROXY_]TEXTURE_3D and <levels> is greater than 306 floor(log_2(max(width, height, depth))) + 1 307 - <target> is [PROXY_]TEXTURE_2D_ARRAY or 308 [PROXY_]TEXTURE_CUBE_MAP_ARRAY and <levels> is greater than 309 floor(log_2(max(width, height))) + 1 310 311 After a successful call to any TexStorage* command with a non-proxy 312 target, the value of TEXTURE_IMMUTABLE_FORMAT for this texture 313 object is set to TRUE, and no further changes to the dimensions or 314 format of the texture object may be made. Other commands may only 315 alter the texel values and texture parameters. Using any of the 316 following commands with the same texture will result in the error 317 INVALID_OPERATION being generated, even if it does not affect the 318 dimensions or format: 319 320 - TexImage* 321 - CompressedTexImage* 322 - CopyTexImage* 323 - TexStorage* 324 325 The TextureStorage* commands operate identically to the 326 corresponding command where "Texture" is substituted for "Tex" 327 except, rather than updating the current bound texture for the 328 texture unit indicated by the current active texture state and the 329 target parameter, these "Texture" commands update the texture object 330 named by the initial texture parameter. The error INVALID_VALUE 331 is generated if <texture> is zero. 332 " 333 334 In section 3.8.6 (Texture Parameters), after the sentence 335 336 "In the remainder of section 3.8, denote by lod_min, lod_max, 337 level_base, and level_max the values of the texture parameters 338 TEXTURE_MIN_LOD, TEXTURE_MAX_LOD, TEXTURE_BASE_LEVEL, and 339 TEXTURE_MAX_LEVEL respectively." 340 341 add 342 343 "However, if TEXTURE_IMMUTABLE_FORMAT is 344 TRUE, then level_base is clamped to the range [0, <levels> - 1] and 345 level_max is then clamped to the range [level_base, <levels> - 1], 346 where <levels> is the parameter passed the call to TexStorage* for 347 the texture object. 348 349 In section 3.8.9 (Rendering feedback loops) replace all references 350 to TEXTURE_BASE_LEVEL by level_base. 351 352 In section 3.8.9 (Mipmapping), replace the paragraph starting "Each 353 array in a mipmap is defined..." by 354 355 "Each array in a mipmap is defined using TexImage3D, TexImage2D, 356 CopyTexImage2D, TexImage1D, CopyTexImage1D, or by functions that are 357 defined in terms of these functions. Level-of-detail numbers proceed 358 from level_base for the original texel array through the maximum 359 level p, with each unit increase indicating an array of half the 360 dimensions of the previous one (rounded down to the next integer if 361 fractional) as already described. For immutable-format textures, 362 p is one less than the <levels> parameter passed to TexStorage*; 363 otherwise p = floor(log_2(maxsize)) + level_base. All arrays from 364 level_base through q = min(p, level_max) must be defined, as 365 discussed in section 3.8.12." 366 367 In section 3.8.12 (Texture Completeness), modify the last sentence 368 to avoid refering to level_base and level_max: 369 370 "An implementation may allow a texture image array of level 1 or 371 greater to be created only if a mipmap complete set of image arrays 372 consistent with the requested array can be supported where the 373 values of TEXTURE_BASE_LEVEL and TEXTURE_MAX_LEVEL are 0 and 1000 374 respectively." 375 376 Modify section 3.8.13 (Texture State and Proxy State) to add the new 377 state: 378 379 "Each set consists of ..., and a boolean flag indicating whether the 380 format and dimensions of the texture are immutable." 381 382 Add 383 "The initial value of TEXTURE_IMMUTABLE_FORMAT is FALSE." 384 385Additions to Chapter 4 of the OpenGL 3.2 Core Profile Specification 386(Per-Fragment Operations and the Frame Buffer) 387 388 None 389 390Additions to Chapter 5 of the OpenGL 3.2 Compatibility Profile Specification 391(Special Functions) 392 393 In section 5.4.1 (Commands Not Usable in Display Lists), add 394 TexStorage* to the list of commands that cannot be used. 395 396Additions to Chapter 6 of the OpenGL 3.2 Core Profile Specification 397(State and State Requests) 398 399 Replace the following statement in 6.1.3 (Enumerated Queries): 400 401 "<value> must be one of the symbolic values in table 3.10." 402 403 with 404 405 "<value> must be TEXTURE_IMMUTABLE_FORMAT or one of the symbolic 406 values in table 3.22." 407 408Additions to the AGL/EGL/GLX/WGL Specifications 409 410 None 411 412Additions to OES_compressed_ETC1_RGB8_texture 413 414 Add the following to the additions to Chapter 3: 415 416 "Since ETC1 images are easily edited along 4x4 texel boundaries, the 417 limitations on CompressedTexSubImage2D are relaxed. 418 CompressedTexSubImage2D will result in an INVALID_OPERATION error 419 only if one of the following conditions occurs: 420 421 * <width> is not a multiple of four, and <width> plus <xoffset> is not 422 equal to the texture width; 423 424 * <height> is not a multiple of four, and <height> plus <yoffset> is 425 not equal to the texture height; or 426 427 * <xoffset> or <yoffset> is not a multiple of four. 428 429 Remove CompressedTexSubImage2D from this error: 430 431 "INVALID_OPERATION is generated by CompressedTexSubImage2D, 432 TexSubImage2D, or CopyTexSubImage2D if the texture image <level> 433 bound to <target> has internal format ETC1_RGB8_OES." 434 435 Add the following error: 436 437 "INVALID_OPERATION is generated by CompressedTexSubImage2D 438 if the region to be modified is not aligned to block boundaries 439 (refer to the extension text for details)." 440 441Additions to AMD_compressed_ATC_texture and AMD_compressed_3DC_texture: 442 443 Apply the same changes as for OES_compressed_ETC1_RGB8_texture 444 above, substituting the appropriate internal format tokens from 445 these extensions. 446 447Dependencies on EXT_direct_state_access 448 449 If EXT_direct_state_access is not present, references to 450 TextureStorage* should be ignored. 451 452Dependencies on OpenGL ES 453 454 On OpenGL ES without extensions introducing TEXTURE_MAX_LEVEL, 455 mipmapped textures specified with TexStorage are required to have a 456 full set of mipmaps. If TEXTURE_MAX_LEVEL is not supported, this 457 extension is modified as follows: 458 459 - Where an upper bound is placed on <levels> in this extension (i.e. 460 the maximum number of mipmap levels for a texture of the given 461 target and dimensions), an INVALID_OPERATION error is generated if 462 <levels> is neither 1 nor this upper bound. 463 - q (the effective maximum number of levels) is redefined to clamp 464 to the number of levels present in immutable-format textures. 465 466 OpenGL ES does not accept sized internal formats (e.g., RGBA8) and 467 instead derives an internal format from the <format> and <type> 468 parameters of TexImage2D. Since TexStorage* does not specify texel 469 data, the API doesn't include <format> and <type> parameters. 470 On an OpenGL ES implementation, the values in the <internalformat> 471 column in the tables below are accepted as <internalformat> 472 parameters, and base internal formats are not accepted. The 473 TexImage* calls in the TexStorage* pseudocode are modified so that 474 the <internalformat>, <format> and <type> parameters are 475 taken from the <format>, <format> and <type> columns (respectively) 476 in the tables below, according to the <internalformat> 477 specified in the TexStorage* command. 478 479 <internalformat> <format> <type> 480 ---------------- -------- ------ 481 RGB565 RGB UNSIGNED_SHORT_5_6_5 482 RGBA4 RGBA UNSIGNED_SHORT_4_4_4_4 483 RGB5_A1 RGBA UNSIGNED_SHORT_5_5_5_1 484 RGB8_OES RGB UNSIGNED_BYTE 485 RGBA8_OES RGBA UNSIGNED_BYTE 486 LUMINANCE8_ALPHA8_EXT LUMINANCE_ALPHA UNSIGNED_BYTE 487 LUMINANCE8_EXT LUMINANCE UNSIGNED_BYTE 488 ALPHA8_EXT ALPHA UNSIGNED_BYTE 489 490 If OES_depth_texture is supported: 491 492 <internalformat> <format> <type> 493 ---------------- -------- ------ 494 DEPTH_COMPONENT16_OES DEPTH_COMPONENT UNSIGNED_SHORT 495 DEPTH_COMPONENT32_OES DEPTH_COMPONENT UNSIGNED_INT 496 497 If OES_packed_depth_stencil is supported: 498 499 <internalformat> <format> <type> 500 ---------------- -------- ------ 501 DEPTH24_STENCIL8_OES DEPTH_STENCIL_OES UNSIGNED_INT 502 503 If EXT_texture_type_2_10_10_10_REV is supported: 504 505 <internalformat> <format> <type> 506 ---------------- -------- ------ 507 RGB10_A2_EXT RGBA UNSIGNED_INT_2_10_10_10_REV_EXT 508 RGB10_EXT RGB UNSIGNED_INT_2_10_10_10_REV_EXT 509 510Dependencies on texture targets 511 512 If a particular texture target is not supported by the 513 implementation, passing it as a <target> to TexStorage* will 514 generate an INVALID_ENUM error. If as a result, any of the commands 515 defined in this extension would no longer have any valid <target>, 516 all references to the command should be ignored. 517 518Dependencies on OES_texture_npot 519 520 If OpenGL ES 2.0 or APPLE_texture_2D_limited_npot is present but 521 OES_texture_npot is not present, then INVALID_OPERATION is 522 generated by TexStorage* and TexStorage3D if <levels> is 523 not one and <width>, <height> or <depth> is not a power of 524 two. 525 526Dependencies on WGL_ARB_render_texture, GLX_EXT_texture_from_pixmap, EGL 5271.4 and GL_OES_EGL_image 528 529 The commands eglBindTexImage, wglBindTexImageARB, glXBindTexImageEXT or 530 EGLImageTargetTexture2DOES are not permitted on an immutable-format 531 texture. 532 They will generate the following errors: 533 - EGLImageTargetTexture2DOES: INVALID_OPERATION 534 - eglBindTexImage: EGL_BAD_MATCH 535 - wglBindTexImage: ERROR_INVALID_OPERATION 536 - glXBindTexImageEXT: BadMatch 537 538Dependencies on OES_compressed_paletted_texture 539 540 The compressed texture formats exposed by 541 OES_compressed_paletted_texture are not supported by TexStorage*. 542 Passing one of these tokens to TexStorage* will generate an 543 INVALID_ENUM error. 544 545Errors 546 547 Note that dependencies above modify the errors. 548 549 If TexStorage* is called with a <width>, <height>, <depth> or 550 <levels> parameter that is less than one, then the error 551 INVALID_VALUE is generated. 552 553 If the <target> parameter to TexStorage1D is not 554 [PROXY_]TEXTURE_1D, then the error INVALID_ENUM is generated. 555 556 If the <target> parameter to TexStorage2D is not 557 [PROXY_]TEXTURE_2D, [PROXY_]TEXTURE_CUBE_MAP, 558 [PROXY_]TEXTURE_RECTANGLE or [PROXY_]TEXTURE_1D_ARRAY, then the 559 error INVALID_ENUM is generated. 560 561 If the <target> parameter to TexStorage3D is not 562 [PROXY_]TEXTURE_3D, [PROXY_]TEXTURE_2D_ARRAY or 563 [PROXY_]TEXTURE_CUBE_MAP_ARRAY then the error INVALID_ENUM is 564 generated. 565 566 If the <levels> parameter to TexStorage* is greater than the 567 <target>-specific value listed below then the error 568 INVALID_OPERATION is generated: 569 [PROXY_]TEXTURE_{1D,1D_ARRAY}: 570 floor(log_2(width)) + 1 571 [PROXY_]TEXTURE_{2D,2D_ARRAY,CUBE_MAP,CUBE_MAP_ARRAY}: 572 floor(log_2(max(width, height))) + 1 573 [PROXY_]TEXTURE_3D: 574 floor(log_2(max(width, height, depth))) + 1 575 [PROXY_]TEXTURE_RECTANGLE: 576 1 577 578 If the default texture object is bound to the <target> passed to 579 TexStorage*, then the error INVALID_OPERATION is generated. 580 581 If the <target> parameter to TextureStorage* does not match the 582 dimensionality of <texture>, then the error INVALID_OPERATION is 583 generated. 584 585 If the <texture> parameter to TextureStorage* is zero, then the 586 INVALID_VALUE is generated. 587 588 If any pseudo-code listed in this extension would generate an error, 589 then that error is generated. 590 591 Calling any of the following functions on a texture for which 592 TEXTURE_IMMUTABLE_FORMAT is TRUE will generate an 593 INVALID_OPERATION error: 594 - TexImage* 595 - CompressedTexImage* 596 - CopyTexImage* 597 598New State 599 600 Additions to Table 6.8 Textures (state per texture object) 601 602 Initial 603 Get Value Type Get Command Value Description Sec. 604 --------- ---- ----------- ------- ----------- ---- 605 TEXTURE_IMMUTABLE_FORMAT B GetTexParameter FALSE Size and format immutable 2.6 606 607New Implementation Dependent State 608 609 None 610 611Issues 612 613 1. What should this extension be called? 614 615 RESOLVED: EXT_texture_storage is chosen for consistency with the 616 glRenderbufferStorage entry point. 617 618 2. Should TexStorage* accept a border parameter? 619 620 RESOLVED: no. 621 622 DISCUSSION: Currently it does not, since borders are a deprecated 623 feature which is not supported by all hardware. Users of the 624 compatibility profile can continue to use the existing texture 625 specification functions, but there is an argument that users of 626 compatibility profile may also want to use this extension. 627 628 3. What is the correct error when <levels> specifies a partial 629 mipmap pyramid for OpenGL ES? 630 631 RESOLVED: INVALID_OPERATION, since it is an interaction between 632 parameters rather than a single value being invalid. It also makes 633 sense to relax this condition for desktop GL where it makes sense to 634 use a truncated pyramid with TEXTURE_MAX_LEVEL. 635 636 4. Should use of these entry-points make the metadata (format and 637 dimensions) immutable? 638 639 RESOLVED: Yes. 640 641 DISCUSSION: The benefits of knowing metadata can't change will 642 probably outweigh the extra cost of checking the 643 TEXTURE_IMMUTABLE_FORMAT flag on each texture specification 644 call. 645 646 5. Should it be legal to completely replace the texture using a new call 647 to TexStorage*? 648 649 RESOLVED. It will not be allowed. 650 651 DISCUSSION: This is useful to invalidate all levels of a texture. 652 Allowing the metadata to be changed here seems easier than trying to 653 define a portable definition of what it means to change the metadata 654 (e.g. what if you used an unsized internal format the first time and 655 the corresponding sized internal format the second time, or vice 656 versa)? 657 658 However, while this is largely similar to deleting the old texture 659 object and replacing it with a new one, it does lose some of the 660 advantages of immutability. Specifically, because doing so does not 661 reset bindings, it doesn't allow a migration path to an API that 662 validates the texture format at bind time. 663 664 6. Should it be legal to use TexImage* after TexStorage* if it doesn't 665 affect the metadata? 666 667 RESOLVED: No. 668 669 DISCUSSION: A potential use case is to allow a single level of a 670 texture to be invalidated using a NULL pointer. However, as noted 671 above it is non-trivial to determine what constitutes a change. 672 673 7. How does this extension interact with APPLE_texture_2D_limited_npot? 674 675 RESOLVED. APPLE_texture_2D_limited_npot is equivalent to the NPOT 676 support in OpenGL ES 2.0. 677 678 8. Should this extension be written to work with desktop OpenGL? 679 680 RESOLVED: Yes. 681 682 DISCUSSION: There has been been interest and it will future-proof it 683 against further additions to OpenGL ES. 684 685 9. Which texture targets should be supported? 686 687 RESOLVED. All targets except multisample and buffer textures are 688 supported. 689 690 Initially all targets except TEXTURE_BUFFER were supported. It was 691 noted that the entrypoints for multisample targets added no useful 692 functionality, since multisample textures have no completeness 693 checks beyond being non-empty. 694 695 Rectangle textures have completeness checks to prevent filtering of 696 integer textures. However, since we decided to only force mipmap 697 completeness, this becomes less useful. 698 699 10. Should this extension support proxy textures? 700 701 RESOLVED: Yes. 702 703 DISCUSSION: It should be orthogonal. 704 705 11. Are the <format> and <type> parameters necessary? 706 707 RESOLVED. No, they will be removed. 708 709 DISCUSSION: For OpenGL ES the type parameter was necessary to 710 determine the precision of the texture, but this can be solved by 711 having these functions accept sized internal formats (which are 712 already accepted by renderbuffers). 713 714 12. Should it be legal to make the default texture (id 0) 715 immutable-format? 716 717 RESOLVED: No. 718 719 DISCUSSION: This would make it impossible to restore the context to 720 it's default state, which is deemed undesirable. There is no good 721 reason not to use named texture objects. 722 723 13. Should we try to guarantee that textures made through this path 724 will always be complete? 725 726 RESOLVED: It should be guaranteed that the texture will be mipmap 727 complete. 728 729 DISCUSSION: Future separation between images and samplers will still 730 allow users to create combinations that are invalid, but 731 constraining the simple cases will make these APIs easier to use for 732 beginners. 733 734 14. Should these functions use a EXT_direct_state_access approach to 735 specifying the texture objects? 736 737 UNRESOLVED. 738 739 DISCUSSION: as a standalone extension, no DSA-like functions will be 740 added. However, interactions with EXT_direct_state_access and 741 ARB_direct_state_access need to be resolved. 742 743 15. Should these functions accept generic compressed formats? 744 745 RESOLVED: Yes. Note that the spec language will need to be modified 746 to allow this for ES, since the pseudocode is written in terms of 747 TexImage2D, which does not allow compressed texture formats in ES. 748 See also issues 23 and 27. 749 750 16. How should completeness be forced when TEXTURE_MAX_LEVEL is not 751 present? 752 753 RESOLVED. The maximum level q will be redefined to clamp to the 754 highest level available. 755 756 DISCUSSION: A single-level texture can be made complete either by 757 making it mipmap complete (by setting TEXTURE_MAX_LEVEL to 0) or by 758 turning off mipmapping (by choose an appropriate minification 759 filter). 760 761 Some options: 762 763 A: Specify that TexStorage* changes the default minification filter 764 for OpenGL ES. This makes it awkward to add TEXTURE_MAX_LEVEL 765 support to OpenGL ES later, since switching to match GL would break 766 compatibility. The two mechanisms also do not give identical 767 results, since the magnification threshold depends on the 768 minification filter. 769 770 B: Specify that the texture behaves as though TEXTURE_MAX_LEVEL were 771 zero. To specify this properly probably requires fairly intrusive 772 changes to the OpenGL ES full specification to add back all the 773 language relating to the max level. It also does not solve the 774 similar problem of what to do with NPOT textures; and it may have 775 hardware impacts due to the change in the min/mag crossover. 776 777 C: Specify that TexStorage* changes the default minification filter 778 for all implementations when a single-level texture is specified. 779 This may be slightly counter-intuitive to desktop GL users, but will 780 give consistent behaviour across variants of GL and avoids changing 781 the functional behaviour of this extension based on the presence or 782 absence of some other feature. 783 784 Currently B is specified. This has potential hardware implications 785 for OpenGL ES because of the effect of the minification filter on 786 the min/mag crossover. However, C has potential hardware implications 787 for OpenGL due to the separation of texture and sampler state. 788 789 17. How should completeness be forced when only ES2-style NPOT is 790 available? 791 792 RESOLVED. It is not worth trying to do this, in light of issue 13. 793 794 Previous revisions of this extension overrode the minification 795 filter and wrap modes, but that is no longer the case. Since 796 OES_texture_npot removes the caveats on NPOT textures anyway, it 797 might not be worth trying to "fix" this. 798 799 18. For OpenGL ES, how do the new sized internal formats interact 800 with OES_required_internal_format? 801 802 RESOLVED. 803 804 If OES_required_internal_format is not present, then the 805 <internalformat> parameter is intended merely to indicate what the 806 corresponding <format> and <type> would have been, had TexImage* 807 been used instead. If OES_required_internal_format is present, then 808 it is intended that the <internalformat> will be interpreted as if 809 it had been passed directly to TexImage*. 810 811 19. Should there be some hinting mechanism to indicate whether data 812 is coming immediately or later? 813 814 RESOLVED. No parameter is needed. An extension can be added to provide 815 a TexParameter value which is latched at TexStorage time. 816 817 DISCUSSION: Some members felt that this would be useful so that they 818 could defer allocation when suitable, particularly if higher- 819 resolution images will be streamed in later; or to choose a memory 820 type or layout appropriate to the usage. However, implementation 821 experience with BufferData is that developers frequently provide 822 wrong values and implementations have to guess anyway. 823 824 One option suggested was the <usage> parameter currently passed to 825 BufferData. Another option was to set it with TexParameter. 826 827 20. How should this extension interact with 828 EGLImageTargetTexture2DOES, eglBindTexImage, glXBindTexImage and 829 wglBindTexImage? 830 831 RESOLVED. These functions will not be permitted after glTexStorage*. 832 833 Several options are possible: 834 835 A) Disallow these functions. 836 B) Allow them, but have them reset the TEXTURE_IMMUTABLE_FORMAT 837 flag. 838 C) Allow them unconditionally. 839 840 C would violate the design principle that the dimensions and format 841 of the mipmap array are immutable. B does not so much modify the 842 dimension and formats as replace them with an entirely different 843 set. 844 845 21. Should there be a single function for specifying 1D, 2D and 3D 846 targets? 847 848 RESOLVED. No, we will stick with existing precedent. 849 850 22. Is it possible to use GenerateMipmap with an incomplete mipmap 851 pyramid? 852 853 RESOLVED. Yes, because the effective max level is limited to the 854 levels that were specified, and so GenerateMipmap does not generate 855 any new levels. 856 857 However, to make automatic mipmap generation work, it is necessary 858 to redefine p rather than q, since automatic mipmap generation 859 ignores the max level. 860 861 23. How should this extension interact with 862 OES_compressed_paletted_texture? 863 864 RESOLVED. Paletted textures will not be permitted, and will 865 generate INVALID_ENUM. 866 867 DISCUSSION: OES_compressed_paletted_texture supplies all the mipmaps 868 in a single function call, with the palette specified once. That's 869 incompatible with the upload model in this extension. 870 871 24. How can ETC1 textures be used with this extension? 872 873 RESOLVED. Add language in this extension to allow subregion uploads 874 for ETC1. 875 876 DISCUSSION: GL_OES_compressed_ETC1_RGB8_texture doesn't allow 877 CompressedTexSubImage*, so it would be impossible to use this 878 extension with ETC1. This is seen as an oversight in the ETC1 879 extension. While it cannot be fixed in that extension (since it is 880 already shipping), this extension can add that capability. 881 882 25. Should any other compressed formats be similarly modified? 883 884 RESOLVED. Yes, AMD_compressed_ATC_texture and 885 AMD_compressed_3DC_texture can be modified similarly to ETC1 886 (Maurice Ribble indicated that both formats use 4x4 blocks). Desktop 887 OpenGL requires that whole-image replacement is supported for any 888 compressed texture format, and the OpenGL ES extensions 889 EXT_texture_compression_dxt1 and IMG_texture_compression_pvrtc 890 already allow whole-image replacement, so it is not necessary to 891 modify them to be used with this extension. 892 893 26. Should these commands be permitted in display lists? 894 895 RESOLVED. No. 896 897 DISCUSSION: Display lists are most useful for repeating commands, 898 and TexStorage* commands cannot be repeated because the first call 899 makes the format immutable. 900 901 27. Should these commands accept unsized internal formats? 902 903 RESOLVED: No, for both OpenGL and OpenGL ES. 904 905 DISCUSSION: normally the <type> parameter to TexImage* can serve as 906 a hint to select a sized format (and in OpenGL ES, this is the only 907 mechanism available); since TexStorage* does not have a <type> 908 parameter, the implementation has no information on which to base a 909 decision. 910 911Revision History 912 913 Revision 26, 2013/08/07 (mjk) 914 - Better indicate DSA entrypoints 915 916 Revision 25, 2012/01/19 (bmerry) 917 - Clarify that the pixel unpack buffer has no effect. 918 919 Revision 24, 2011/11/10 (bmerry) 920 - Updated my contact details 921 922 Revision 23, 2011/07/25 (bmerry) 923 - Remove dangling references to MultiTexStorage in Errors section 924 925 Revision 22, 2011/07/21 (bmerry) 926 - Remove dangling reference to <samples> in Errors section 927 928 Revision 21, 2011/06/13 (dgkoch) 929 - restore EXT suffixes on TextureStorage commands since they are 930 additions to EXT_direct_state_access 931 - restore EXT suffixes on Alpha/Luminance tokens 932 933 Revision 20, 2011/06/13 (dgkoch) 934 - make ARB extension from EXT_texture_storage (rev 19) 935 936 Revision 19, 2011/05/02 (Jon Leech) 937 - Assign enum value 938 939 Revision 18, 2011/01/24 (bmerry) 940 - Disallow unsized internal formats (oversight in revision 17). 941 942 Revision 17, 2011/01/24 (bmerry) 943 - Added and resolved issue 26. 944 - Split issue 27 out from issue 15. 945 - Disallow TexStorage* in display lists. 946 - Use the term "immutable-format" consistently (bug 7281). 947 948 Revision 16, 2010/11/23 (bmerry) 949 - Disallowed TexStorage on an immutable-format texture 950 (resolves issue 5). 951 - Deleted MultiTexStorage* commands (other DSA functions still 952 unresolved). 953 - Some minor wording changes suggested by Pat Brown (bug 7002). 954 955 Revision 15, 2010/11/09 (bmerry) 956 - Reopened issue 5. 957 - Reopened issue 14, pending stabilisation of 958 ARB_direct_state_access. 959 - Marked issue 9 resolved, pending any objections. 960 - Fix references to no object being bound (was meant to refer to 961 the default object). 962 - Adding missing pseudocode for TEXTURE_1D_ARRAY. 963 - Corrected TEXTURE_2D_ARRAY -> TEXTURE_1D_ARRAY in error checks. 964 - Changed "levels... are removed" to "levels... are reset to their 965 init state", since desktop GL has per-level state apart from the 966 texels. 967 - Miscellaneous wording fixes. 968 969 Revision 14, 2010/09/25 (bmerry) 970 - Add issues 24-25 and alterations to 971 OES_compressed_ETC1_RGB8_texture, AMD_compressed_ATC_texture and 972 AMD_compressed_3DC_texture. 973 974 Revision 13, 2010/09/19 (bmerry) 975 - Two typo fixes from Daniel Koch 976 977 Revision 12, 2010/09/18 (bmerry) 978 - Changed resolution to issue 20 979 - Added and resolved issue 23 980 - Added explanation of how to upload data (in overview) 981 - Added spec language to implement resolution to issue 15 982 983 Revision 11, 2010/07/21 (bmerry) 984 - Resolved issue 16 985 - Reopen issue 20 986 - Fix some typos 987 988 Revision 10, 2010/07/15 (bmerry) 989 - Update some issues to match core text 990 - Resolved issue 17 991 992 Revision 9, 2010/05/24 (bmerry) 993 - Marked issue 2 as resolved 994 - Resolved issue 19 (as no change) 995 - Resolved issue 20 996 - Add issues 21-22 997 - Add in spec language to forbid use on default textures 998 - Redefine level_base, level_max to be clamped forms of 999 TEXTURE_BASE_LEVEL/TEXTURE_MAX_LEVEL when using immutable 1000 textures 1001 - Redefine p to also be clamped to the provided levels for 1002 immutable textures, to support automatic mipmap generation 1003 - Removed multisample functions 1004 - Removed language stating that texture parameters were reset to 1005 defaults 1006 1007 Revision 8, 2010/05/18 (bmerry) 1008 - Added issue about EGLimage 1009 - Marked issue 14 as resolved 1010 1011 Revision 7, 2010/05/04 (bmerry) 1012 - Removed some lingering <format>, <type> parameters to the new 1013 functions that should have been removed in revision 4 1014 - Trivial typo fixes 1015 1016 Revision 6, 2010/02/18 (bmerry) 1017 - Resolved issues 5, 6 and 18 1018 - Added MultiTexStorage* functions for DSA interaction 1019 - Added error for texture-target mismatch in DSA 1020 - Allowed TexStorage* to be called again 1021 1022 Revision 5, 2010/01/25 (bmerry) 1023 - Added to contributors list 1024 - Require OpenGL 1.2, to simplify interactions with 1025 TEXTURE_BASE_LEVEL/TEXTURE_MAX_LEVEL and CLAMP_TO_EDGE 1026 - Change default wrap modes to always be CLAMP_TO_EDGE 1027 - Change default filters to always be NEAREST 1028 - Moved language about generating new levels into an interaction, 1029 since it can only happen on OpenGL ES 1030 - Added interaction with EXT_direct_state_access 1031 - Added extra <internalformats> for GL ES when OES_depth_texture, 1032 OES_packed_depth_stencil and EXT_texture_type_2_10_10_10_REV are 1033 present. 1034 - Minor non-functional wording fixes and typos 1035 - Resolved issue 16 1036 - Added issues 17-19 1037 1038 Revision 4, 2010/01/13 (bmerry) 1039 - Changed suffix from ARM to EXT 1040 - Added list of contributors 1041 - Added language to force the texture to always be complete 1042 - Removed <format> and <type> arguments 1043 - Added issues 14-16 1044 - Reopened issue 2 1045 - Reformatted issues to separate resolution and discussion 1046 - Resolved issues 1, 9 and 11-13 1047 - Fixed the max number of levels in a cube map array 1048 1049 Revision 3, 2009/12/17 (bmerry) 1050 - Added missing vendor suffix to TEXTURE_IMMUTABLE_FORMAT_ARM 1051 - Rewritten to against desktop OpenGL 1052 - Added prototypes for 1D and multisample storage functions 1053 - Added issues 8-13 1054 1055 Revision 2, 2009/08/20 (bmerry) 1056 - Resolved issue 2 (no border parameter) 1057 - Resolved issue 4 (metadata becomes immutable) 1058 - Added interaction with OES_texture_cube_map 1059 - Added error if width != height in a cube map 1060 - Added issues 5-7 1061 1062 Revision 1, 2009/05/06 (bmerry) 1063 - First draft 1064