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