15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    ARB_sparse_buffer
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_ARB_sparse_buffer
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Graham Sellers (graham.sellers 'at' amd.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciContributors
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    Graham Sellers, AMD
165bd8deadSopenharmony_ci    Christophe Riccio, Unity
175bd8deadSopenharmony_ci
185bd8deadSopenharmony_ciNotice
195bd8deadSopenharmony_ci
205bd8deadSopenharmony_ci    Copyright (c) 2014 The Khronos Group Inc. Copyright terms at
215bd8deadSopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
225bd8deadSopenharmony_ci
235bd8deadSopenharmony_ciSpecification Update Policy
245bd8deadSopenharmony_ci
255bd8deadSopenharmony_ci    Khronos-approved extension specifications are updated in response to
265bd8deadSopenharmony_ci    issues and bugs prioritized by the Khronos OpenGL Working Group. For
275bd8deadSopenharmony_ci    extensions which have been promoted to a core Specification, fixes will
285bd8deadSopenharmony_ci    first appear in the latest version of that core Specification, and will
295bd8deadSopenharmony_ci    eventually be backported to the extension document. This policy is
305bd8deadSopenharmony_ci    described in more detail at
315bd8deadSopenharmony_ci        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
325bd8deadSopenharmony_ci
335bd8deadSopenharmony_ciStatus
345bd8deadSopenharmony_ci
355bd8deadSopenharmony_ci    Complete.
365bd8deadSopenharmony_ci    Approved by the ARB on June 26, 2014.
375bd8deadSopenharmony_ci    Ratified by the Khronos Board of Promoters on August 7, 2014.
385bd8deadSopenharmony_ci
395bd8deadSopenharmony_ciVersion
405bd8deadSopenharmony_ci
415bd8deadSopenharmony_ci    Last Modified Date:         5/31/2016
425bd8deadSopenharmony_ci    Author Revision:            4
435bd8deadSopenharmony_ci
445bd8deadSopenharmony_ciNumber
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ci    ARB Extension #172
475bd8deadSopenharmony_ci
485bd8deadSopenharmony_ciDependencies
495bd8deadSopenharmony_ci
505bd8deadSopenharmony_ci    OpenGL 4.4 is required.
515bd8deadSopenharmony_ci
525bd8deadSopenharmony_ci    This extension interacts with EXT_direct_state_access.
535bd8deadSopenharmony_ci
545bd8deadSopenharmony_ci    This extension interacts with ARB_direct_state_access.
555bd8deadSopenharmony_ci
565bd8deadSopenharmony_ci    This extension is written against the OpenGL 4.4 (core) specification.
575bd8deadSopenharmony_ci
585bd8deadSopenharmony_ciOverview
595bd8deadSopenharmony_ci
605bd8deadSopenharmony_ci    The ARB_sparse_texture extension adds to GL a mechanism to decouple the
615bd8deadSopenharmony_ci    virtual and physical storage requirements of textures and allows an
625bd8deadSopenharmony_ci    application to create partially populated textures that would
635bd8deadSopenharmony_ci    over-subscribe available graphics memory if made fully resident. This
645bd8deadSopenharmony_ci    extension provides like functionality for buffer objects, allowing
655bd8deadSopenharmony_ci    applications to manage buffer object storage in a similar manner.
665bd8deadSopenharmony_ci
675bd8deadSopenharmony_ciNew Procedures and Functions
685bd8deadSopenharmony_ci
695bd8deadSopenharmony_ci        void BufferPageCommitmentARB(enum target,
705bd8deadSopenharmony_ci                                     intptr offset,
715bd8deadSopenharmony_ci                                     sizeiptr size,
725bd8deadSopenharmony_ci                                     boolean commit);
735bd8deadSopenharmony_ci
745bd8deadSopenharmony_ciNew Tokens
755bd8deadSopenharmony_ci
765bd8deadSopenharmony_ci    Accepted as part of the the <flags> parameter to BufferStorage
775bd8deadSopenharmony_ci
785bd8deadSopenharmony_ci        SPARSE_STORAGE_BIT_ARB                                  0x0400
795bd8deadSopenharmony_ci
805bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetFloatv,
815bd8deadSopenharmony_ci    GetIntegerv, and GetInteger64v:
825bd8deadSopenharmony_ci
835bd8deadSopenharmony_ci        SPARSE_BUFFER_PAGE_SIZE_ARB                             0x82F8
845bd8deadSopenharmony_ci
855bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 4.4 (core) Specification (Buffer Objects)
865bd8deadSopenharmony_ci
875bd8deadSopenharmony_ci    In Section 6.2, "Creating and Modifying Buffer Object Data Stores", add
885bd8deadSopenharmony_ci    the following to the list of flags accepted by the <flags> parameter
895bd8deadSopenharmony_ci    to BufferStorage:
905bd8deadSopenharmony_ci
915bd8deadSopenharmony_ci        SPARSE_STORAGE_BIT_ARB The data store of the buffer object is sparse,
925bd8deadSopenharmony_ci        consisting only of a virtual allocation. Physical storage for buffer
935bd8deadSopenharmony_ci        contents may be later allocated and assigned using
945bd8deadSopenharmony_ci        BufferPageCommitmentARB. Initially, the entire data store is
955bd8deadSopenharmony_ci        uncommitted. As a side effect, the data specified in the <data>
965bd8deadSopenharmony_ci        parameter is discarded, although the GL may still acces the client's
975bd8deadSopenharmony_ci        address space within the specified region.
985bd8deadSopenharmony_ci
995bd8deadSopenharmony_ci        If <flags> contains SPARSE_STORAGE_BIT_ARB, then it may not also
1005bd8deadSopenharmony_ci        contain any combination of MAP_READ_BIT or MAP_WRITE_BIT.
1015bd8deadSopenharmony_ci
1025bd8deadSopenharmony_ci    Add the following to the end of the description of BufferSubData.
1035bd8deadSopenharmony_ci
1045bd8deadSopenharmony_ci        If the target of the operation is sparse and the range specified by
1055bd8deadSopenharmony_ci    <offset> and <size> includes uncommited regions, data destined for those
1065bd8deadSopenharmony_ci    regions is silently discarded.
1075bd8deadSopenharmony_ci
1085bd8deadSopenharmony_ci    Add the following introduction and description of BufferPageCommitmentARB:
1095bd8deadSopenharmony_ci
1105bd8deadSopenharmony_ci        The command
1115bd8deadSopenharmony_ci
1125bd8deadSopenharmony_ci        void BufferPageCommitmentARB(enum target,
1135bd8deadSopenharmony_ci                                     intptr offset,
1145bd8deadSopenharmony_ci                                     sizeiptr size,
1155bd8deadSopenharmony_ci                                     boolean commit);
1165bd8deadSopenharmony_ci
1175bd8deadSopenharmony_ci    may be used to commit and de-commit regions of sparse buffer storage.
1185bd8deadSopenharmony_ci    <target> is set to one of the targets listed in table 6.1. <offset> and
1195bd8deadSopenharmony_ci    <size> indicate the range of the data store's virtual allocation to commit.
1205bd8deadSopenharmony_ci    <offset> must be an integer multiple of the implementation dependent
1215bd8deadSopenharmony_ci    constant SPARSE_BUFFER_PAGE_SIZE_ARB, and <size> must either be a multiple
1225bd8deadSopenharmony_ci    of SPARSE_BUFFER_PAGE_SIZE_ARB, or extend to the end of the buffer's
1235bd8deadSopenharmony_ci    data store. If <commit> is TRUE, then pages contained in the specified
1245bd8deadSopenharmony_ci    range become committed and become physically backed. If <commit> is
1255bd8deadSopenharmony_ci    FALSE, then physical storage associated with the data store in the
1265bd8deadSopenharmony_ci    specified region may be freed and those pages become uncommitted. Newly
1275bd8deadSopenharmony_ci    committed pages have undefined content. However, redundantly committing
1285bd8deadSopenharmony_ci    pages does not alter their content.
1295bd8deadSopenharmony_ci
1305bd8deadSopenharmony_ci        Additionally, the commands
1315bd8deadSopenharmony_ci
1325bd8deadSopenharmony_ci        void NamedBufferPageCommitmentEXT(uint buffer,
1335bd8deadSopenharmony_ci                                          intptr offset,
1345bd8deadSopenharmony_ci                                          sizeiptr size,
1355bd8deadSopenharmony_ci                                          boolean commit);
1365bd8deadSopenharmony_ci
1375bd8deadSopenharmony_ci        void NamedBufferPageCommitmentARB(uint buffer,
1385bd8deadSopenharmony_ci                                          intptr offset,
1395bd8deadSopenharmony_ci                                          sizeiptr size,
1405bd8deadSopenharmony_ci                                          boolean commit);
1415bd8deadSopenharmony_ci
1425bd8deadSopenharmony_ci    behaves similarly to BufferPageCommitmentARB except that the target of
1435bd8deadSopenharmony_ci    the operation is the buffer whose name is specified by <buffer>.
1445bd8deadSopenharmony_ci
1455bd8deadSopenharmony_ci    Add subsection 6.4.1 "Effects of Accessing Uncommitted Regions of Sparse
1465bd8deadSopenharmony_ci    Buffers"
1475bd8deadSopenharmony_ci
1485bd8deadSopenharmony_ci        When a buffer object's SPARSE_STORAGE_BIT_ARB is TRUE, it may be
1495bd8deadSopenharmony_ci    fully or partially uncommitted. Unless otherwise noted, reads from
1505bd8deadSopenharmony_ci    uncommitted regions of a sparse buffer, whether through fixed-function
1515bd8deadSopenharmony_ci    logic or shader access return undefined values, but otherwise do not
1525bd8deadSopenharmony_ci    negatively affect GL operation. Further, unless otherwise noted, attempts
1535bd8deadSopenharmony_ci    to write to such regions are silently ignored. Exceptions to this behavior
1545bd8deadSopenharmony_ci    are noted in the relevant sections of this specification.
1555bd8deadSopenharmony_ci
1565bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications
1575bd8deadSopenharmony_ci
1585bd8deadSopenharmony_ci    None.
1595bd8deadSopenharmony_ci
1605bd8deadSopenharmony_ciGLX Protocol
1615bd8deadSopenharmony_ci
1625bd8deadSopenharmony_ci    TBD.
1635bd8deadSopenharmony_ci
1645bd8deadSopenharmony_ciErrors
1655bd8deadSopenharmony_ci
1665bd8deadSopenharmony_ci    INVALID_ENUM is generated by BufferPageCommitmentARB if <target> is not one
1675bd8deadSopenharmony_ci    of the accepted buffer targets.
1685bd8deadSopenharmony_ci
1695bd8deadSopenharmony_ci    INVALID_VALUE is generated by BufferStorage if <flags> contains
1705bd8deadSopenharmony_ci    SPARSE_STORAGE_BIT_ARB and <flags> also contains any combination of
1715bd8deadSopenharmony_ci    MAP_READ_BIT or MAP_WRITE_BIT.
1725bd8deadSopenharmony_ci
1735bd8deadSopenharmony_ci    INVALID_OPERATION is generated by BufferPageCommitmentARB if the
1745bd8deadSopenharmony_ci    SPARSE_STORAGE_BIT_ARB of the buffer bound to <target> is FALSE.
1755bd8deadSopenharmony_ci
1765bd8deadSopenharmony_ci    INVALID_VALUE is generated by BufferPageCommitmentARB if <offset> is not
1775bd8deadSopenharmony_ci    an integer multiple of SPARSE_BUFFER_PAGE_SIZE_ARB, or if <size> is not
1785bd8deadSopenharmony_ci    an integer multiple of SPARSE_BUFFER_PAGE_SIZE_ARB and does not extend
1795bd8deadSopenharmony_ci    to the end of the buffer's data store.
1805bd8deadSopenharmony_ci
1815bd8deadSopenharmony_ci    INVALID_VALUE is generated by BufferPageCommitmentARB if either of
1825bd8deadSopenharmony_ci    <offset> or <size> is negative, or if <offset> + <size> is greater than the
1835bd8deadSopenharmony_ci    value of BUFFER_SIZE for the buffer bound to <target>.
1845bd8deadSopenharmony_ci
1855bd8deadSopenharmony_ciNew State
1865bd8deadSopenharmony_ci
1875bd8deadSopenharmony_ci    None.
1885bd8deadSopenharmony_ci
1895bd8deadSopenharmony_ciNew Implementation Dependent State
1905bd8deadSopenharmony_ci
1915bd8deadSopenharmony_ci    Append to Table 23.55, Implementation Dependent Values
1925bd8deadSopenharmony_ci
1935bd8deadSopenharmony_ci    +-----------------------------------+-------+----------------+----------------+-----------------------------------------+------+
1945bd8deadSopenharmony_ci    | Get Value                         | Type  | Get Command    | Minimum Value  | Description                             | Sec. |
1955bd8deadSopenharmony_ci    +-----------------------------------+-------+----------------+----------------+-----------------------------------------+------+
1965bd8deadSopenharmony_ci    | SPARSE_BUFFER_PAGE_SIZE_ARB       | Z+    | GetIntegerv    | 65536 **       | Page size of sparse buffers in bytes.   | 6.2  |
1975bd8deadSopenharmony_ci    +-----------------------------------+-------+----------------+----------------+-----------------------------------------+------+
1985bd8deadSopenharmony_ci
1995bd8deadSopenharmony_ci    ** The value of SPARSE_BUFFER_PAGE_SIZE_ARB is the largest allowed value.
2005bd8deadSopenharmony_ci    Smaller values are permitted and it is recommended to implementors that it
2015bd8deadSopenharmony_ci    be a power of two.
2025bd8deadSopenharmony_ci
2035bd8deadSopenharmony_ciUsage Examples
2045bd8deadSopenharmony_ci
2055bd8deadSopenharmony_ci    TBD
2065bd8deadSopenharmony_ci
2075bd8deadSopenharmony_ciDependencies on GL_EXT_direct_state_access
2085bd8deadSopenharmony_ci
2095bd8deadSopenharmony_ci    If GL_EXT_direct_state_access is not supported, remove references to
2105bd8deadSopenharmony_ci    NamedBufferPageCommitmentEXT.
2115bd8deadSopenharmony_ci
2125bd8deadSopenharmony_ci
2135bd8deadSopenharmony_ciDependencies on GL_ARB_direct_state_access
2145bd8deadSopenharmony_ci
2155bd8deadSopenharmony_ci    If GL_ARB_direct_state_access is not supported, remove references to
2165bd8deadSopenharmony_ci    NamedBufferPageCommitmentARB.
2175bd8deadSopenharmony_ci
2185bd8deadSopenharmony_ci
2195bd8deadSopenharmony_ciIssues
2205bd8deadSopenharmony_ci
2215bd8deadSopenharmony_ci    1) What is the effect of reading from or writing to an uncommitted region
2225bd8deadSopenharmony_ci       of a buffer's data store.
2235bd8deadSopenharmony_ci
2245bd8deadSopenharmony_ci       RESOLVED: This is defined (or undefined) on a case-by case basis. If it
2255bd8deadSopenharmony_ci       is not defined in this specification, then reads return undefined data,
2265bd8deadSopenharmony_ci       but never interrupt the GL, and writes are silently ignored. Atomics
2275bd8deadSopenharmony_ci       with return constitute a read-modify-write cycle, where the read
2285bd8deadSopenharmony_ci       produces undefined results and the write is discarded.
2295bd8deadSopenharmony_ci
2305bd8deadSopenharmony_ci    2) Should mapping a sparse buffer be allowed? What is the defined content
2315bd8deadSopenharmony_ci       as seen for the client for unmapped parts of the buffer?
2325bd8deadSopenharmony_ci
2335bd8deadSopenharmony_ci       RESOLVED: No, it's not possible to map a sparse buffer at all. Such
2345bd8deadSopenharmony_ci       functionality could always be added by a future extension. In this
2355bd8deadSopenharmony_ci       extension, we disallow creation of a mappable sparse buffer, which in
2365bd8deadSopenharmony_ci       turns will cause MapBuffer{Range} to fail if a mapping attempt is
2375bd8deadSopenharmony_ci       made.
2385bd8deadSopenharmony_ci
2395bd8deadSopenharmony_ciRevision History
2405bd8deadSopenharmony_ci
2415bd8deadSopenharmony_ci    Rev.    Date      Author    Changes
2425bd8deadSopenharmony_ci    ----  --------    --------  ---------------------------------------------
2435bd8deadSopenharmony_ci      4   5/31/2016   Jon Leech Change dependency from GL 1.5 + ARB_vbo to
2445bd8deadSopenharmony_ci                                GL 4.4 (Bug 14117).
2455bd8deadSopenharmony_ci      3   5/16/2014   criccio   Added interactions with
2465bd8deadSopenharmony_ci                                GL_ARB_direct_state_access
2475bd8deadSopenharmony_ci      2   4/17/2014   gsellers  Make it illegal to create a mappable sparse
2485bd8deadSopenharmony_ci                                buffer. Add DSA entry point. Change name of
2495bd8deadSopenharmony_ci                                SPARSE_BUFFER_PAGE_SIZE_ARB. Allow <size> in
2505bd8deadSopenharmony_ci                                BufferPageCommitmentARB to go to the end of
2515bd8deadSopenharmony_ci                                the buffer.
2525bd8deadSopenharmony_ci      1   1/1/2014    gsellers  Initial revision
253