1Name 2 3 ARB_sparse_texture 4 5Name Strings 6 7 GL_ARB_sparse_texture 8 9Contributors 10 11 Graham Sellers, AMD 12 Pierre Boudier, AMD 13 Juraj Obert, AMD 14 Jeff Bolz, NVIDIA 15 Pat Brown, NVIDIA 16 ... +others TBD 17 18Contact 19 20 Graham Sellers, AMD (graham.sellers 'at' amd.com) 21 22Notice 23 24 Copyright (c) 2013 The Khronos Group Inc. Copyright terms at 25 http://www.khronos.org/registry/speccopyright.html 26 27Status 28 29 Complete. Approved by the ARB on June 3, 2013. 30 Ratified by the Khronos Board of Promoters on July 19, 2013. 31 32Version 33 34 Last Modified Date: 05/11/2017 35 Revision: 12 36 37Number 38 39 ARB Extension #158 40 41Dependencies 42 43 OpenGL 1.1 is required. 44 45 This extension is written against the OpenGL 4.3 (Core) Specification, 46 February 14, 2013. 47 48 The definition of this extension depends on GL_EXT_direct_state_access 49 and GL_ARB_direct_state_access. 50 51Overview 52 53 Recent advances in application complexity and a desire for higher 54 resolutions have pushed texture sizes up considerably. Often, the amount 55 of physical memory available to a graphics processor is a limiting factor 56 in the performance of texture-heavy applications. Once the available 57 physical memory is exhausted, paging may occur bringing performance down 58 considerably - or worse, the application may fail. Nevertheless, the amount 59 of address space available to the graphics processor has increased to the 60 point where many gigabytes - or even terabytes of address space may be 61 usable even though that amount of physical memory is not present. 62 63 This extension allows the separation of the graphics processor's address 64 space (reservation) from the requirement that all textures must be 65 physically backed (commitment). This exposes a limited form of 66 virtualization for textures. Use cases include sparse (or partially 67 resident) textures, texture paging, on-demand and delayed loading of 68 texture assets and application controlled level of detail. 69 70New Procedures and Functions 71 72 void TexPageCommitmentARB(enum target, 73 int level, 74 int xoffset, 75 int yoffset, 76 int zoffset, 77 sizei width, 78 sizei height, 79 sizei depth, 80 boolean commit); 81 82 void TexturePageCommitmentEXT(uint texture, 83 int level, 84 int xoffset, 85 int yoffset, 86 int zoffset, 87 sizei width, 88 sizei height, 89 sizei depth, 90 boolean commit); 91 92 [[ Note: TexturePageCommitmentEXT is supported if and only if 93 the EXT_direct_state_access or the ARB_direct_state_access extension 94 is supported. ]] 95 96New Tokens 97 98 Accepted by the <pname> parameter to TexParameter{i f}{v}, 99 TexParameterI{u}v, GetTexParameter{if}v and GetTexParameterIi{u}v: 100 101 TEXTURE_SPARSE_ARB 0x91A6 102 VIRTUAL_PAGE_SIZE_INDEX_ARB 0x91A7 103 104 Accepted by the <pname> parameter of GetTexParameter{if}v and 105 GetTexParameterIi{u}v: 106 107 NUM_SPARSE_LEVELS_ARB 0x91AA 108 109 Accepted by the <pname> parameter to GetInternalformativ: 110 111 NUM_VIRTUAL_PAGE_SIZES_ARB 0x91A8 112 113 VIRTUAL_PAGE_SIZE_X_ARB 0x9195 114 VIRTUAL_PAGE_SIZE_Y_ARB 0x9196 115 VIRTUAL_PAGE_SIZE_Z_ARB 0x9197 116 117 Accepted by the <pname> parameter to GetIntegerv, GetFloatv, GetDoublev, 118 GetInteger64v, and GetBooleanv: 119 120 MAX_SPARSE_TEXTURE_SIZE_ARB 0x9198 121 MAX_SPARSE_3D_TEXTURE_SIZE_ARB 0x9199 122 MAX_SPARSE_ARRAY_TEXTURE_LAYERS_ARB 0x919A 123 SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB 0x91A9 124 125Additions to Chapter 8 of the OpenGL 4.3 (Core) Specification (Textures and 126Samplers) 127 128 Add the "Supports Sparse Allocation" column to Table 8.12, "Sized internal 129 color formats" 130 131 +-------------------------------+-------------------------------+ 132 | Sized Internal Format | Supports Sparse Allocation | 133 +-------------------------------+-------------------------------+ 134 | R8 | Y | 135 | R8_SNORM | Y | 136 | R16 | Y | 137 | R16_SNORM | Y | 138 | RG8 | Y | 139 | RG8_SNORM | Y | 140 | RG16 | Y | 141 | RG16_SNORM | Y | 142 | R3_G3_B2 | | 143 | RGB4 | | 144 | RGB8 | | 145 | RGB565 | Y | 146 | RGB8 | | 147 | RGB8_SNORM | | 148 | RGB10 | | 149 | RGB12 | | 150 | RGB16 | | 151 | RGB16_SNORM | | 152 | RGBA2 | | 153 | RGBA4 | | 154 | RGB5_A1 | | 155 | RGBA8 | Y | 156 | RGBA8_SNORM | Y | 157 | RGB10_A2 | Y | 158 | RGB10_A2UI | Y | 159 | RGBA12 | | 160 | RGBA16 | Y | 161 | RGBA16_SNORM | Y | 162 | SRGB8 | | 163 | SRGB8_ALPHA8 | | 164 | R16F | Y | 165 | RG16F | Y | 166 | RGB16F | | 167 | RGBA16F | Y | 168 | R32F | Y | 169 | RG32F | Y | 170 | RGB32F | | 171 | RGBA32F | Y | 172 | R11F_G11F_B10F | Y | 173 | RGB9_E5 | Y | 174 | R8I | Y | 175 | R8UI | Y | 176 | R16I | Y | 177 | R16UI | Y | 178 | R32I | Y | 179 | R32UI | Y | 180 | RG8I | Y | 181 | RG8UI | Y | 182 | RG16I | Y | 183 | RG16UI | Y | 184 | RG32I | Y | 185 | RG32UI | Y | 186 | RGB8I | | 187 | RGB8UI | | 188 | RGB16I | | 189 | RGB16UI | | 190 | RGB32I | | 191 | RGB32UI | | 192 | RGBA8I | Y | 193 | RGBA8UI | Y | 194 | RGBA16I | Y | 195 | RGBA16UI | Y | 196 | RGBA32I | Y | 197 | RGBA32UI | Y | 198 +-------------------------------+-------------------------------+ 199 200 Insert the following paragraph before Table 8.16: 201 202 If <pname> is TEXTURE_SPARSE_ARB or VIRTUAL_PAGE_SIZE_INDEX_ARB, then 203 the state is stored in the texture, but only takes effect the next time 204 storage is allocated for a texture using TexStorage*. If the value of 205 TEXTURE_IMMUTABLE_FORMAT is TRUE, then TEXTURE_SPARSE_ARB and 206 VIRTUAL_PAGE_SIZE_INDEX_ARB cannot be changed and an error is generated. 207 208 Append to Table 8.16: "Texture parameters and their values." 209 210 +------------------------------+---------+---------------------------+ 211 | Name | Type | Legal values | 212 +------------------------------+---------+---------------------------+ 213 | TEXTURE_SPARSE_ARB | boolean | TRUE, FALSE | 214 | VIRTUAL_PAGE_SIZE_INDEX_ARB | int | any non-negative integer | 215 +------------------------------+---------+---------------------------+ 216 217 Add to the Errors table for TexParameter* 218 219 INVALID_OPERATION is generated if <pname> is TEXTURE_SPARSE_ARB or 220 VIRTUAL_PAGE_SIZE_INDEX_ARB and the value of TEXTURE_IMMUTABLE_FORMAT for 221 the texture identified by <target> is TRUE. 222 223 INVALID_VALUE is generated if <pname> is TEXTURE_SPARSE_ARB, <pname> 224 is TRUE and <target> is not one of TEXTURE_2D, TEXTURE_2D_ARRAY, 225 TEXTURE_CUBE_MAP, TEXTURE_CUBE_MAP_ARRAY, TEXTURE_3D, or 226 TEXTURE_RECTANGLE. 227 228 Additions to Section 8.18 of the OpenGL Specification, "Texture Views" 229 230 Texture views may be created that reference sparse textures (see 231 Section 8.20.1), and in such cases, the view is considered to be sparse. 232 Should a texture view reference part or all of the tail of a sparse 233 texture, then modifications to the commitment of that tail via the view 234 affect the tail of the parent texture and all other views that reference 235 the tail, even for portions of the tail outside the controling view. 236 237 Additions to Section 8.19 of the OpenGL Specification, "Immutable-Format 238 Texture Images" 239 240 Add the following bullet point to the list of psuedo-operations performed 241 by all variants of TexStorage* (p.233): 242 243 * If TEXTURE_SPARSE_ARB is TRUE, only virtual address space is 244 allocated for the texture but physical backing store is not. 245 Physical store for pages of a virtual texture may be committed and 246 decommitted by calling TexPageCommitmentARB. The page size chosen 247 for the texture is taken from the texture's value of 248 VIRTUAL_PAGE_SIZE_INDEX_ARB. In this case, <width>, <height> and 249 <depth> must either be integer multiples of the selected virtual 250 page size in the X, Y and Z dimensions, respectively, or be less 251 than those dimensions. Additionally, the dimensions of sparse 252 textures must be compatible with the chosen value of 253 <internalFormat> as described in Section 8.20.1. 254 255 Add to the errors that may be generated by TexStorage*: 256 257 An INVALID_OPERATION error is generated if the texture's 258 TEXTURE_SPARSE_ARB parameter is TRUE and the value of its 259 VIRTUAL_PAGE_SIZE_INDEX_ARB parameter is greater than or equal to 260 NUM_VIRTUAL_PAGE_SIZES_ARB for the specified target and internal 261 format. 262 263 An INVALID_VALUE error is generated if the texture's TEXTURE_SPARSE_ARB 264 parameter is TRUE and any of the following are true: 265 266 * <target> is TEXTURE_3D, and <width>, <height>, or <depth> 267 is greater than MAX_SPARSE_3D_TEXTURE_SIZE_ARB; 268 269 * <target> is not TEXTURE_3D, and <width> or <height> is greater 270 than MAX_SPARSE_TEXTURE_SIZE_ARB; or 271 272 * <target> is TEXTURE_2D_ARRAY or TEXTURE_CUBE_MAP_ARRAY and 273 <depth> is greater than MAX_SPARSE_TEXTURE_ARRAY_LAYERS_ARB. 274 275 An INVALID_VALUE error is generated if the texture's 276 TEXTURE_SPARSE_ARB parameter is TRUE and <width> or <height> is greater 277 than the value of MAX_SPARSE_3D_TEXTURE_SIZE_ARB when <target> is 278 TEXTURE_3D, or if <height> or <depth> is greater than the value of 279 MAX_SPARSE_ARRAY_TEXTURE_LAYERS_ARB if <target> is a 1D or 2D array 280 texture target, respectively. 281 282 An INVALID_VALUE error is generated if TEXTURE_SPARSE_ARB is TRUE and 283 <width>, <height> or <depth> is is not an integer multiple of the 284 page size in the corresponding dimension. 285 286 If the value of SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB is FALSE, 287 then TexStorage* will generate an INVALID_OPERATION error if 288 289 * the texture's TEXTURE_SPARSE_ARB parameter is TRUE, 290 291 * <target> is one of TEXTURE_1D_ARRAY, TEXTURE_2D_ARRAY, 292 TEXTURE_CUBE_MAP, or TEXTURE_CUBE_MAP_ARRAY, and 293 294 * for the virtual page size corresponding to the 295 VIRTUAL_PAGE_SIZE_INDEX_ARB parameter, either of the following is 296 true: 297 298 - <width> is not a multiple of VIRTUAL_PAGE_SIZE_X_ARB * 299 2^(<levels>-1), or 300 301 - <height> is not a multiple of VIRTUAL_PAGE_SIZE_Y_ARB * 302 2^(<levels>-1). 303 304 Insert Section 8.20, "Sparse Textures and Commitment" (p.238), renumber 305 subsequent sections. 306 307 Textures may be allocated such that their images' physical backing 308 store is only partially allocated. Only immutable format textures may 309 be sparsely allocated. To allocate a sparse texture, set a texture's 310 TEXTURE_SPARSE_ARB parameter to TRUE before allocating storage for it 311 with TexStorage*. 312 313 Insert Subsection 8.20.1, "Allocation of and Access to Sparse Textures" 314 315 Sparse textures are allocated setting a texture's TEXTURE_SPARSE_ARB 316 parameter to TRUE and then issuing one of the TexStorage* commands. 317 The dimensions of a sparse texture must be compatible with the internal 318 format chosen for the texture. Each internal format has zero or more 319 sparse page sizes that may be selected. The number of available page sizes 320 for an internal format and the dimensions of the pages may be determined 321 by calling GetInternalFormat* with the <pname> NUM_VIRTUAL_PAGE_SIZES_ARB 322 (for the number of available page sizes), VIRTUAL_PAGE_SIZE_X_ARB, 323 VIRTUAL_PAGE_SIZE_Y_ARB or VIRTUAL_PAGE_SIZE_Z_ARB (for the virtual 324 page widths, heights and depths, respectively). Not all internal formats 325 support sparse allocation. For those formats, the value of 326 NUM_VIRTUAL_PAGE_SIZES_ARB will be zero. The internal formats which are 327 guaranteed to support sparse allocation is listed in Table 8.12. Formats 328 not listed as supported in Table 8.12 may still be supported by some 329 implementations. 330 331 The VIRTUAL_PAGE_SIZE_INDEX_ARB may be used to select the page layout for 332 a sparse texture. The value of the texture's VIRTUAL_PAGE_SIZE_INDEX_ARB 333 parameter is treated as an index into the array of possible page sizes 334 for the type and requested internal format of the texture, and matches 335 index of the array of values returned for the VIRTUAL_PAGE_SIZE_{XYZ}_ARB 336 internal format query. 337 338 When a sparsely committed texture is accessed by the GL, accesses that 339 require only samples contained in committed regions complete as normal. 340 For operations that access samples from uncommitted regions produce 341 the following behavior: 342 343 * Reads from such regions produce undefined data, but otherwise have 344 no adverse effect. This includes samples required for the 345 implementation of texture filtering, mipmap generation and so on. 346 347 * Writes to such regions are ignored. The GL may attempt to write to 348 uncommitted regions but the effect of doing so will be benign. 349 350 * Atomic operations with return values on uncommitted regions will 351 complete normally, but the returned value will be undefined and the 352 result of the atomic operation will be discarded. 353 354 * Reads and writes through framebuffers shall have no adverse effect, 355 but fragment shaders corresponding to uncommitted regions of the 356 framebuffer still execute to completion. Visible side effects 357 of these shaders such as operations on atomic counters, storage 358 blocks or committed regions of images are still seen, as are 359 the results of operations such as occlusion queries. 360 361 * Access to uncommitted regions by the client (for example through 362 ReadPixels or GetTexImage) shall have similar effect as through any 363 other part of the GL --- reads return undefined data and writes are 364 discarded, with no other ill effect. 365 366 Insert Subsection 8.20.2. "Controlling Sparse Texture Commitment" 367 368 If a texture is allocated using sparse storage (that is, its 369 TEXTURE_SPARSE_ARB parameter is TRUE) at the time that its storage is 370 allocated, it is initially created with only a virtual data store, and no 371 physical data store. Individual pages of a sparse texture may be made 372 resident or non resident by calling 373 374 void TexPageCommitmentARB(enum target, 375 int level, 376 int xoffset, 377 int yoffset, 378 int zoffset, 379 sizei width, 380 sizei height, 381 sizei depth, 382 boolean commit); 383 384 with <target> and <level> indicating the level of the texture object whose 385 residency is to be modified. <xoffset>, <yoffset>, <zoffset>, <width>, 386 <height> and <depth> are interpreted as they are in TexSubImage3D. An 387 error will be generated unless <xoffset>, <yoffset> <zoffset>, <width>, 388 <height> and <depth> specify a region of the texture level that is aligned 389 to multiples of the page size or to the edges of the texture. 390 391 If the value of <commit> is TRUE, then the texture pages contained in 392 the region defined by the values of <xoffset>, <yoffset>, <zoffset>, 393 <width>, <height> and <depth> are committed. If they were not committed 394 before the call, then new physical backing store is allocated and associated 395 with the sparse pages and their initial content is undefined. If the pages 396 were already committed, then they remain committed, no error is generated, 397 and the content of those pages remains unmodified. If the value of 398 <committed> is FALSE, then the texture pages contained in the region are 399 made de-committed. Their physical store is de-allocated, and their contents 400 again become undefined. 401 402 For the purposes of commitment, a cube map texture is treated as a 2D 403 array texture with a depth of six and cube map array textures are treated 404 as 2D array textures with a depth equal to six times the number of layers 405 in the cube map array. 406 407 For levels of a sparse texture where each dimension is a multiple of the 408 virtual page size, the residency of individual page-size regions is 409 controlled by TexPageCommitmentARB and such levels may be partially 410 populated. When the mipmap chain reaches a level that is not an integer 411 multiple of the virtual page size in any dimension, padding and memory 412 layout considerations may make it impossible to treat that level and 413 subsequent smaller ones as partially populated. The set of levels that 414 can be partially populated is implementation-dependent. The total number 415 of levels that may be partially populated may be queried by calling 416 GetTexParameteriv with the <pname> NUM_SPARSE_LEVELS_ARB. 417 418 The collection of texture levels that may not be partially populated, if 419 any, consists of levels NUM_SPARSE_LEVELS_ARB and higher, and is referred 420 to as the mipmap 'tail'. The levels comprising the tail are made resident 421 or non-resident as a unit. The tail is resident if and only if 422 TexPageCommitmentARB has been called successfully with <level> greater 423 than or equal to NUM_SPARSE_LEVELS_ARB and the value of <commit> was TRUE 424 for the last such call. 425 426 Views of sparse textures are also considered sparse. Modifications to 427 commitment of a texture via a view of it affect the parent texture and 428 any other views containing the modified pages. If a view of a sparse 429 texture references its tail (or is entirely contained within it), 430 modifications to commitment of the tail via the view will affect the entire 431 tail of the parent, even for parts of the tail that are not referenced 432 by the view. Furthermore, modifications to tail commitment may affect 433 views referencing other parts of the tail. 434 435 Errors 436 437 An INVALID_OPERATION error is generated if <xoffset> + <width> or 438 <yoffset> + <height> is greater than the width or height, respectively, 439 of level <level> of the texture bound to <target>. 440 441 An INVALID_OPERATION error is generated if <zoffset> + <depth> is 442 greater than 443 444 * the depth of level <level> of the texture bound to <target>, if 445 <target> is TEXTURE_3D; 446 447 * the number of layers of level <level> of the texture bound to 448 <target>, if <target> is TEXTURE_2D_ARRAY; 449 450 * six times the number of layers of level <level> of the texture bound 451 to <target>, if <target> is TEXTURE_CUBE_MAP_ARRAY; or 452 453 * one, for all other targets. 454 455 An INVALID_VALUE error is generated if <xoffset>, <yoffset>, or 456 <zoffset> is not a multiple of VIRTUAL_PAGE_SIZE_X_ARB, 457 VIRTUAL_PAGE_SIZE_Y_ARB, or VIRTUAL_PAGE_SIZE_Z_ARB, respectively, of 458 the texture bound to <target>. 459 460 An INVALID_OPERATION error is generated if <width> is not an integer 461 multiple of VIRTUAL_PAGE_SIZE_X_ARB and <width> plus <xoffset> is not 462 equal to the width of level <level> of the texture bound to <target>. 463 464 An INVALID_OPERATION error is generated if <height> is not an integer 465 multiple of VIRTUAL_PAGE_SIZE_Y_ARB and <height> plus <yoffset> is not 466 equal to the height of level <level> of the texture bound to <target>. 467 468 An INVALID_OPERATION error is generated if <depth> is not an integer 469 multiple of VIRTUAL_PAGE_SIZE_Z_ARB and <depth> plus <zoffset> is not 470 equal to 471 472 * the depth of level <level> of the texture bound to <target>, if 473 <target> is TEXTURE_3D; 474 475 * the number of layers of level <level> of the texture bound to 476 <target>, if <target> is TEXTURE_2D_ARRAY; 477 478 * six times the number of layers of level <level> of the texture bound 479 to <target>, if <target> is TEXTURE_CUBE_MAP_ARRAY; or 480 481 * one, for all other targets. 482 483 An INVALID_OPERATION error is generated if the value of 484 TEXTURE_IMMUTABLE_FORMAT or TEXTURE_SPARSE_ARB for the texture bound to 485 <target> is FALSE. 486 487 [[ The following is only added if EXT_direct_state_access or 488 ARB_direct_state_access is supported. ]] 489 490 The command 491 492 void TexturePageCommitmentEXT(uint texture, 493 int level, 494 int xoffset, 495 int yoffset, 496 int zoffset, 497 sizei width, 498 sizei height, 499 sizei depth, 500 boolean commit); 501 502 may also be used to control the residency of sparse textures. This 503 command behaves identically to TexPageCommitmentARB, except that the 504 texture is identified by the name <texture> instead of via <target>. 505 506 Errors 507 508 An INVALID_OPERATION error is generated if <texture> is not the name of 509 an existing texture. 510 511 All other errors listed for TexPageCommitmentARB also apply to 512 TexturePageCommitmentEXT, except that references to "the texture bound 513 to <target>" should be replaced with "the texture <texture>", and all 514 other references to "<target>" should be replaced with "the target of 515 texture <texture>". 516 517 518Additions to the AGL/GLX/WGL Specifications 519 520 None. 521 522GLX Protocol 523 524 None. 525 526New State 527 528 Append to Table 23.15, "Textures (state per texture object) (cont.)" 529 530 +-----------------------------------+-------+---------------------+-----------------+---------------------------------------+-------+ 531 | Get Value | Type | Get Command | Initial Value | Description | Sec. | 532 +-----------------------------------+-------+---------------------+-----------------+---------------------------------------+-------+ 533 | VIRTUAL_PAGE_SIZE_INDEX_ARB | Z+ | GetTexParameteriv | 0 | Virtual page size index | 8.19 | 534 | TEXTURE_SPARSE_ARB | B | GetTexParameteriv | FALSE | Texture sparseness | 8.19 | 535 | NUM_SPARSE_LEVELS_ARB | Z+ | GetTexParameteriv | 0 | Number of potentially sparse levels | 8.19 | 536 +-----------------------------------+-------+---------------------+-----------------+---------------------------------------+-------+ 537 538New Implementation Dependent State 539 540 Append to Table 6.42, "Implementation Dependent Values" 541 542 +--------------------------------------------+-------+-------------+-----------------+---------------------------------------+-------+ 543 | Get Value | Type | Get Command | Minimum Value | Description | Sec. | 544 +--------------------------------------------+-------+-------------+-----------------+---------------------------------------+-------+ 545 | MAX_SPARSE_TEXTURE_SIZE_ARB | Z+ | GetIntegerv | 16384 | Maximum 1D/2D/rectangle texture image | 8.19 | 546 | | | | | dimension for a sparse texture. | | 547 | MAX_SPARSE_3D_TEXTURE_SIZE_ARB | Z+ | GetIntegerv | 2048 | Maximum 3D texture image dimension | 8.19 | 548 | | | | | for a sparse texture. | | 549 | MAX_SPARSE_ARRAY_TEXTURE_LAYERS_ARB | Z+ | GetIntegerv | 2048 | Maximum number of layers in a sparse | 8.19 | 550 | | | | | array texture. | | 551 | SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB | B | GetBooleanv | - | TRUE if there are no restrictions on | 8.19 | 552 | | | | | the allocation of mipmaps in sparse | | 553 | | | | | textures and FALSE otherwise. | | 554 +--------------------------------------------+-------+-------------+-----------------+---------------------------------------+-------+ 555 556Dependencies on OpenGL 4.3 and ARB_texture_view 557 558 If the GL version is less than 4.3 or if ARB_texture_view is not supported, 559 then remove all references to texture views. 560 561Dependencies on GL_EXT_direct_state_access and GL_ARB_direct_state_access 562 563 If neither the GL_EXT_direct_state_access nor the 564 GL_ARB_direct_state_access extensions is supported, remove all references 565 to TexturePageCommitmentEXT. 566 567Issues 568 569 1) Do we want to mandate specific page sizes for specific formats? 570 571 RESOLVED. No. 572 573 2) What happened to MIN_SPARSE_LEVEL_AMD from the AMD spec? Do we need it 574 here? 575 576 RESOLVED. We changed it to NUM_SPARSE_LEVELS_ARB. MIN_SPARSE_LEVEL_AMD 577 could not acceptably describe the case where a texture is technically 578 sparse, but no level of the texture may be sparsely populated. The 579 AMD specification disallowed creation of such a texture. However, this 580 extension does allow creation of a texture that is either wholly 581 resident or non-resident. Furthermore, if a view of a sparse texture 582 is created starting somewhere in the tail, then that whole view 583 is essentially sparse. 584 585 3) Should it be mandatory to support sparse allocation for compressed 586 textures? 587 588 RESOLVED: No, but in all likelihood, implementations will support some 589 or all compressed texture formats. 590 591 4) Are multisample textures supported? What about depth and stencil 592 format textures? 593 594 RESOLVED: No. Depth and stencil format textures are optional to support. 595 Providing support would be a case of reporting non-zero for 596 NUM_VIRTUAL_PAGE_SIZES_ARB for those formats. Multi-sample textures 597 are explicitly not supported by this extension as their targets are 598 excluded from TexStorage* support. Allowing support for these would 599 require a new extension, if only to remove the error generated 600 if one of the multi-sample targets is used with TexStorage* when 601 the sparse flag is set. 602 603 5) Do we need language clarifying completeness and the effects of 604 residency on completeness? 605 606 RESOLVED: Currently, there is no language. Textures allocated by 607 TexStorage* (which include all sparse textures) are always complete. 608 Residency doesn't effect that and sampling from them is well defined 609 (or explicitly undefined). 610 611 6) Can commitment fail? What happens if it does? 612 613 RESOLVED: An OUT_OF_MEMORY error is generated if physical backing cannot 614 be allocated for the previously allocated virtual space. No language 615 is added here as it is implicit that any command can generate 616 OUT_OF_MEMORY at any time for any reason... which includes new commands 617 introduced here. 618 619 7) Please explain, in plain English, what the rules are governing the size 620 of a texture's base level, mipmap levels, and the 'tail'. 621 622 The base level of the texture must be an integer multiple of the page 623 size in each dimension. This need not be a power of two or square or 624 anything of that nature. As we proceed along the mipmap chain, the 625 current level will become smaller and smaller, at each step halving in 626 size. At some point, the level dimensions will no longer be an integer 627 multiple of the page size, where the memory corresponding to that level 628 and smaller sized levels may not be evenly divided into pages. The 629 memory allocated to such levels may not be naturally aligned on memory 630 page boundaries or may be too small to bother with partial residency. 631 Implementations are permitted to treat such a level and all subsequent 632 levels as either fully resident or fully non-resident. We refer to 633 this set of levels as the mipmap "tail". The set of levels belonging 634 to the tail is implementation-dependent. Some implementations may 635 start the tail at the first level where any dimension is not the 636 multiple of a page size; others might pad out such allocations to page 637 boundaries and start the tail at a much smaller mipmap level. The tail 638 is made resident or non-resident as a unit; the tail is resident if and 639 only if <resident> was TRUE for the last call to TexPageCommitmentARB 640 when <level> was any value in the tail. 641 642 Clearly, making the base level a square power of two multiple of the 643 page size will mean that the greatest part of the texture can be sparse 644 and will minimize the size of the tail. However, it's perfectly legal, 645 with a hypothetical 256 x 256 texel page size to create a texture with 646 a base level of 4096 x 256. Such a texture can be sparse in the base 647 level, but level 1 would be 2048 x 128, which is no longer a multiple 648 of the page size, and therefore might be considered as the start of the 649 tail. 650 651 8) What's SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB for? 652 653 Some implementations may store the mipmap chain for array textures 654 and cubemaps such that the presence and size of mipmaps affects the 655 alignment of the start of each layer, even in the base level. Consider 656 an implementation that stores all layers of of level 0, then all of 657 level 1, then all of level 2 and so on. The presence of a mipmap chain 658 (or lack thereof) would have no effect on the alignment of layers 1 659 through N of the array (or cubemap faces). Now, consider an 660 implementation that stores all of the levels for layer 0, then all 661 levels of layer 1 and so on. The number and size of the levels of the 662 texture _would_ have an effect on the alignment of layers 1 through N 663 of the texture. If the size of the mipmap chain for a single layer 664 causes the next layer to become misaligned to the page size in linear 665 address space, then the texture cannot be sparsely populated. This flag 666 indicates whether the implementation has any restrictions on the size 667 of the mipmap chain. In particular, these restrictions ensure that, 668 while the texture may have mipmaps, the total size of the mipmap chain 669 for each level still satisfies the alignment restrictions required by 670 that implementation's virtual memory subsystem. 671 672 9) What happens when you create a view of a sparse texture? 673 674 RESOLVED: That view is sparse, as are views of that view and so on. 675 Also, if the view hits the tail, then modifications of tail residency 676 via the view affect the whole tail of the parent texture. 677 678 10) Why is there no TexturePageCommitmentARB? 679 680 There was originally no documented interaction between this extension 681 and ARB_direct_state_access. Since implementations that support both 682 extensions were shipped without TexturePageCommitmentARB, it is not 683 feasible to add this entry point after the fact. On the other hand, 684 implementations that support both extensions but *not* 685 EXT_direct_state_access should also be able to provide a DSA entry 686 point. Since every known implementation that supports this extension and 687 ARB_direct_state_access does have the TexturePageCommitmentEXT entry 688 point, making this fact retroactively part of the spec is an unusual 689 but pragmatic resolution. 690 691Revision History 692 693 Rev. Date Author Changes 694 ---- -------- -------- ----------------------------------------- 695 12 05/11/2017 nhaehnle Add interaction with ARB_direct_state_access 696 (bug 13684) 697 11 08/16/2013 pbrown Remove the <target> parameter from the DSA 698 function TexturePageCommitmentEXT() and also 699 add more explicit error language. The 700 parameter removal was agreed to before the 701 spec was published but didn't get added to the 702 shipping spec (bug 10445). Add missing 703 RG8_SNORM and RG16 entries to the formats 704 table and list them as supporting sparse 705 textures (bug 10709). 706 10 08/06/2013 pbrown Add spec langauge for the VIRTUAL_PAGE_SIZE_ 707 INDEX_ARB texture parameter. Remove the 708 TexStorage error for a negative virtual page 709 size index, since that can be checked by 710 TexParameter. Fix the errors section for the 711 offset and sizes in TexPageCommitmentARB (bug 712 10387) and remove duplicate introductory 713 language describing alignment requirements. 714 Clarify spec language and issue (7) describing 715 the implementation-dependent sparse mipmap 716 "tail" (bug 10353) and guarantee that any 717 level that is a multiple of the page size is 718 not in the tail. Add spec language describing 719 TexturePageCommitmentEXT. Add a few missing 720 "_ARB" suffixes. Remove the "minimum maximum" 721 for SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB. 722 9 07/08/2013 gsellers Fix token value clash for 723 NUM_SPARSE_LEVELS_ARB. 724 8 07/03/2013 gsellers Change MIN_SPARSE_LEVEL_ARB to 725 NUM_SPARSE_LEVELS_ARB (new token value). 726 Add language to describe views of sparse 727 textures, including tail residency issues. 728 Add issue 9. 729 7 06/13/2013 gsellers Assign enums. Add MIN_SPARSE_LEVEL_ARB to 730 state table. 731 6 06/07/2013 gsellers Bring back MIN_SPARSE_LEVEL_ARB. 732 5 06/06/2013 gsellers Multiple updates from bugs 10186, 10329, 733 10131, and 10353. 734 4 05/31/2013 gsellers Resolve several issues from bug 10186. 735 3 04/22/2013 gsellers Add column to tables to indicate which formats 736 support sparse allocation. 737 Add requirement that the base level of a sparse 738 texture must be an integer multiple of the 739 selected virtual page size. 740 Document that the tail of a mip-chain becomes 741 completely resident at the same time. 742 2 03/07/2013 gsellers Major overhaul from AMD version. Deleted 743 most things. Added: 744 * NUM_VIRTUAL_PAGE_SIZES_ARB 745 * Set texture immutable state before calling 746 TexStorage. 747 1 01/21/2013 gsellers Initial Revision based on AMD_sparse_texture 748