15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    ARB_sparse_texture
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_ARB_sparse_texture
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContributors
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Graham Sellers, AMD
125bd8deadSopenharmony_ci    Pierre Boudier, AMD
135bd8deadSopenharmony_ci    Juraj Obert, AMD
145bd8deadSopenharmony_ci    Jeff Bolz, NVIDIA
155bd8deadSopenharmony_ci    Pat Brown, NVIDIA
165bd8deadSopenharmony_ci    ... +others TBD
175bd8deadSopenharmony_ci
185bd8deadSopenharmony_ciContact
195bd8deadSopenharmony_ci
205bd8deadSopenharmony_ci    Graham Sellers, AMD (graham.sellers 'at' amd.com)
215bd8deadSopenharmony_ci
225bd8deadSopenharmony_ciNotice
235bd8deadSopenharmony_ci
245bd8deadSopenharmony_ci    Copyright (c) 2013 The Khronos Group Inc. Copyright terms at
255bd8deadSopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
265bd8deadSopenharmony_ci
275bd8deadSopenharmony_ciSpecification Update Policy
285bd8deadSopenharmony_ci
295bd8deadSopenharmony_ci    Khronos-approved extension specifications are updated in response to
305bd8deadSopenharmony_ci    issues and bugs prioritized by the Khronos OpenGL Working Group. For
315bd8deadSopenharmony_ci    extensions which have been promoted to a core Specification, fixes will
325bd8deadSopenharmony_ci    first appear in the latest version of that core Specification, and will
335bd8deadSopenharmony_ci    eventually be backported to the extension document. This policy is
345bd8deadSopenharmony_ci    described in more detail at
355bd8deadSopenharmony_ci        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
365bd8deadSopenharmony_ci
375bd8deadSopenharmony_ciStatus
385bd8deadSopenharmony_ci
395bd8deadSopenharmony_ci    Complete. Approved by the ARB on June 3, 2013.
405bd8deadSopenharmony_ci    Ratified by the Khronos Board of Promoters on July 19, 2013.
415bd8deadSopenharmony_ci
425bd8deadSopenharmony_ciVersion
435bd8deadSopenharmony_ci
445bd8deadSopenharmony_ci    Last Modified Date:         05/11/2017
455bd8deadSopenharmony_ci    Revision:                   12
465bd8deadSopenharmony_ci
475bd8deadSopenharmony_ciNumber
485bd8deadSopenharmony_ci
495bd8deadSopenharmony_ci    ARB Extension #158
505bd8deadSopenharmony_ci
515bd8deadSopenharmony_ciDependencies
525bd8deadSopenharmony_ci
535bd8deadSopenharmony_ci    OpenGL 1.1 is required.
545bd8deadSopenharmony_ci
555bd8deadSopenharmony_ci    This extension is written against the OpenGL 4.3 (Core) Specification,
565bd8deadSopenharmony_ci    February 14, 2013.
575bd8deadSopenharmony_ci
585bd8deadSopenharmony_ci    The definition of this extension depends on GL_EXT_direct_state_access
595bd8deadSopenharmony_ci    and GL_ARB_direct_state_access.
605bd8deadSopenharmony_ci
615bd8deadSopenharmony_ciOverview
625bd8deadSopenharmony_ci
635bd8deadSopenharmony_ci    Recent advances in application complexity and a desire for higher
645bd8deadSopenharmony_ci    resolutions have pushed texture sizes up considerably. Often, the amount
655bd8deadSopenharmony_ci    of physical memory available to a graphics processor is a limiting factor
665bd8deadSopenharmony_ci    in the performance of texture-heavy applications. Once the available
675bd8deadSopenharmony_ci    physical memory is exhausted, paging may occur bringing performance down
685bd8deadSopenharmony_ci    considerably - or worse, the application may fail. Nevertheless, the amount
695bd8deadSopenharmony_ci    of address space available to the graphics processor has increased to the
705bd8deadSopenharmony_ci    point where many gigabytes - or even terabytes of address space may be
715bd8deadSopenharmony_ci    usable even though that amount of physical memory is not present.
725bd8deadSopenharmony_ci
735bd8deadSopenharmony_ci    This extension allows the separation of the graphics processor's address
745bd8deadSopenharmony_ci    space (reservation) from the requirement that all textures must be
755bd8deadSopenharmony_ci    physically backed (commitment). This exposes a limited form of
765bd8deadSopenharmony_ci    virtualization for textures. Use cases include sparse (or partially
775bd8deadSopenharmony_ci    resident) textures, texture paging, on-demand and delayed loading of
785bd8deadSopenharmony_ci    texture assets and application controlled level of detail.
795bd8deadSopenharmony_ci
805bd8deadSopenharmony_ciNew Procedures and Functions
815bd8deadSopenharmony_ci
825bd8deadSopenharmony_ci        void TexPageCommitmentARB(enum target,
835bd8deadSopenharmony_ci                                  int level,
845bd8deadSopenharmony_ci                                  int xoffset,
855bd8deadSopenharmony_ci                                  int yoffset,
865bd8deadSopenharmony_ci                                  int zoffset,
875bd8deadSopenharmony_ci                                  sizei width,
885bd8deadSopenharmony_ci                                  sizei height,
895bd8deadSopenharmony_ci                                  sizei depth,
905bd8deadSopenharmony_ci                                  boolean commit);
915bd8deadSopenharmony_ci
925bd8deadSopenharmony_ci        void TexturePageCommitmentEXT(uint texture,
935bd8deadSopenharmony_ci                                      int level,
945bd8deadSopenharmony_ci                                      int xoffset,
955bd8deadSopenharmony_ci                                      int yoffset,
965bd8deadSopenharmony_ci                                      int zoffset,
975bd8deadSopenharmony_ci                                      sizei width,
985bd8deadSopenharmony_ci                                      sizei height,
995bd8deadSopenharmony_ci                                      sizei depth,
1005bd8deadSopenharmony_ci                                      boolean commit);
1015bd8deadSopenharmony_ci
1025bd8deadSopenharmony_ci        [[ Note: TexturePageCommitmentEXT is supported if and only if 
1035bd8deadSopenharmony_ci           the EXT_direct_state_access or the ARB_direct_state_access extension
1045bd8deadSopenharmony_ci           is supported. ]]
1055bd8deadSopenharmony_ci
1065bd8deadSopenharmony_ciNew Tokens
1075bd8deadSopenharmony_ci
1085bd8deadSopenharmony_ci    Accepted by the <pname> parameter to TexParameter{i f}{v},
1095bd8deadSopenharmony_ci    TexParameterI{u}v, GetTexParameter{if}v and GetTexParameterIi{u}v:
1105bd8deadSopenharmony_ci
1115bd8deadSopenharmony_ci        TEXTURE_SPARSE_ARB                          0x91A6
1125bd8deadSopenharmony_ci        VIRTUAL_PAGE_SIZE_INDEX_ARB                 0x91A7
1135bd8deadSopenharmony_ci
1145bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetTexParameter{if}v and
1155bd8deadSopenharmony_ci    GetTexParameterIi{u}v:
1165bd8deadSopenharmony_ci
1175bd8deadSopenharmony_ci        NUM_SPARSE_LEVELS_ARB                       0x91AA
1185bd8deadSopenharmony_ci
1195bd8deadSopenharmony_ci    Accepted by the <pname> parameter to GetInternalformativ:
1205bd8deadSopenharmony_ci
1215bd8deadSopenharmony_ci        NUM_VIRTUAL_PAGE_SIZES_ARB                  0x91A8
1225bd8deadSopenharmony_ci
1235bd8deadSopenharmony_ci        VIRTUAL_PAGE_SIZE_X_ARB                     0x9195
1245bd8deadSopenharmony_ci        VIRTUAL_PAGE_SIZE_Y_ARB                     0x9196
1255bd8deadSopenharmony_ci        VIRTUAL_PAGE_SIZE_Z_ARB                     0x9197
1265bd8deadSopenharmony_ci
1275bd8deadSopenharmony_ci    Accepted by the <pname> parameter to GetIntegerv, GetFloatv, GetDoublev,
1285bd8deadSopenharmony_ci    GetInteger64v, and GetBooleanv:
1295bd8deadSopenharmony_ci
1305bd8deadSopenharmony_ci        MAX_SPARSE_TEXTURE_SIZE_ARB                 0x9198
1315bd8deadSopenharmony_ci        MAX_SPARSE_3D_TEXTURE_SIZE_ARB              0x9199
1325bd8deadSopenharmony_ci        MAX_SPARSE_ARRAY_TEXTURE_LAYERS_ARB         0x919A
1335bd8deadSopenharmony_ci        SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB  0x91A9
1345bd8deadSopenharmony_ci
1355bd8deadSopenharmony_ciAdditions to Chapter 8 of the OpenGL 4.3 (Core) Specification (Textures and
1365bd8deadSopenharmony_ciSamplers)
1375bd8deadSopenharmony_ci
1385bd8deadSopenharmony_ci    Add the "Supports Sparse Allocation" column to Table 8.12, "Sized internal
1395bd8deadSopenharmony_ci    color formats"
1405bd8deadSopenharmony_ci
1415bd8deadSopenharmony_ci        +-------------------------------+-------------------------------+
1425bd8deadSopenharmony_ci        | Sized Internal Format         | Supports Sparse Allocation    |
1435bd8deadSopenharmony_ci        +-------------------------------+-------------------------------+
1445bd8deadSopenharmony_ci        | R8                            | Y                             |
1455bd8deadSopenharmony_ci        | R8_SNORM                      | Y                             |
1465bd8deadSopenharmony_ci        | R16                           | Y                             |
1475bd8deadSopenharmony_ci        | R16_SNORM                     | Y                             |
1485bd8deadSopenharmony_ci        | RG8                           | Y                             |
1495bd8deadSopenharmony_ci        | RG8_SNORM                     | Y                             |
1505bd8deadSopenharmony_ci        | RG16                          | Y                             |
1515bd8deadSopenharmony_ci        | RG16_SNORM                    | Y                             |
1525bd8deadSopenharmony_ci        | R3_G3_B2                      |                               |
1535bd8deadSopenharmony_ci        | RGB4                          |                               |
1545bd8deadSopenharmony_ci        | RGB8                          |                               |
1555bd8deadSopenharmony_ci        | RGB565                        | Y                             |
1565bd8deadSopenharmony_ci        | RGB8                          |                               |
1575bd8deadSopenharmony_ci        | RGB8_SNORM                    |                               |
1585bd8deadSopenharmony_ci        | RGB10                         |                               |
1595bd8deadSopenharmony_ci        | RGB12                         |                               |
1605bd8deadSopenharmony_ci        | RGB16                         |                               |
1615bd8deadSopenharmony_ci        | RGB16_SNORM                   |                               |
1625bd8deadSopenharmony_ci        | RGBA2                         |                               |
1635bd8deadSopenharmony_ci        | RGBA4                         |                               |
1645bd8deadSopenharmony_ci        | RGB5_A1                       |                               |
1655bd8deadSopenharmony_ci        | RGBA8                         | Y                             |
1665bd8deadSopenharmony_ci        | RGBA8_SNORM                   | Y                             |
1675bd8deadSopenharmony_ci        | RGB10_A2                      | Y                             |
1685bd8deadSopenharmony_ci        | RGB10_A2UI                    | Y                             |
1695bd8deadSopenharmony_ci        | RGBA12                        |                               |
1705bd8deadSopenharmony_ci        | RGBA16                        | Y                             |
1715bd8deadSopenharmony_ci        | RGBA16_SNORM                  | Y                             |
1725bd8deadSopenharmony_ci        | SRGB8                         |                               |
1735bd8deadSopenharmony_ci        | SRGB8_ALPHA8                  |                               |
1745bd8deadSopenharmony_ci        | R16F                          | Y                             |
1755bd8deadSopenharmony_ci        | RG16F                         | Y                             |
1765bd8deadSopenharmony_ci        | RGB16F                        |                               |
1775bd8deadSopenharmony_ci        | RGBA16F                       | Y                             |
1785bd8deadSopenharmony_ci        | R32F                          | Y                             |
1795bd8deadSopenharmony_ci        | RG32F                         | Y                             |
1805bd8deadSopenharmony_ci        | RGB32F                        |                               |
1815bd8deadSopenharmony_ci        | RGBA32F                       | Y                             |
1825bd8deadSopenharmony_ci        | R11F_G11F_B10F                | Y                             |
1835bd8deadSopenharmony_ci        | RGB9_E5                       | Y                             |
1845bd8deadSopenharmony_ci        | R8I                           | Y                             |
1855bd8deadSopenharmony_ci        | R8UI                          | Y                             |
1865bd8deadSopenharmony_ci        | R16I                          | Y                             |
1875bd8deadSopenharmony_ci        | R16UI                         | Y                             |
1885bd8deadSopenharmony_ci        | R32I                          | Y                             |
1895bd8deadSopenharmony_ci        | R32UI                         | Y                             |
1905bd8deadSopenharmony_ci        | RG8I                          | Y                             |
1915bd8deadSopenharmony_ci        | RG8UI                         | Y                             |
1925bd8deadSopenharmony_ci        | RG16I                         | Y                             |
1935bd8deadSopenharmony_ci        | RG16UI                        | Y                             |
1945bd8deadSopenharmony_ci        | RG32I                         | Y                             |
1955bd8deadSopenharmony_ci        | RG32UI                        | Y                             |
1965bd8deadSopenharmony_ci        | RGB8I                         |                               |
1975bd8deadSopenharmony_ci        | RGB8UI                        |                               |
1985bd8deadSopenharmony_ci        | RGB16I                        |                               |
1995bd8deadSopenharmony_ci        | RGB16UI                       |                               |
2005bd8deadSopenharmony_ci        | RGB32I                        |                               |
2015bd8deadSopenharmony_ci        | RGB32UI                       |                               |
2025bd8deadSopenharmony_ci        | RGBA8I                        | Y                             |
2035bd8deadSopenharmony_ci        | RGBA8UI                       | Y                             |
2045bd8deadSopenharmony_ci        | RGBA16I                       | Y                             |
2055bd8deadSopenharmony_ci        | RGBA16UI                      | Y                             |
2065bd8deadSopenharmony_ci        | RGBA32I                       | Y                             |
2075bd8deadSopenharmony_ci        | RGBA32UI                      | Y                             |
2085bd8deadSopenharmony_ci        +-------------------------------+-------------------------------+
2095bd8deadSopenharmony_ci
2105bd8deadSopenharmony_ci    Insert the following paragraph before Table 8.16:
2115bd8deadSopenharmony_ci
2125bd8deadSopenharmony_ci        If <pname> is TEXTURE_SPARSE_ARB or VIRTUAL_PAGE_SIZE_INDEX_ARB, then
2135bd8deadSopenharmony_ci    the state is stored in the texture, but only takes effect the next time
2145bd8deadSopenharmony_ci    storage is allocated for a texture using TexStorage*. If the value of
2155bd8deadSopenharmony_ci    TEXTURE_IMMUTABLE_FORMAT is TRUE, then TEXTURE_SPARSE_ARB and
2165bd8deadSopenharmony_ci    VIRTUAL_PAGE_SIZE_INDEX_ARB cannot be changed and an error is generated.
2175bd8deadSopenharmony_ci
2185bd8deadSopenharmony_ci    Append to Table 8.16: "Texture parameters and their values."
2195bd8deadSopenharmony_ci
2205bd8deadSopenharmony_ci      +------------------------------+---------+---------------------------+
2215bd8deadSopenharmony_ci      | Name                         | Type    | Legal values              |
2225bd8deadSopenharmony_ci      +------------------------------+---------+---------------------------+
2235bd8deadSopenharmony_ci      | TEXTURE_SPARSE_ARB           | boolean | TRUE, FALSE               |
2245bd8deadSopenharmony_ci      | VIRTUAL_PAGE_SIZE_INDEX_ARB  | int     | any non-negative integer  |
2255bd8deadSopenharmony_ci      +------------------------------+---------+---------------------------+
2265bd8deadSopenharmony_ci
2275bd8deadSopenharmony_ci    Add to the Errors table for TexParameter*
2285bd8deadSopenharmony_ci
2295bd8deadSopenharmony_ci        INVALID_OPERATION is generated if <pname> is TEXTURE_SPARSE_ARB or
2305bd8deadSopenharmony_ci    VIRTUAL_PAGE_SIZE_INDEX_ARB and the value of TEXTURE_IMMUTABLE_FORMAT for
2315bd8deadSopenharmony_ci    the texture identified by <target> is TRUE.
2325bd8deadSopenharmony_ci
2335bd8deadSopenharmony_ci        INVALID_VALUE is generated if <pname> is TEXTURE_SPARSE_ARB, <pname>
2345bd8deadSopenharmony_ci    is TRUE and <target> is not one of TEXTURE_2D, TEXTURE_2D_ARRAY,
2355bd8deadSopenharmony_ci    TEXTURE_CUBE_MAP, TEXTURE_CUBE_MAP_ARRAY, TEXTURE_3D, or
2365bd8deadSopenharmony_ci    TEXTURE_RECTANGLE.
2375bd8deadSopenharmony_ci
2385bd8deadSopenharmony_ci    Additions to Section 8.18 of the OpenGL Specification, "Texture Views"
2395bd8deadSopenharmony_ci
2405bd8deadSopenharmony_ci        Texture views may be created that reference sparse textures (see
2415bd8deadSopenharmony_ci    Section 8.20.1), and in such cases, the view is considered to be sparse.
2425bd8deadSopenharmony_ci    Should a texture view reference part or all of the tail of a sparse
2435bd8deadSopenharmony_ci    texture, then modifications to the commitment of that tail via the view
2445bd8deadSopenharmony_ci    affect the tail of the parent texture and all other views that reference
2455bd8deadSopenharmony_ci    the tail, even for portions of the tail outside the controling view.
2465bd8deadSopenharmony_ci
2475bd8deadSopenharmony_ci    Additions to Section 8.19 of the OpenGL Specification, "Immutable-Format
2485bd8deadSopenharmony_ci    Texture Images"
2495bd8deadSopenharmony_ci
2505bd8deadSopenharmony_ci    Add the following bullet point to the list of psuedo-operations performed
2515bd8deadSopenharmony_ci    by all variants of TexStorage* (p.233):
2525bd8deadSopenharmony_ci
2535bd8deadSopenharmony_ci        * If TEXTURE_SPARSE_ARB is TRUE, only virtual address space is
2545bd8deadSopenharmony_ci          allocated for the texture but physical backing store is not.
2555bd8deadSopenharmony_ci          Physical store for pages of a virtual texture may be committed and
2565bd8deadSopenharmony_ci          decommitted by calling TexPageCommitmentARB. The page size chosen
2575bd8deadSopenharmony_ci          for the texture is taken from the texture's value of
2585bd8deadSopenharmony_ci          VIRTUAL_PAGE_SIZE_INDEX_ARB. In this case, <width>, <height> and
2595bd8deadSopenharmony_ci          <depth> must either be integer multiples of the selected virtual
2605bd8deadSopenharmony_ci          page size in the X, Y and Z dimensions, respectively, or be less
2615bd8deadSopenharmony_ci          than those dimensions. Additionally, the dimensions of sparse
2625bd8deadSopenharmony_ci          textures must be compatible with the chosen value of
2635bd8deadSopenharmony_ci          <internalFormat> as described in Section 8.20.1.
2645bd8deadSopenharmony_ci
2655bd8deadSopenharmony_ci    Add to the errors that may be generated by TexStorage*:
2665bd8deadSopenharmony_ci
2675bd8deadSopenharmony_ci        An INVALID_OPERATION error is generated if the texture's
2685bd8deadSopenharmony_ci        TEXTURE_SPARSE_ARB parameter is TRUE and the value of its
2695bd8deadSopenharmony_ci        VIRTUAL_PAGE_SIZE_INDEX_ARB parameter is greater than or equal to
2705bd8deadSopenharmony_ci        NUM_VIRTUAL_PAGE_SIZES_ARB for the specified target and internal
2715bd8deadSopenharmony_ci        format.
2725bd8deadSopenharmony_ci
2735bd8deadSopenharmony_ci        An INVALID_VALUE error is generated if the texture's TEXTURE_SPARSE_ARB
2745bd8deadSopenharmony_ci        parameter is TRUE and any of the following are true:
2755bd8deadSopenharmony_ci
2765bd8deadSopenharmony_ci          * <target> is TEXTURE_3D, and <width>, <height>, or <depth>
2775bd8deadSopenharmony_ci            is greater than MAX_SPARSE_3D_TEXTURE_SIZE_ARB;
2785bd8deadSopenharmony_ci
2795bd8deadSopenharmony_ci          * <target> is not TEXTURE_3D, and <width> or <height> is greater
2805bd8deadSopenharmony_ci            than MAX_SPARSE_TEXTURE_SIZE_ARB; or
2815bd8deadSopenharmony_ci
2825bd8deadSopenharmony_ci          * <target> is TEXTURE_2D_ARRAY or TEXTURE_CUBE_MAP_ARRAY and
2835bd8deadSopenharmony_ci            <depth> is greater than MAX_SPARSE_TEXTURE_ARRAY_LAYERS_ARB.
2845bd8deadSopenharmony_ci
2855bd8deadSopenharmony_ci        An INVALID_VALUE error is generated if the texture's
2865bd8deadSopenharmony_ci        TEXTURE_SPARSE_ARB parameter is TRUE and <width> or <height> is greater
2875bd8deadSopenharmony_ci        than the value of MAX_SPARSE_3D_TEXTURE_SIZE_ARB when <target> is
2885bd8deadSopenharmony_ci        TEXTURE_3D, or if <height> or <depth> is greater than the value of
2895bd8deadSopenharmony_ci        MAX_SPARSE_ARRAY_TEXTURE_LAYERS_ARB if <target> is a 1D or 2D array
2905bd8deadSopenharmony_ci        texture target, respectively.
2915bd8deadSopenharmony_ci
2925bd8deadSopenharmony_ci        An INVALID_VALUE error is generated if TEXTURE_SPARSE_ARB is TRUE and
2935bd8deadSopenharmony_ci        <width>, <height> or <depth> is is not an integer multiple of the
2945bd8deadSopenharmony_ci        page size in the corresponding dimension.
2955bd8deadSopenharmony_ci
2965bd8deadSopenharmony_ci        If the value of SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB is FALSE,
2975bd8deadSopenharmony_ci        then TexStorage* will generate an INVALID_OPERATION error if
2985bd8deadSopenharmony_ci
2995bd8deadSopenharmony_ci          * the texture's TEXTURE_SPARSE_ARB parameter is TRUE,
3005bd8deadSopenharmony_ci
3015bd8deadSopenharmony_ci          * <target> is one of TEXTURE_1D_ARRAY, TEXTURE_2D_ARRAY,
3025bd8deadSopenharmony_ci            TEXTURE_CUBE_MAP, or TEXTURE_CUBE_MAP_ARRAY, and
3035bd8deadSopenharmony_ci
3045bd8deadSopenharmony_ci          * for the virtual page size corresponding to the
3055bd8deadSopenharmony_ci            VIRTUAL_PAGE_SIZE_INDEX_ARB parameter, either of the following is
3065bd8deadSopenharmony_ci            true:
3075bd8deadSopenharmony_ci
3085bd8deadSopenharmony_ci              - <width> is not a multiple of VIRTUAL_PAGE_SIZE_X_ARB *
3095bd8deadSopenharmony_ci                 2^(<levels>-1), or
3105bd8deadSopenharmony_ci
3115bd8deadSopenharmony_ci              - <height> is not a multiple of VIRTUAL_PAGE_SIZE_Y_ARB *
3125bd8deadSopenharmony_ci                 2^(<levels>-1).
3135bd8deadSopenharmony_ci
3145bd8deadSopenharmony_ci    Insert Section 8.20, "Sparse Textures and Commitment" (p.238), renumber
3155bd8deadSopenharmony_ci    subsequent sections.
3165bd8deadSopenharmony_ci
3175bd8deadSopenharmony_ci        Textures may be allocated such that their images' physical backing
3185bd8deadSopenharmony_ci    store is only partially allocated. Only immutable format textures may
3195bd8deadSopenharmony_ci    be sparsely allocated. To allocate a sparse texture, set a texture's
3205bd8deadSopenharmony_ci    TEXTURE_SPARSE_ARB parameter to TRUE before allocating storage for it
3215bd8deadSopenharmony_ci    with TexStorage*.
3225bd8deadSopenharmony_ci
3235bd8deadSopenharmony_ci    Insert Subsection 8.20.1, "Allocation of and Access to Sparse Textures"
3245bd8deadSopenharmony_ci
3255bd8deadSopenharmony_ci        Sparse textures are allocated setting a texture's TEXTURE_SPARSE_ARB
3265bd8deadSopenharmony_ci    parameter to TRUE and then issuing one of the TexStorage* commands.
3275bd8deadSopenharmony_ci    The dimensions of a sparse texture must be compatible with the internal
3285bd8deadSopenharmony_ci    format chosen for the texture. Each internal format has zero or more
3295bd8deadSopenharmony_ci    sparse page sizes that may be selected. The number of available page sizes
3305bd8deadSopenharmony_ci    for an internal format and the dimensions of the pages may be determined
3315bd8deadSopenharmony_ci    by calling GetInternalFormat* with the <pname> NUM_VIRTUAL_PAGE_SIZES_ARB
3325bd8deadSopenharmony_ci    (for the number of available page sizes), VIRTUAL_PAGE_SIZE_X_ARB,
3335bd8deadSopenharmony_ci    VIRTUAL_PAGE_SIZE_Y_ARB or VIRTUAL_PAGE_SIZE_Z_ARB (for the virtual
3345bd8deadSopenharmony_ci    page widths, heights and depths, respectively). Not all internal formats
3355bd8deadSopenharmony_ci    support sparse allocation. For those formats, the value of
3365bd8deadSopenharmony_ci    NUM_VIRTUAL_PAGE_SIZES_ARB will be zero. The internal formats which are
3375bd8deadSopenharmony_ci    guaranteed to support sparse allocation is listed in Table 8.12. Formats
3385bd8deadSopenharmony_ci    not listed as supported in Table 8.12 may still be supported by some
3395bd8deadSopenharmony_ci    implementations.
3405bd8deadSopenharmony_ci
3415bd8deadSopenharmony_ci        The VIRTUAL_PAGE_SIZE_INDEX_ARB may be used to select the page layout for
3425bd8deadSopenharmony_ci    a sparse texture. The value of the texture's VIRTUAL_PAGE_SIZE_INDEX_ARB
3435bd8deadSopenharmony_ci    parameter is treated as an index into the array of possible page sizes
3445bd8deadSopenharmony_ci    for the type and requested internal format of the texture, and matches
3455bd8deadSopenharmony_ci    index of the array of values returned for the VIRTUAL_PAGE_SIZE_{XYZ}_ARB
3465bd8deadSopenharmony_ci    internal format query.
3475bd8deadSopenharmony_ci
3485bd8deadSopenharmony_ci        When a sparsely committed texture is accessed by the GL, accesses that
3495bd8deadSopenharmony_ci    require only samples contained in committed regions complete as normal.
3505bd8deadSopenharmony_ci    For operations that access samples from uncommitted regions produce
3515bd8deadSopenharmony_ci    the following behavior:
3525bd8deadSopenharmony_ci
3535bd8deadSopenharmony_ci        * Reads from such regions produce undefined data, but otherwise have
3545bd8deadSopenharmony_ci          no adverse effect. This includes samples required for the
3555bd8deadSopenharmony_ci          implementation of texture filtering, mipmap generation and so on.
3565bd8deadSopenharmony_ci
3575bd8deadSopenharmony_ci        * Writes to such regions are ignored. The GL may attempt to write to
3585bd8deadSopenharmony_ci          uncommitted regions but the effect of doing so will be benign.
3595bd8deadSopenharmony_ci
3605bd8deadSopenharmony_ci        * Atomic operations with return values on uncommitted regions will
3615bd8deadSopenharmony_ci          complete normally, but the returned value will be undefined and the
3625bd8deadSopenharmony_ci          result of the atomic operation will be discarded.
3635bd8deadSopenharmony_ci
3645bd8deadSopenharmony_ci        * Reads and writes through framebuffers shall have no adverse effect,
3655bd8deadSopenharmony_ci          but fragment shaders corresponding to uncommitted regions of the
3665bd8deadSopenharmony_ci          framebuffer still execute to completion. Visible side effects
3675bd8deadSopenharmony_ci          of these shaders such as operations on atomic counters, storage
3685bd8deadSopenharmony_ci          blocks or committed regions of images are still seen, as are
3695bd8deadSopenharmony_ci          the results of operations such as occlusion queries.
3705bd8deadSopenharmony_ci
3715bd8deadSopenharmony_ci        * Access to uncommitted regions by the client (for example through
3725bd8deadSopenharmony_ci          ReadPixels or GetTexImage) shall have similar effect as through any
3735bd8deadSopenharmony_ci          other part of the GL --- reads return undefined data and writes are
3745bd8deadSopenharmony_ci          discarded, with no other ill effect.
3755bd8deadSopenharmony_ci
3765bd8deadSopenharmony_ci    Insert Subsection 8.20.2. "Controlling Sparse Texture Commitment"
3775bd8deadSopenharmony_ci
3785bd8deadSopenharmony_ci        If a texture is allocated using sparse storage (that is, its
3795bd8deadSopenharmony_ci    TEXTURE_SPARSE_ARB parameter is TRUE) at the time that its storage is
3805bd8deadSopenharmony_ci    allocated, it is initially created with only a virtual data store, and no
3815bd8deadSopenharmony_ci    physical data store. Individual pages of a sparse texture may be made
3825bd8deadSopenharmony_ci    resident or non resident by calling
3835bd8deadSopenharmony_ci
3845bd8deadSopenharmony_ci        void TexPageCommitmentARB(enum target,
3855bd8deadSopenharmony_ci                                  int level,
3865bd8deadSopenharmony_ci                                  int xoffset,
3875bd8deadSopenharmony_ci                                  int yoffset,
3885bd8deadSopenharmony_ci                                  int zoffset,
3895bd8deadSopenharmony_ci                                  sizei width,
3905bd8deadSopenharmony_ci                                  sizei height,
3915bd8deadSopenharmony_ci                                  sizei depth,
3925bd8deadSopenharmony_ci                                  boolean commit);
3935bd8deadSopenharmony_ci
3945bd8deadSopenharmony_ci    with <target> and <level> indicating the level of the texture object whose
3955bd8deadSopenharmony_ci    residency is to be modified. <xoffset>, <yoffset>, <zoffset>, <width>,
3965bd8deadSopenharmony_ci    <height> and <depth> are interpreted as they are in TexSubImage3D.  An
3975bd8deadSopenharmony_ci    error will be generated unless <xoffset>, <yoffset> <zoffset>, <width>,
3985bd8deadSopenharmony_ci    <height> and <depth> specify a region of the texture level that is aligned
3995bd8deadSopenharmony_ci    to multiples of the page size or to the edges of the texture.
4005bd8deadSopenharmony_ci
4015bd8deadSopenharmony_ci    If the value of <commit> is TRUE, then the texture pages contained in
4025bd8deadSopenharmony_ci    the region defined by the values of <xoffset>, <yoffset>, <zoffset>,
4035bd8deadSopenharmony_ci    <width>, <height> and <depth> are committed. If they were not committed
4045bd8deadSopenharmony_ci    before the call, then new physical backing store is allocated and associated
4055bd8deadSopenharmony_ci    with the sparse pages and their initial content is undefined. If the pages
4065bd8deadSopenharmony_ci    were already committed, then they remain committed, no error is generated,
4075bd8deadSopenharmony_ci    and the content of those pages remains unmodified. If the value of
4085bd8deadSopenharmony_ci    <committed> is FALSE, then the texture pages contained in the region are
4095bd8deadSopenharmony_ci    made de-committed. Their physical store is de-allocated, and their contents
4105bd8deadSopenharmony_ci    again become undefined.
4115bd8deadSopenharmony_ci
4125bd8deadSopenharmony_ci    For the purposes of commitment, a cube map texture is treated as a 2D
4135bd8deadSopenharmony_ci    array texture with a depth of six and cube map array textures are treated
4145bd8deadSopenharmony_ci    as 2D array textures with a depth equal to six times the number of layers
4155bd8deadSopenharmony_ci    in the cube map array.
4165bd8deadSopenharmony_ci
4175bd8deadSopenharmony_ci    For levels of a sparse texture where each dimension is a multiple of the
4185bd8deadSopenharmony_ci    virtual page size, the residency of individual page-size regions is
4195bd8deadSopenharmony_ci    controlled by TexPageCommitmentARB and such levels may be partially
4205bd8deadSopenharmony_ci    populated.  When the mipmap chain reaches a level that is not an integer
4215bd8deadSopenharmony_ci    multiple of the virtual page size in any dimension, padding and memory
4225bd8deadSopenharmony_ci    layout considerations may make it impossible to treat that level and
4235bd8deadSopenharmony_ci    subsequent smaller ones as partially populated.  The set of levels that
4245bd8deadSopenharmony_ci    can be partially populated is implementation-dependent.  The total number
4255bd8deadSopenharmony_ci    of levels that may be partially populated may be queried by calling
4265bd8deadSopenharmony_ci    GetTexParameteriv with the <pname> NUM_SPARSE_LEVELS_ARB.
4275bd8deadSopenharmony_ci    
4285bd8deadSopenharmony_ci    The collection of texture levels that may not be partially populated, if
4295bd8deadSopenharmony_ci    any, consists of levels NUM_SPARSE_LEVELS_ARB and higher, and is referred
4305bd8deadSopenharmony_ci    to as the mipmap 'tail'.  The levels comprising the tail are made resident
4315bd8deadSopenharmony_ci    or non-resident as a unit.  The tail is resident if and only if
4325bd8deadSopenharmony_ci    TexPageCommitmentARB has been called successfully with <level> greater
4335bd8deadSopenharmony_ci    than or equal to NUM_SPARSE_LEVELS_ARB and the value of <commit> was TRUE
4345bd8deadSopenharmony_ci    for the last such call.
4355bd8deadSopenharmony_ci
4365bd8deadSopenharmony_ci    Views of sparse textures are also considered sparse. Modifications to
4375bd8deadSopenharmony_ci    commitment of a texture via a view of it affect the parent texture and
4385bd8deadSopenharmony_ci    any other views containing the modified pages. If a view of a sparse
4395bd8deadSopenharmony_ci    texture references its tail (or is entirely contained within it),
4405bd8deadSopenharmony_ci    modifications to commitment of the tail via the view will affect the entire
4415bd8deadSopenharmony_ci    tail of the parent, even for parts of the tail that are not referenced
4425bd8deadSopenharmony_ci    by the view. Furthermore, modifications to tail commitment may affect
4435bd8deadSopenharmony_ci    views referencing other parts of the tail.
4445bd8deadSopenharmony_ci
4455bd8deadSopenharmony_ci    Errors
4465bd8deadSopenharmony_ci
4475bd8deadSopenharmony_ci      An INVALID_OPERATION error is generated if <xoffset> + <width> or
4485bd8deadSopenharmony_ci      <yoffset> + <height> is greater than the width or height, respectively,
4495bd8deadSopenharmony_ci      of level <level> of the texture bound to <target>.
4505bd8deadSopenharmony_ci
4515bd8deadSopenharmony_ci      An INVALID_OPERATION error is generated if <zoffset> + <depth> is
4525bd8deadSopenharmony_ci      greater than
4535bd8deadSopenharmony_ci
4545bd8deadSopenharmony_ci        * the depth of level <level> of the texture bound to <target>, if
4555bd8deadSopenharmony_ci          <target> is TEXTURE_3D;
4565bd8deadSopenharmony_ci
4575bd8deadSopenharmony_ci        * the number of layers of level <level> of the texture bound to
4585bd8deadSopenharmony_ci          <target>, if <target> is TEXTURE_2D_ARRAY;
4595bd8deadSopenharmony_ci
4605bd8deadSopenharmony_ci        * six times the number of layers of level <level> of the texture bound
4615bd8deadSopenharmony_ci          to <target>, if <target> is TEXTURE_CUBE_MAP_ARRAY; or
4625bd8deadSopenharmony_ci
4635bd8deadSopenharmony_ci        * one, for all other targets.
4645bd8deadSopenharmony_ci
4655bd8deadSopenharmony_ci      An INVALID_VALUE error is generated if <xoffset>, <yoffset>, or
4665bd8deadSopenharmony_ci      <zoffset> is not a multiple of VIRTUAL_PAGE_SIZE_X_ARB,
4675bd8deadSopenharmony_ci      VIRTUAL_PAGE_SIZE_Y_ARB, or VIRTUAL_PAGE_SIZE_Z_ARB, respectively, of
4685bd8deadSopenharmony_ci      the texture bound to <target>.
4695bd8deadSopenharmony_ci
4705bd8deadSopenharmony_ci      An INVALID_OPERATION error is generated if <width> is not an integer
4715bd8deadSopenharmony_ci      multiple of VIRTUAL_PAGE_SIZE_X_ARB and <width> plus <xoffset> is not
4725bd8deadSopenharmony_ci      equal to the width of level <level> of the texture bound to <target>.
4735bd8deadSopenharmony_ci
4745bd8deadSopenharmony_ci      An INVALID_OPERATION error is generated if <height> is not an integer
4755bd8deadSopenharmony_ci      multiple of VIRTUAL_PAGE_SIZE_Y_ARB and <height> plus <yoffset> is not
4765bd8deadSopenharmony_ci      equal to the height of level <level> of the texture bound to <target>.
4775bd8deadSopenharmony_ci
4785bd8deadSopenharmony_ci      An INVALID_OPERATION error is generated if <depth> is not an integer
4795bd8deadSopenharmony_ci      multiple of VIRTUAL_PAGE_SIZE_Z_ARB and <depth> plus <zoffset> is not
4805bd8deadSopenharmony_ci      equal to
4815bd8deadSopenharmony_ci
4825bd8deadSopenharmony_ci        * the depth of level <level> of the texture bound to <target>, if
4835bd8deadSopenharmony_ci          <target> is TEXTURE_3D;
4845bd8deadSopenharmony_ci
4855bd8deadSopenharmony_ci        * the number of layers of level <level> of the texture bound to
4865bd8deadSopenharmony_ci          <target>, if <target> is TEXTURE_2D_ARRAY;
4875bd8deadSopenharmony_ci
4885bd8deadSopenharmony_ci        * six times the number of layers of level <level> of the texture bound
4895bd8deadSopenharmony_ci          to <target>, if <target> is TEXTURE_CUBE_MAP_ARRAY; or
4905bd8deadSopenharmony_ci
4915bd8deadSopenharmony_ci        * one, for all other targets.
4925bd8deadSopenharmony_ci
4935bd8deadSopenharmony_ci      An INVALID_OPERATION error is generated if the value of
4945bd8deadSopenharmony_ci      TEXTURE_IMMUTABLE_FORMAT or TEXTURE_SPARSE_ARB for the texture bound to
4955bd8deadSopenharmony_ci      <target> is FALSE.
4965bd8deadSopenharmony_ci
4975bd8deadSopenharmony_ci    [[ The following is only added if EXT_direct_state_access or
4985bd8deadSopenharmony_ci       ARB_direct_state_access is supported. ]]
4995bd8deadSopenharmony_ci
5005bd8deadSopenharmony_ci    The command
5015bd8deadSopenharmony_ci
5025bd8deadSopenharmony_ci        void TexturePageCommitmentEXT(uint texture,
5035bd8deadSopenharmony_ci                                      int level,
5045bd8deadSopenharmony_ci                                      int xoffset,
5055bd8deadSopenharmony_ci                                      int yoffset,
5065bd8deadSopenharmony_ci                                      int zoffset,
5075bd8deadSopenharmony_ci                                      sizei width,
5085bd8deadSopenharmony_ci                                      sizei height,
5095bd8deadSopenharmony_ci                                      sizei depth,
5105bd8deadSopenharmony_ci                                      boolean commit);
5115bd8deadSopenharmony_ci
5125bd8deadSopenharmony_ci    may also be used to control the residency of sparse textures.  This
5135bd8deadSopenharmony_ci    command behaves identically to TexPageCommitmentARB, except that the
5145bd8deadSopenharmony_ci    texture is identified by the name <texture> instead of via <target>.
5155bd8deadSopenharmony_ci
5165bd8deadSopenharmony_ci    Errors
5175bd8deadSopenharmony_ci
5185bd8deadSopenharmony_ci      An INVALID_OPERATION error is generated if <texture> is not the name of
5195bd8deadSopenharmony_ci      an existing texture.
5205bd8deadSopenharmony_ci
5215bd8deadSopenharmony_ci      All other errors listed for TexPageCommitmentARB also apply to
5225bd8deadSopenharmony_ci      TexturePageCommitmentEXT, except that references to "the texture bound
5235bd8deadSopenharmony_ci      to <target>" should be replaced with "the texture <texture>", and all
5245bd8deadSopenharmony_ci      other references to "<target>" should be replaced with "the target of
5255bd8deadSopenharmony_ci      texture <texture>".
5265bd8deadSopenharmony_ci
5275bd8deadSopenharmony_ci
5285bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications
5295bd8deadSopenharmony_ci
5305bd8deadSopenharmony_ci    None.
5315bd8deadSopenharmony_ci
5325bd8deadSopenharmony_ciGLX Protocol
5335bd8deadSopenharmony_ci
5345bd8deadSopenharmony_ci    None.
5355bd8deadSopenharmony_ci
5365bd8deadSopenharmony_ciNew State
5375bd8deadSopenharmony_ci
5385bd8deadSopenharmony_ci    Append to Table 23.15, "Textures (state per texture object) (cont.)"
5395bd8deadSopenharmony_ci
5405bd8deadSopenharmony_ci    +-----------------------------------+-------+---------------------+-----------------+---------------------------------------+-------+
5415bd8deadSopenharmony_ci    | Get Value                         | Type  | Get Command         | Initial Value   | Description                           | Sec.  |
5425bd8deadSopenharmony_ci    +-----------------------------------+-------+---------------------+-----------------+---------------------------------------+-------+
5435bd8deadSopenharmony_ci    | VIRTUAL_PAGE_SIZE_INDEX_ARB       | Z+    | GetTexParameteriv   | 0               | Virtual page size index               | 8.19  |
5445bd8deadSopenharmony_ci    | TEXTURE_SPARSE_ARB                | B     | GetTexParameteriv   | FALSE           | Texture sparseness                    | 8.19  |
5455bd8deadSopenharmony_ci    | NUM_SPARSE_LEVELS_ARB             | Z+    | GetTexParameteriv   | 0               | Number of potentially sparse levels   | 8.19  |
5465bd8deadSopenharmony_ci    +-----------------------------------+-------+---------------------+-----------------+---------------------------------------+-------+
5475bd8deadSopenharmony_ci
5485bd8deadSopenharmony_ciNew Implementation Dependent State
5495bd8deadSopenharmony_ci
5505bd8deadSopenharmony_ci    Append to Table 6.42, "Implementation Dependent Values"
5515bd8deadSopenharmony_ci
5525bd8deadSopenharmony_ci    +--------------------------------------------+-------+-------------+-----------------+---------------------------------------+-------+
5535bd8deadSopenharmony_ci    | Get Value                                  | Type  | Get Command | Minimum Value   | Description                           | Sec.  |
5545bd8deadSopenharmony_ci    +--------------------------------------------+-------+-------------+-----------------+---------------------------------------+-------+
5555bd8deadSopenharmony_ci    | MAX_SPARSE_TEXTURE_SIZE_ARB                | Z+    | GetIntegerv | 16384           | Maximum 1D/2D/rectangle texture image | 8.19  |
5565bd8deadSopenharmony_ci    |                                            |       |             |                 | dimension for a sparse texture.       |       |
5575bd8deadSopenharmony_ci    | MAX_SPARSE_3D_TEXTURE_SIZE_ARB             | Z+    | GetIntegerv | 2048            | Maximum 3D texture image dimension    | 8.19  |
5585bd8deadSopenharmony_ci    |                                            |       |             |                 | for a sparse texture.                 |       |
5595bd8deadSopenharmony_ci    | MAX_SPARSE_ARRAY_TEXTURE_LAYERS_ARB        | Z+    | GetIntegerv | 2048            | Maximum number of layers in a sparse  | 8.19  |
5605bd8deadSopenharmony_ci    |                                            |       |             |                 | array texture.                        |       |
5615bd8deadSopenharmony_ci    | SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB | B     | GetBooleanv | -               | TRUE if there are no restrictions on  | 8.19  |
5625bd8deadSopenharmony_ci    |                                            |       |             |                 | the allocation of mipmaps in sparse   |       |
5635bd8deadSopenharmony_ci    |                                            |       |             |                 | textures and FALSE otherwise.         |       |
5645bd8deadSopenharmony_ci    +--------------------------------------------+-------+-------------+-----------------+---------------------------------------+-------+
5655bd8deadSopenharmony_ci
5665bd8deadSopenharmony_ciDependencies on OpenGL 4.3 and ARB_texture_view
5675bd8deadSopenharmony_ci
5685bd8deadSopenharmony_ci    If the GL version is less than 4.3 or if ARB_texture_view is not supported,
5695bd8deadSopenharmony_ci    then remove all references to texture views.
5705bd8deadSopenharmony_ci
5715bd8deadSopenharmony_ciDependencies on GL_EXT_direct_state_access and GL_ARB_direct_state_access
5725bd8deadSopenharmony_ci
5735bd8deadSopenharmony_ci    If neither the GL_EXT_direct_state_access nor the
5745bd8deadSopenharmony_ci    GL_ARB_direct_state_access extensions is supported, remove all references
5755bd8deadSopenharmony_ci    to TexturePageCommitmentEXT.
5765bd8deadSopenharmony_ci
5775bd8deadSopenharmony_ciIssues
5785bd8deadSopenharmony_ci
5795bd8deadSopenharmony_ci    1) Do we want to mandate specific page sizes for specific formats?
5805bd8deadSopenharmony_ci
5815bd8deadSopenharmony_ci       RESOLVED. No.
5825bd8deadSopenharmony_ci
5835bd8deadSopenharmony_ci    2) What happened to MIN_SPARSE_LEVEL_AMD from the AMD spec? Do we need it
5845bd8deadSopenharmony_ci       here?
5855bd8deadSopenharmony_ci
5865bd8deadSopenharmony_ci       RESOLVED. We changed it to NUM_SPARSE_LEVELS_ARB. MIN_SPARSE_LEVEL_AMD
5875bd8deadSopenharmony_ci       could not acceptably describe the case where a texture is technically
5885bd8deadSopenharmony_ci       sparse, but no level of the texture may be sparsely populated. The
5895bd8deadSopenharmony_ci       AMD specification disallowed creation of such a texture. However, this
5905bd8deadSopenharmony_ci       extension does allow creation of a texture that is either wholly
5915bd8deadSopenharmony_ci       resident or non-resident. Furthermore, if a view of a sparse texture
5925bd8deadSopenharmony_ci       is created starting somewhere in the tail, then that whole view
5935bd8deadSopenharmony_ci       is essentially sparse.
5945bd8deadSopenharmony_ci
5955bd8deadSopenharmony_ci    3) Should it be mandatory to support sparse allocation for compressed
5965bd8deadSopenharmony_ci       textures?
5975bd8deadSopenharmony_ci
5985bd8deadSopenharmony_ci       RESOLVED: No, but in all likelihood, implementations will support some
5995bd8deadSopenharmony_ci       or all compressed texture formats.
6005bd8deadSopenharmony_ci
6015bd8deadSopenharmony_ci    4) Are multisample textures supported? What about depth and stencil
6025bd8deadSopenharmony_ci       format textures?
6035bd8deadSopenharmony_ci
6045bd8deadSopenharmony_ci       RESOLVED: No. Depth and stencil format textures are optional to support.
6055bd8deadSopenharmony_ci       Providing support would be a case of reporting non-zero for
6065bd8deadSopenharmony_ci       NUM_VIRTUAL_PAGE_SIZES_ARB for those formats. Multi-sample textures
6075bd8deadSopenharmony_ci       are explicitly not supported by this extension as their targets are
6085bd8deadSopenharmony_ci       excluded from TexStorage* support. Allowing support for these would
6095bd8deadSopenharmony_ci       require a new extension, if only to remove the error generated
6105bd8deadSopenharmony_ci       if one of the multi-sample targets is used with TexStorage* when
6115bd8deadSopenharmony_ci       the sparse flag is set.
6125bd8deadSopenharmony_ci
6135bd8deadSopenharmony_ci    5) Do we need language clarifying completeness and the effects of
6145bd8deadSopenharmony_ci       residency on completeness?
6155bd8deadSopenharmony_ci
6165bd8deadSopenharmony_ci       RESOLVED: Currently, there is no language. Textures allocated by
6175bd8deadSopenharmony_ci       TexStorage* (which include all sparse textures) are always complete.
6185bd8deadSopenharmony_ci       Residency doesn't effect that and sampling from them is well defined
6195bd8deadSopenharmony_ci       (or explicitly undefined).
6205bd8deadSopenharmony_ci
6215bd8deadSopenharmony_ci    6) Can commitment fail? What happens if it does?
6225bd8deadSopenharmony_ci
6235bd8deadSopenharmony_ci       RESOLVED: An OUT_OF_MEMORY error is generated if physical backing cannot
6245bd8deadSopenharmony_ci       be allocated for the previously allocated virtual space. No language
6255bd8deadSopenharmony_ci       is added here as it is implicit that any command can generate
6265bd8deadSopenharmony_ci       OUT_OF_MEMORY at any time for any reason... which includes new commands
6275bd8deadSopenharmony_ci       introduced here.
6285bd8deadSopenharmony_ci
6295bd8deadSopenharmony_ci    7) Please explain, in plain English, what the rules are governing the size
6305bd8deadSopenharmony_ci       of a texture's base level, mipmap levels, and the 'tail'.
6315bd8deadSopenharmony_ci
6325bd8deadSopenharmony_ci       The base level of the texture must be an integer multiple of the page
6335bd8deadSopenharmony_ci       size in each dimension. This need not be a power of two or square or
6345bd8deadSopenharmony_ci       anything of that nature. As we proceed along the mipmap chain, the
6355bd8deadSopenharmony_ci       current level will become smaller and smaller, at each step halving in
6365bd8deadSopenharmony_ci       size. At some point, the level dimensions will no longer be an integer
6375bd8deadSopenharmony_ci       multiple of the page size, where the memory corresponding to that level
6385bd8deadSopenharmony_ci       and smaller sized levels may not be evenly divided into pages.  The
6395bd8deadSopenharmony_ci       memory allocated to such levels may not be naturally aligned on memory
6405bd8deadSopenharmony_ci       page boundaries or may be too small to bother with partial residency.
6415bd8deadSopenharmony_ci       Implementations are permitted to treat such a level and all subsequent
6425bd8deadSopenharmony_ci       levels as either fully resident or fully non-resident.  We refer to
6435bd8deadSopenharmony_ci       this set of levels as the mipmap "tail".  The set of levels belonging
6445bd8deadSopenharmony_ci       to the tail is implementation-dependent.  Some implementations may
6455bd8deadSopenharmony_ci       start the tail at the first level where any dimension is not the
6465bd8deadSopenharmony_ci       multiple of a page size; others might pad out such allocations to page
6475bd8deadSopenharmony_ci       boundaries and start the tail at a much smaller mipmap level.  The tail
6485bd8deadSopenharmony_ci       is made resident or non-resident as a unit; the tail is resident if and
6495bd8deadSopenharmony_ci       only if <resident> was TRUE for the last call to TexPageCommitmentARB
6505bd8deadSopenharmony_ci       when <level> was any value in the tail.
6515bd8deadSopenharmony_ci
6525bd8deadSopenharmony_ci       Clearly, making the base level a square power of two multiple of the
6535bd8deadSopenharmony_ci       page size will mean that the greatest part of the texture can be sparse
6545bd8deadSopenharmony_ci       and will minimize the size of the tail. However, it's perfectly legal,
6555bd8deadSopenharmony_ci       with a hypothetical 256 x 256 texel page size to create a texture with
6565bd8deadSopenharmony_ci       a base level of 4096 x 256. Such a texture can be sparse in the base
6575bd8deadSopenharmony_ci       level, but level 1 would be 2048 x 128, which is no longer a multiple
6585bd8deadSopenharmony_ci       of the page size, and therefore might be considered as the start of the
6595bd8deadSopenharmony_ci       tail.
6605bd8deadSopenharmony_ci
6615bd8deadSopenharmony_ci    8) What's SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB for?
6625bd8deadSopenharmony_ci
6635bd8deadSopenharmony_ci       Some implementations may store the mipmap chain for array textures
6645bd8deadSopenharmony_ci       and cubemaps such that the presence and size of mipmaps affects the
6655bd8deadSopenharmony_ci       alignment of the start of each layer, even in the base level. Consider
6665bd8deadSopenharmony_ci       an implementation that stores all layers of of level 0, then all of
6675bd8deadSopenharmony_ci       level 1, then all of level 2 and so on. The presence of a mipmap chain
6685bd8deadSopenharmony_ci       (or lack thereof) would have no effect on the alignment of layers 1
6695bd8deadSopenharmony_ci       through N of the array (or cubemap faces). Now, consider an
6705bd8deadSopenharmony_ci       implementation that stores all of the levels for layer 0, then all
6715bd8deadSopenharmony_ci       levels of layer 1 and so on. The number and size of the levels of the
6725bd8deadSopenharmony_ci       texture _would_ have an effect on the alignment of layers 1 through N
6735bd8deadSopenharmony_ci       of the texture. If the size of the mipmap chain for a single layer
6745bd8deadSopenharmony_ci       causes the next layer to become misaligned to the page size in linear
6755bd8deadSopenharmony_ci       address space, then the texture cannot be sparsely populated. This flag
6765bd8deadSopenharmony_ci       indicates whether the implementation has any restrictions on the size
6775bd8deadSopenharmony_ci       of the mipmap chain. In particular, these restrictions ensure that,
6785bd8deadSopenharmony_ci       while the texture may have mipmaps, the total size of the mipmap chain
6795bd8deadSopenharmony_ci       for each level still satisfies the alignment restrictions required by
6805bd8deadSopenharmony_ci       that implementation's virtual memory subsystem.
6815bd8deadSopenharmony_ci
6825bd8deadSopenharmony_ci    9) What happens when you create a view of a sparse texture?
6835bd8deadSopenharmony_ci
6845bd8deadSopenharmony_ci       RESOLVED: That view is sparse, as are views of that view and so on.
6855bd8deadSopenharmony_ci       Also, if the view hits the tail, then modifications of tail residency
6865bd8deadSopenharmony_ci       via the view affect the whole tail of the parent texture.
6875bd8deadSopenharmony_ci
6885bd8deadSopenharmony_ci    10) Why is there no TexturePageCommitmentARB?
6895bd8deadSopenharmony_ci
6905bd8deadSopenharmony_ci       There was originally no documented interaction between this extension
6915bd8deadSopenharmony_ci       and ARB_direct_state_access. Since implementations that support both
6925bd8deadSopenharmony_ci       extensions were shipped without TexturePageCommitmentARB, it is not
6935bd8deadSopenharmony_ci       feasible to add this entry point after the fact. On the other hand,
6945bd8deadSopenharmony_ci       implementations that support both extensions but *not*
6955bd8deadSopenharmony_ci       EXT_direct_state_access should also be able to provide a DSA entry
6965bd8deadSopenharmony_ci       point. Since every known implementation that supports this extension and
6975bd8deadSopenharmony_ci       ARB_direct_state_access does have the TexturePageCommitmentEXT entry
6985bd8deadSopenharmony_ci       point, making this fact retroactively part of the spec is an unusual
6995bd8deadSopenharmony_ci       but pragmatic resolution.
7005bd8deadSopenharmony_ci
7015bd8deadSopenharmony_ciRevision History
7025bd8deadSopenharmony_ci
7035bd8deadSopenharmony_ci    Rev.    Date      Author    Changes
7045bd8deadSopenharmony_ci    ----  --------    --------  -----------------------------------------
7055bd8deadSopenharmony_ci    12    05/11/2017  nhaehnle  Add interaction with ARB_direct_state_access
7065bd8deadSopenharmony_ci                                (bug 13684)
7075bd8deadSopenharmony_ci    11    08/16/2013  pbrown    Remove the <target> parameter from the DSA
7085bd8deadSopenharmony_ci                                function TexturePageCommitmentEXT() and also
7095bd8deadSopenharmony_ci                                add more explicit error language.  The
7105bd8deadSopenharmony_ci                                parameter removal was agreed to before the
7115bd8deadSopenharmony_ci                                spec was published but didn't get added to the
7125bd8deadSopenharmony_ci                                shipping spec (bug 10445).  Add missing
7135bd8deadSopenharmony_ci                                RG8_SNORM and RG16 entries to the formats
7145bd8deadSopenharmony_ci                                table and list them as supporting sparse
7155bd8deadSopenharmony_ci                                textures (bug 10709).
7165bd8deadSopenharmony_ci    10    08/06/2013  pbrown    Add spec langauge for the VIRTUAL_PAGE_SIZE_
7175bd8deadSopenharmony_ci                                INDEX_ARB texture parameter.  Remove the
7185bd8deadSopenharmony_ci                                TexStorage error for a negative virtual page
7195bd8deadSopenharmony_ci                                size index, since that can be checked by
7205bd8deadSopenharmony_ci                                TexParameter.  Fix the errors section for the
7215bd8deadSopenharmony_ci                                offset and sizes in TexPageCommitmentARB (bug
7225bd8deadSopenharmony_ci                                10387) and remove duplicate introductory
7235bd8deadSopenharmony_ci                                language describing alignment requirements.
7245bd8deadSopenharmony_ci                                Clarify spec language and issue (7) describing
7255bd8deadSopenharmony_ci                                the implementation-dependent sparse mipmap
7265bd8deadSopenharmony_ci                                "tail" (bug 10353) and guarantee that any
7275bd8deadSopenharmony_ci                                level that is a multiple of the page size is
7285bd8deadSopenharmony_ci                                not in the tail.  Add spec language describing
7295bd8deadSopenharmony_ci                                TexturePageCommitmentEXT.  Add a few missing
7305bd8deadSopenharmony_ci                                "_ARB" suffixes.  Remove the "minimum maximum"
7315bd8deadSopenharmony_ci                                for SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB.
7325bd8deadSopenharmony_ci     9    07/08/2013  gsellers  Fix token value clash for
7335bd8deadSopenharmony_ci                                NUM_SPARSE_LEVELS_ARB.
7345bd8deadSopenharmony_ci     8    07/03/2013  gsellers  Change MIN_SPARSE_LEVEL_ARB to
7355bd8deadSopenharmony_ci                                NUM_SPARSE_LEVELS_ARB (new token value).
7365bd8deadSopenharmony_ci                                Add language to describe views of sparse
7375bd8deadSopenharmony_ci                                textures, including tail residency issues.
7385bd8deadSopenharmony_ci                                Add issue 9.
7395bd8deadSopenharmony_ci     7    06/13/2013  gsellers  Assign enums. Add MIN_SPARSE_LEVEL_ARB to
7405bd8deadSopenharmony_ci                                state table.
7415bd8deadSopenharmony_ci     6    06/07/2013  gsellers  Bring back MIN_SPARSE_LEVEL_ARB.
7425bd8deadSopenharmony_ci     5    06/06/2013  gsellers  Multiple updates from bugs 10186, 10329,
7435bd8deadSopenharmony_ci                                10131, and 10353.
7445bd8deadSopenharmony_ci     4    05/31/2013  gsellers  Resolve several issues from bug 10186.
7455bd8deadSopenharmony_ci     3    04/22/2013  gsellers  Add column to tables to indicate which formats
7465bd8deadSopenharmony_ci                                support sparse allocation.
7475bd8deadSopenharmony_ci                                Add requirement that the base level of a sparse
7485bd8deadSopenharmony_ci                                texture must be an integer multiple of the
7495bd8deadSopenharmony_ci                                selected virtual page size.
7505bd8deadSopenharmony_ci                                Document that the tail of a mip-chain becomes
7515bd8deadSopenharmony_ci                                completely resident at the same time.
7525bd8deadSopenharmony_ci     2    03/07/2013  gsellers  Major overhaul from AMD version. Deleted
7535bd8deadSopenharmony_ci                                most things. Added:
7545bd8deadSopenharmony_ci                                 * NUM_VIRTUAL_PAGE_SIZES_ARB
7555bd8deadSopenharmony_ci                                 * Set texture immutable state before calling
7565bd8deadSopenharmony_ci                                   TexStorage.
7575bd8deadSopenharmony_ci     1    01/21/2013  gsellers  Initial Revision based on AMD_sparse_texture
758