15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    ARB_sync
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_ARB_sync
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContributors
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Barthold Lichtenbelt, NVIDIA
125bd8deadSopenharmony_ci    Bill Licea-Kane, ATI
135bd8deadSopenharmony_ci    Greg Roth, NVIDIA
145bd8deadSopenharmony_ci    Jeff Bolz, NVIDIA
155bd8deadSopenharmony_ci    Jeff Juliano, NVIDIA
165bd8deadSopenharmony_ci    Jeremy Sandmel, Apple
175bd8deadSopenharmony_ci    John Kessenich, Intel
185bd8deadSopenharmony_ci    Jon Leech, Khronos
195bd8deadSopenharmony_ci    Piers Daniell, NVIDIA
205bd8deadSopenharmony_ci
215bd8deadSopenharmony_ciContact
225bd8deadSopenharmony_ci
235bd8deadSopenharmony_ci    Jon Leech (jon 'at' alumni.caltech.edu)
245bd8deadSopenharmony_ci
255bd8deadSopenharmony_ciNotice
265bd8deadSopenharmony_ci
275bd8deadSopenharmony_ci    Copyright (c) 2009-2013 The Khronos Group Inc. Copyright terms at
285bd8deadSopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
295bd8deadSopenharmony_ci
305bd8deadSopenharmony_ciSpecification Update Policy
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ci    Khronos-approved extension specifications are updated in response to
335bd8deadSopenharmony_ci    issues and bugs prioritized by the Khronos OpenGL Working Group. For
345bd8deadSopenharmony_ci    extensions which have been promoted to a core Specification, fixes will
355bd8deadSopenharmony_ci    first appear in the latest version of that core Specification, and will
365bd8deadSopenharmony_ci    eventually be backported to the extension document. This policy is
375bd8deadSopenharmony_ci    described in more detail at
385bd8deadSopenharmony_ci        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
395bd8deadSopenharmony_ci
405bd8deadSopenharmony_ciIP Status
415bd8deadSopenharmony_ci
425bd8deadSopenharmony_ci    US patent #6025855 may bear on this extension (based on ARB
435bd8deadSopenharmony_ci    discussion in March, 2003).
445bd8deadSopenharmony_ci
455bd8deadSopenharmony_ci    The related NV_fence extension is marked "NVIDIA Proprietary".
465bd8deadSopenharmony_ci
475bd8deadSopenharmony_ciStatus
485bd8deadSopenharmony_ci
495bd8deadSopenharmony_ci    Complete. Approved by the ARB on July 3, 2009.
505bd8deadSopenharmony_ci
515bd8deadSopenharmony_ciVersion
525bd8deadSopenharmony_ci
535bd8deadSopenharmony_ci    September 18, 2009 (version 25)
545bd8deadSopenharmony_ci
555bd8deadSopenharmony_ciNumber
565bd8deadSopenharmony_ci
575bd8deadSopenharmony_ci    ARB Extension #66
585bd8deadSopenharmony_ci
595bd8deadSopenharmony_ciDependencies
605bd8deadSopenharmony_ci
615bd8deadSopenharmony_ci    OpenGL 3.1 is required.
625bd8deadSopenharmony_ci
635bd8deadSopenharmony_ci    The functionality of ARB_sync was added to the OpenGL 3.2 core.
645bd8deadSopenharmony_ci
655bd8deadSopenharmony_ciOverview
665bd8deadSopenharmony_ci
675bd8deadSopenharmony_ci    This extension introduces the concept of "sync objects". Sync
685bd8deadSopenharmony_ci    objects are a synchronization primitive - a representation of events
695bd8deadSopenharmony_ci    whose completion status can be tested or waited upon. One specific
705bd8deadSopenharmony_ci    type of sync object, the "fence sync object", is supported in this
715bd8deadSopenharmony_ci    extension, and additional types can easily be added in the future.
725bd8deadSopenharmony_ci
735bd8deadSopenharmony_ci    Fence sync objects have corresponding fences, which are inserted
745bd8deadSopenharmony_ci    into the OpenGL command stream at the time the sync object is
755bd8deadSopenharmony_ci    created. A sync object can be queried for a given condition. The
765bd8deadSopenharmony_ci    only condition supported for fence sync objects is completion of the
775bd8deadSopenharmony_ci    corresponding fence command. Fence completion allows applications to
785bd8deadSopenharmony_ci    request a partial Finish, wherein all commands prior to the fence
795bd8deadSopenharmony_ci    will be forced to complete before control is returned to the calling
805bd8deadSopenharmony_ci    process.
815bd8deadSopenharmony_ci
825bd8deadSopenharmony_ci    These new mechanisms allow for synchronization between the host CPU
835bd8deadSopenharmony_ci    and the GPU, which may be accessing the same resources (typically
845bd8deadSopenharmony_ci    memory), as well as between multiple GL contexts bound to multiple
855bd8deadSopenharmony_ci    threads in the host CPU.
865bd8deadSopenharmony_ci
875bd8deadSopenharmony_ciNew Types
885bd8deadSopenharmony_ci
895bd8deadSopenharmony_ci    (Implementer's Note: GLint64 and GLuint64 are defined as appropriate
905bd8deadSopenharmony_ci    for an ISO C 99 compiler. Other language bindings, or non-ISO
915bd8deadSopenharmony_ci    compilers, may need to use a different approach).
925bd8deadSopenharmony_ci
935bd8deadSopenharmony_ci    #include <inttypes.h>
945bd8deadSopenharmony_ci    typedef int64_t GLint64;
955bd8deadSopenharmony_ci    typedef uint64_t GLuint64;
965bd8deadSopenharmony_ci    typedef struct __GLsync *GLsync;
975bd8deadSopenharmony_ci
985bd8deadSopenharmony_ciNew Procedures and Functions
995bd8deadSopenharmony_ci
1005bd8deadSopenharmony_ci    sync FenceSync(enum condition,bitfield flags)
1015bd8deadSopenharmony_ci    boolean IsSync(sync sync)
1025bd8deadSopenharmony_ci    void DeleteSync(sync sync)
1035bd8deadSopenharmony_ci
1045bd8deadSopenharmony_ci    enum ClientWaitSync(sync sync,bitfield flags,uint64 timeout)
1055bd8deadSopenharmony_ci    void WaitSync(sync sync,bitfield flags,uint64 timeout)
1065bd8deadSopenharmony_ci
1075bd8deadSopenharmony_ci    void GetInteger64v(enum pname, int64 *params);
1085bd8deadSopenharmony_ci    void GetSynciv(sync sync,enum pname,sizei bufSize,sizei *length,
1095bd8deadSopenharmony_ci                   int *values)
1105bd8deadSopenharmony_ci
1115bd8deadSopenharmony_ciNew Tokens
1125bd8deadSopenharmony_ci
1135bd8deadSopenharmony_ci    Accepted as the <pname> parameter of GetInteger64v:
1145bd8deadSopenharmony_ci
1155bd8deadSopenharmony_ci        MAX_SERVER_WAIT_TIMEOUT         0x9111
1165bd8deadSopenharmony_ci
1175bd8deadSopenharmony_ci    Accepted as the <pname> parameter of GetSynciv:
1185bd8deadSopenharmony_ci
1195bd8deadSopenharmony_ci        OBJECT_TYPE                     0x9112
1205bd8deadSopenharmony_ci        SYNC_CONDITION                  0x9113
1215bd8deadSopenharmony_ci        SYNC_STATUS                     0x9114
1225bd8deadSopenharmony_ci        SYNC_FLAGS                      0x9115
1235bd8deadSopenharmony_ci
1245bd8deadSopenharmony_ci    Returned in <values> for GetSynciv <pname> OBJECT_TYPE:
1255bd8deadSopenharmony_ci
1265bd8deadSopenharmony_ci        SYNC_FENCE                      0x9116
1275bd8deadSopenharmony_ci
1285bd8deadSopenharmony_ci    Returned in <values> for GetSynciv <pname> SYNC_CONDITION:
1295bd8deadSopenharmony_ci
1305bd8deadSopenharmony_ci        SYNC_GPU_COMMANDS_COMPLETE      0x9117
1315bd8deadSopenharmony_ci
1325bd8deadSopenharmony_ci    Returned in <values> for GetSynciv <pname> SYNC_STATUS:
1335bd8deadSopenharmony_ci
1345bd8deadSopenharmony_ci        UNSIGNALED                      0x9118
1355bd8deadSopenharmony_ci        SIGNALED                        0x9119
1365bd8deadSopenharmony_ci
1375bd8deadSopenharmony_ci    Accepted in the <flags> parameter of ClientWaitSync:
1385bd8deadSopenharmony_ci
1395bd8deadSopenharmony_ci        SYNC_FLUSH_COMMANDS_BIT         0x00000001
1405bd8deadSopenharmony_ci
1415bd8deadSopenharmony_ci    Accepted in the <timeout> parameter of WaitSync:
1425bd8deadSopenharmony_ci
1435bd8deadSopenharmony_ci        TIMEOUT_IGNORED                 0xFFFFFFFFFFFFFFFFull
1445bd8deadSopenharmony_ci
1455bd8deadSopenharmony_ci    Returned by ClientWaitSync:
1465bd8deadSopenharmony_ci
1475bd8deadSopenharmony_ci        ALREADY_SIGNALED                0x911A
1485bd8deadSopenharmony_ci        TIMEOUT_EXPIRED                 0x911B
1495bd8deadSopenharmony_ci        CONDITION_SATISFIED             0x911C
1505bd8deadSopenharmony_ci        WAIT_FAILED                     0x911D
1515bd8deadSopenharmony_ci
1525bd8deadSopenharmony_ci
1535bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 3.1 Specification (OpenGL Operation)
1545bd8deadSopenharmony_ci
1555bd8deadSopenharmony_ci    Add to Table 2.2, GL data types:
1565bd8deadSopenharmony_ci
1575bd8deadSopenharmony_ci   "GL Type Minimum     Description
1585bd8deadSopenharmony_ci            Bit Width
1595bd8deadSopenharmony_ci    ------- ---------   ----------------------------------------------
1605bd8deadSopenharmony_ci    int64   64          Signed 2's complement binary long integer
1615bd8deadSopenharmony_ci    uint64  64          Unsigned 2's complement binary long integer.
1625bd8deadSopenharmony_ci    sync    <ptrbits>   Sync object handle (see section 5.2)
1635bd8deadSopenharmony_ci
1645bd8deadSopenharmony_ci
1655bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 3.1 Specification (Special Functions)
1665bd8deadSopenharmony_ci
1675bd8deadSopenharmony_ci    Insert a new section following "Flush and Finish" (Section 5.1)
1685bd8deadSopenharmony_ci    describing sync objects and fence operation. Renumber existing
1695bd8deadSopenharmony_ci    section 5.2 "Hints" and all following 5.* sections.
1705bd8deadSopenharmony_ci
1715bd8deadSopenharmony_ci   "5.2 Sync Objects and Fences
1725bd8deadSopenharmony_ci    ---------------------------
1735bd8deadSopenharmony_ci
1745bd8deadSopenharmony_ci    Sync objects act as a <synchronization primitive> - a representation
1755bd8deadSopenharmony_ci    of events whose completion status can be tested or waited upon. Sync
1765bd8deadSopenharmony_ci    objects may be used for synchronization with operations occurring in
1775bd8deadSopenharmony_ci    the GL state machine or in the graphics pipeline, and for
1785bd8deadSopenharmony_ci    synchronizing between multiple graphics contexts, among other
1795bd8deadSopenharmony_ci    purposes.
1805bd8deadSopenharmony_ci
1815bd8deadSopenharmony_ci    Sync objects have a status value with two possible states:
1825bd8deadSopenharmony_ci    <signaled> and <unsignaled>. Events are associated with a sync
1835bd8deadSopenharmony_ci    object. When an sync object is created, its status is set to
1845bd8deadSopenharmony_ci    unsignaled. When the associated event occurs, the sync object is
1855bd8deadSopenharmony_ci    signaled (its status is set to signaled). Once a sync object has
1865bd8deadSopenharmony_ci    been created, the GL may be asked to wait for a sync object to
1875bd8deadSopenharmony_ci    become signaled.
1885bd8deadSopenharmony_ci
1895bd8deadSopenharmony_ci    Initially, only one specific type of sync object is defined: the
1905bd8deadSopenharmony_ci    fence sync object, whose associated event is triggered by a fence
1915bd8deadSopenharmony_ci    command placed in the GL command stream. Fence sync objects are used
1925bd8deadSopenharmony_ci    to wait for partial completion of the GL command stream, as a more
1935bd8deadSopenharmony_ci    flexible form of Finish.
1945bd8deadSopenharmony_ci
1955bd8deadSopenharmony_ci    The command
1965bd8deadSopenharmony_ci
1975bd8deadSopenharmony_ci        sync FenceSync(enum condition,bitfield flags)
1985bd8deadSopenharmony_ci
1995bd8deadSopenharmony_ci    creates a new fence sync object, inserts a fence command in the GL
2005bd8deadSopenharmony_ci    command stream and associates it with that sync object, and returns
2015bd8deadSopenharmony_ci    a non-zero name corresponding to the sync object.
2025bd8deadSopenharmony_ci
2035bd8deadSopenharmony_ci    When the specified <condition> of the sync object is satisfied by
2045bd8deadSopenharmony_ci    the fence command, the sync object is signaled by the GL, causing
2055bd8deadSopenharmony_ci    any ClientWaitSync or WaitSync commands (see below) blocking on
2065bd8deadSopenharmony_ci    <sync> to <unblock>. No other state is affected by FenceSync or by
2075bd8deadSopenharmony_ci    execution of the associated fence command.
2085bd8deadSopenharmony_ci
2095bd8deadSopenharmony_ci    <condition> must be SYNC_GPU_COMMANDS_COMPLETE. This condition is
2105bd8deadSopenharmony_ci    satisfied by completion of the fence command corresponding to the
2115bd8deadSopenharmony_ci    sync object and all preceding commands in the same command stream.
2125bd8deadSopenharmony_ci    The sync object will not be signaled until all effects from these
2135bd8deadSopenharmony_ci    commands on GL client and server state and the framebuffer are fully
2145bd8deadSopenharmony_ci    realized. Note that completion of the fence command occurs once the
2155bd8deadSopenharmony_ci    state of the corresponding sync object has been changed, but
2165bd8deadSopenharmony_ci    commands waiting on that sync object may not be unblocked until
2175bd8deadSopenharmony_ci    after the fence command completes.
2185bd8deadSopenharmony_ci
2195bd8deadSopenharmony_ci    <flags> must be 0[fn1].
2205bd8deadSopenharmony_ci       [fn1: <flags> is a placeholder for anticipated future extensions
2215bd8deadSopenharmony_ci        of fence sync object capabilities.]
2225bd8deadSopenharmony_ci
2235bd8deadSopenharmony_ci    Each sync object contains a number of <properties> which determine
2245bd8deadSopenharmony_ci    the state of the object and the behavior of any commands associated
2255bd8deadSopenharmony_ci    with it. Each property has a <property name> and <property value>.
2265bd8deadSopenharmony_ci    The initial property values for a sync object created by FenceSync
2275bd8deadSopenharmony_ci    are shown in table 5.props:
2285bd8deadSopenharmony_ci
2295bd8deadSopenharmony_ci        Property Name   Property Value
2305bd8deadSopenharmony_ci        -------------   --------------
2315bd8deadSopenharmony_ci        OBJECT_TYPE     SYNC_FENCE
2325bd8deadSopenharmony_ci        SYNC_CONDITION  <condition>
2335bd8deadSopenharmony_ci        SYNC_STATUS     UNSIGNALED
2345bd8deadSopenharmony_ci        SYNC_FLAGS      <flags>
2355bd8deadSopenharmony_ci        --------------------------------------
2365bd8deadSopenharmony_ci        Table 5.props: Initial properties of a
2375bd8deadSopenharmony_ci        sync object created with FenceSync().
2385bd8deadSopenharmony_ci
2395bd8deadSopenharmony_ci    Properties of a sync object may be queried with GetSynciv (see
2405bd8deadSopenharmony_ci    section 6.1.16). The SYNC_STATUS property will be changed to
2415bd8deadSopenharmony_ci    SIGNALED when <condition> is satisfied.
2425bd8deadSopenharmony_ci
2435bd8deadSopenharmony_ci    If FenceSync fails to create a sync object, zero will be returned
2445bd8deadSopenharmony_ci    and a GL error will be generated as described. An INVALID_ENUM error
2455bd8deadSopenharmony_ci    is generated if <condition> is not SYNC_GPU_COMMANDS_COMPLETE. If
2465bd8deadSopenharmony_ci    <flags> is not zero, an INVALID_VALUE error is generated.
2475bd8deadSopenharmony_ci
2485bd8deadSopenharmony_ci    A sync object can be deleted by passing its name to the command
2495bd8deadSopenharmony_ci
2505bd8deadSopenharmony_ci        void DeleteSync(sync sync)
2515bd8deadSopenharmony_ci
2525bd8deadSopenharmony_ci    If the fence command corresponding to the specified sync object has
2535bd8deadSopenharmony_ci    completed, or if no ClientWaitSync or WaitSync commands are blocking
2545bd8deadSopenharmony_ci    on <sync>, the object is deleted immediately. Otherwise, <sync> is
2555bd8deadSopenharmony_ci    flagged for deletion and will be deleted when it is no longer
2565bd8deadSopenharmony_ci    associated with any fence command and is no longer blocking any
2575bd8deadSopenharmony_ci    ClientWaitSync or WaitSync command. In either case, after returning
2585bd8deadSopenharmony_ci    from DeleteSync the <sync> name is invalid and can no longer be used
2595bd8deadSopenharmony_ci    to refer to the sync object.
2605bd8deadSopenharmony_ci
2615bd8deadSopenharmony_ci    DeleteSync will silently ignore a <sync> value of zero. An
2625bd8deadSopenharmony_ci    INVALID_VALUE error is generated if <sync> is neither zero nor the
2635bd8deadSopenharmony_ci    name of a sync object.
2645bd8deadSopenharmony_ci
2655bd8deadSopenharmony_ci
2665bd8deadSopenharmony_ci    5.2.1 Waiting for Sync Objects
2675bd8deadSopenharmony_ci    ------------------------------
2685bd8deadSopenharmony_ci
2695bd8deadSopenharmony_ci    The command
2705bd8deadSopenharmony_ci
2715bd8deadSopenharmony_ci        enum ClientWaitSync(sync sync,bitfield flags,uint64 timeout)
2725bd8deadSopenharmony_ci
2735bd8deadSopenharmony_ci    causes the GL to block, and will not return until the sync object
2745bd8deadSopenharmony_ci    <sync> is signaled, or until the specified <timeout> period expires.
2755bd8deadSopenharmony_ci    <timeout> is in units of nanoseconds. <timeout> is adjusted to the
2765bd8deadSopenharmony_ci    closest value allowed by the implementation-dependent timeout
2775bd8deadSopenharmony_ci    accuracy, which may be substantially longer than one nanosecond, and
2785bd8deadSopenharmony_ci    may be longer than the requested period.
2795bd8deadSopenharmony_ci
2805bd8deadSopenharmony_ci    If <sync> is signaled at the time ClientWaitSync is called
2815bd8deadSopenharmony_ci    then ClientWaitSync returns immediately. If <sync> is unsignaled at
2825bd8deadSopenharmony_ci    the time ClientWaitSync is called then ClientWaitSync will block and
2835bd8deadSopenharmony_ci    will wait up to <timeout> nanoseconds for <sync> to become signaled.
2845bd8deadSopenharmony_ci    <flags> controls command flushing behavior, and may be
2855bd8deadSopenharmony_ci    SYNC_FLUSH_COMMANDS_BIT, as discussed in section 5.2.2.
2865bd8deadSopenharmony_ci
2875bd8deadSopenharmony_ci    ClientWaitSync returns one of four status values. A return value of
2885bd8deadSopenharmony_ci    ALREADY_SIGNALED indicates that <sync> was signaled at the time
2895bd8deadSopenharmony_ci    ClientWaitSync was called. ALREADY_SIGNALED will always be returned
2905bd8deadSopenharmony_ci    if <sync> was signaled, even if the value of <timeout> is zero. A
2915bd8deadSopenharmony_ci    return value of TIMEOUT_EXPIRED indicates that the specified timeout
2925bd8deadSopenharmony_ci    period expired before <sync> was signaled. A return value of
2935bd8deadSopenharmony_ci    CONDITION_SATISFIED indicates that <sync> was signaled before the
2945bd8deadSopenharmony_ci    timeout expired. Finally, if an error occurs, in addition to
2955bd8deadSopenharmony_ci    generating a GL error as specified below, ClientWaitSync immediately
2965bd8deadSopenharmony_ci    returns WAIT_FAILED without blocking.
2975bd8deadSopenharmony_ci
2985bd8deadSopenharmony_ci    If the value of <timeout> is zero, then ClientWaitSync does not
2995bd8deadSopenharmony_ci    block, but simply tests the current state of <sync>. TIMEOUT_EXPIRED
3005bd8deadSopenharmony_ci    will be returned in this case if <sync> is not signaled, even though
3015bd8deadSopenharmony_ci    no actual wait was performed.
3025bd8deadSopenharmony_ci
3035bd8deadSopenharmony_ci    If <sync> is not the name of a sync object, an INVALID_VALUE error
3045bd8deadSopenharmony_ci    is generated. If <flags> contains any bits other than
3055bd8deadSopenharmony_ci    SYNC_FLUSH_COMMANDS_BIT, an INVALID_VALUE error is generated.
3065bd8deadSopenharmony_ci
3075bd8deadSopenharmony_ci    The command
3085bd8deadSopenharmony_ci
3095bd8deadSopenharmony_ci        void WaitSync(sync sync,bitfield flags,uint64 timeout)
3105bd8deadSopenharmony_ci
3115bd8deadSopenharmony_ci    is similar to ClientWaitSync, but instead of blocking and not
3125bd8deadSopenharmony_ci    returning to the application until <sync> is signaled, WaitSync
3135bd8deadSopenharmony_ci    returns immediately, instead causing the GL server [fn1] to block
3145bd8deadSopenharmony_ci    until <sync> is signaled [fn2].
3155bd8deadSopenharmony_ci       [fn1 - the GL server may choose to wait either in the CPU
3165bd8deadSopenharmony_ci        executing server-side code, or in the GPU hardware if it
3175bd8deadSopenharmony_ci        supports this operation.]
3185bd8deadSopenharmony_ci       [fn2 - WaitSync allows applications to continue to queue commands
3195bd8deadSopenharmony_ci        from the client in anticipation of the sync being signaled,
3205bd8deadSopenharmony_ci        increasing client-server parallelism.
3215bd8deadSopenharmony_ci
3225bd8deadSopenharmony_ci    <sync> has the same meaning as for ClientWaitSync.
3235bd8deadSopenharmony_ci
3245bd8deadSopenharmony_ci    <timeout> must currently be the special value TIMEOUT_IGNORED, and
3255bd8deadSopenharmony_ci    is not used. Instead, WaitSync will always wait no longer than an
3265bd8deadSopenharmony_ci    implementation-dependent timeout. The duration of this timeout in
3275bd8deadSopenharmony_ci    nanoseconds may be queried by calling GetInteger64v with <value>
3285bd8deadSopenharmony_ci    MAX_SERVER_WAIT_TIMEOUT. There is currently no way to determine
3295bd8deadSopenharmony_ci    whether WaitSync unblocked because the timeout expired or because
3305bd8deadSopenharmony_ci    the sync object being waited on was signaled.
3315bd8deadSopenharmony_ci
3325bd8deadSopenharmony_ci    <flags> must be 0.
3335bd8deadSopenharmony_ci
3345bd8deadSopenharmony_ci    If an error occurs, WaitSync generates a GL error as specified
3355bd8deadSopenharmony_ci    below, and does not cause the GL server to block.
3365bd8deadSopenharmony_ci
3375bd8deadSopenharmony_ci    If <sync> is not the name of a sync object, an INVALID_VALUE error
3385bd8deadSopenharmony_ci    is generated. If <timeout> is not TIMEOUT_IGNORED, or <flags> is not
3395bd8deadSopenharmony_ci    zero, an INVALID_VALUE error is generated.
3405bd8deadSopenharmony_ci
3415bd8deadSopenharmony_ci    Multiple Waiters
3425bd8deadSopenharmony_ci    ----------------
3435bd8deadSopenharmony_ci
3445bd8deadSopenharmony_ci    It is possible for both the GL client to be blocked on a sync object
3455bd8deadSopenharmony_ci    in a ClientWaitSync command, the GL server to be blocked as the
3465bd8deadSopenharmony_ci    result of a previous WaitSync command, and for additional WaitSync
3475bd8deadSopenharmony_ci    commands to be queued in the GL server, all for a single sync
3485bd8deadSopenharmony_ci    object. When such a sync object is signaled in this situation, the
3495bd8deadSopenharmony_ci    client will be unblocked, the server will be unblocked, and all such
3505bd8deadSopenharmony_ci    queued WaitSync commands will continue immediately when they are
3515bd8deadSopenharmony_ci    reached.
3525bd8deadSopenharmony_ci
3535bd8deadSopenharmony_ci    See section D.2 for more information about blocking on a sync
3545bd8deadSopenharmony_ci    objects in multiple GL contexts.
3555bd8deadSopenharmony_ci
3565bd8deadSopenharmony_ci    5.2.2 Signaling
3575bd8deadSopenharmony_ci    ---------------
3585bd8deadSopenharmony_ci
3595bd8deadSopenharmony_ci    A sync object can be in the signaled state only once the
3605bd8deadSopenharmony_ci    corresponding fence command has completed and signaled the sync
3615bd8deadSopenharmony_ci    object.
3625bd8deadSopenharmony_ci
3635bd8deadSopenharmony_ci    If the sync object being blocked upon will not be signaled in finite
3645bd8deadSopenharmony_ci    time (for example, by an associated fence command issued previously,
3655bd8deadSopenharmony_ci    but not yet flushed to the graphics pipeline), then ClientWaitSync
3665bd8deadSopenharmony_ci    may hang forever. To help prevent this behavior [fn4], if the
3675bd8deadSopenharmony_ci    SYNC_FLUSH_COMMANDS_BIT bit is set in <flags>, and <sync> is
3685bd8deadSopenharmony_ci    unsignaled when ClientWaitSync is called, then the equivalent of
3695bd8deadSopenharmony_ci    Flush will be performed before blocking on <sync>.
3705bd8deadSopenharmony_ci       [fn4 - The simple flushing behavior defined by
3715bd8deadSopenharmony_ci        SYNC_FLUSH_COMMANDS_BIT will not help when waiting for a fence
3725bd8deadSopenharmony_ci        command issued in another context's command stream to complete.
3735bd8deadSopenharmony_ci        Applications which block on a fence sync object must take
3745bd8deadSopenharmony_ci        additional steps to assure that the context from which the
3755bd8deadSopenharmony_ci        corresponding fence command was issued has flushed that command
3765bd8deadSopenharmony_ci        to the graphics pipeline.]
3775bd8deadSopenharmony_ci
3785bd8deadSopenharmony_ci    If a sync object is marked for deletion while a client is blocking
3795bd8deadSopenharmony_ci    on that object in a ClientWaitSync command, or a GL server is
3805bd8deadSopenharmony_ci    blocking on that object as a result of a prior WaitSync command,
3815bd8deadSopenharmony_ci    deletion is deferred until the sync object is signaled and all
3825bd8deadSopenharmony_ci    blocked GL clients and servers are unblocked.
3835bd8deadSopenharmony_ci
3845bd8deadSopenharmony_ci    Additional constraints on the use of sync objects are discussed in
3855bd8deadSopenharmony_ci    Appendix D.
3865bd8deadSopenharmony_ci
3875bd8deadSopenharmony_ci    State must be maintained to indicate which sync object names are
3885bd8deadSopenharmony_ci    currently in use. The state require for each sync object in use is
3895bd8deadSopenharmony_ci    an integer for the specific type, an integer for the condition, an
3905bd8deadSopenharmony_ci    integer for the flags, and a bit indicating whether the object is
3915bd8deadSopenharmony_ci    signaled or unsignaled. The initial values of sync object state are
3925bd8deadSopenharmony_ci    defined as specified by FenceSync."
3935bd8deadSopenharmony_ci
3945bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 3.1 Specification (State and State Requests)
3955bd8deadSopenharmony_ci
3965bd8deadSopenharmony_ci    Add GetInteger64v to the first list of commands in section 6.1.1
3975bd8deadSopenharmony_ci    "Simple Queries", and change the next sentence to mention the query:
3985bd8deadSopenharmony_ci
3995bd8deadSopenharmony_ci   "There are five commands for obtaining simple state variables:
4005bd8deadSopenharmony_ci
4015bd8deadSopenharmony_ci       ...
4025bd8deadSopenharmony_ci       void GetInteger64v(enum value,int64 *data)
4035bd8deadSopenharmony_ci       ...
4045bd8deadSopenharmony_ci
4055bd8deadSopenharmony_ci    The commands obtain boolean, integer, 64-bit integer,
4065bd8deadSopenharmony_ci    floating-point..."
4075bd8deadSopenharmony_ci
4085bd8deadSopenharmony_ci
4095bd8deadSopenharmony_ci    Modify the third sentence of section 6.1.2 "Data Conversions":
4105bd8deadSopenharmony_ci
4115bd8deadSopenharmony_ci   "If any of the other simple queries are called, a boolean value of
4125bd8deadSopenharmony_ci    TRUE or FALSE is interpreted as 1 or 0, respectively. If GetIntegerv
4135bd8deadSopenharmony_ci    or GetInteger64v are called, a floating-point value is rounded to
4145bd8deadSopenharmony_ci    the nearest integer, unless the value is an RGBA color component..."
4155bd8deadSopenharmony_ci
4165bd8deadSopenharmony_ci
4175bd8deadSopenharmony_ci    Insert a new subsection following "Asynchronous Queries" (subsection
4185bd8deadSopenharmony_ci    6.1.6) describing sync object queries. Renumber existing subsection
4195bd8deadSopenharmony_ci    6.1.7 "Buffer Object Queries" and all following 6.1.* subsections.
4205bd8deadSopenharmony_ci
4215bd8deadSopenharmony_ci   "6.1.7 Sync Object Queries
4225bd8deadSopenharmony_ci
4235bd8deadSopenharmony_ci    Properties of sync objects may be queried using the command
4245bd8deadSopenharmony_ci
4255bd8deadSopenharmony_ci        void GetSynciv(sync sync,enum pname,sizei bufSize,sizei *length,
4265bd8deadSopenharmony_ci                       int *values)
4275bd8deadSopenharmony_ci
4285bd8deadSopenharmony_ci    The value or values being queried are returned in the parameters
4295bd8deadSopenharmony_ci    <length> and <values>.
4305bd8deadSopenharmony_ci
4315bd8deadSopenharmony_ci    On success, GetSynciv replaces up to <bufSize> integers in <values>
4325bd8deadSopenharmony_ci    with the corresponding property values of the object being queried.
4335bd8deadSopenharmony_ci    The actual number of integers replaced is returned in *<length>. If
4345bd8deadSopenharmony_ci    <length> is NULL, no length is returned.
4355bd8deadSopenharmony_ci
4365bd8deadSopenharmony_ci    If <pname> is OBJECT_TYPE, a single value representing the specific
4375bd8deadSopenharmony_ci    type of the sync object is placed in <values>. The only type
4385bd8deadSopenharmony_ci    supported is SYNC_FENCE.
4395bd8deadSopenharmony_ci
4405bd8deadSopenharmony_ci    If <pname> is SYNC_STATUS, a single value representing the status of
4415bd8deadSopenharmony_ci    the sync object (SIGNALED or UNSIGNALED) is placed in <values>.
4425bd8deadSopenharmony_ci
4435bd8deadSopenharmony_ci    If <pname> is SYNC_CONDITION, a single value representing the
4445bd8deadSopenharmony_ci    condition of the sync object is placed in <values>. The only
4455bd8deadSopenharmony_ci    condition supported is SYNC_GPU_COMMANDS_COMPLETE.
4465bd8deadSopenharmony_ci
4475bd8deadSopenharmony_ci    If <pname> is SYNC_FLAGS, a single value representing the flags with
4485bd8deadSopenharmony_ci    which the sync object was created is placed in <values>. No flags
4495bd8deadSopenharmony_ci    are currently supported.
4505bd8deadSopenharmony_ci
4515bd8deadSopenharmony_ci    If <sync> is not the name of a sync object, an INVALID_VALUE error
4525bd8deadSopenharmony_ci    is generated. If <pname> is not one of the values described above,
4535bd8deadSopenharmony_ci    an INVALID_ENUM error is generated. If an error occurs,
4545bd8deadSopenharmony_ci    nothing will be written to <values> or <length>.
4555bd8deadSopenharmony_ci
4565bd8deadSopenharmony_ci    The command
4575bd8deadSopenharmony_ci
4585bd8deadSopenharmony_ci        boolean IsSync(sync sync)
4595bd8deadSopenharmony_ci
4605bd8deadSopenharmony_ci    returns TRUE if <sync> is the name of a sync object. If <sync> is
4615bd8deadSopenharmony_ci    not the name of a sync object, or if an error condition occurs,
4625bd8deadSopenharmony_ci    IsSync returns FALSE (note that zero is not the name of a sync
4635bd8deadSopenharmony_ci    object).
4645bd8deadSopenharmony_ci
4655bd8deadSopenharmony_ci    Sync object names immediately become invalid after calling
4665bd8deadSopenharmony_ci    DeleteSync, as discussed in sections 5.2 and D.2, but the underlying
4675bd8deadSopenharmony_ci    sync object will not be deleted until it is no longer associated
4685bd8deadSopenharmony_ci    with any fence command and no longer blocking any WaitSync command."
4695bd8deadSopenharmony_ci
4705bd8deadSopenharmony_ci
4715bd8deadSopenharmony_ciAdditions to Appendix D (Shared Objects and Multiple Contexts)
4725bd8deadSopenharmony_ci
4735bd8deadSopenharmony_ci    In the first paragraph of the appendix, add "sync objects" to the
4745bd8deadSopenharmony_ci    list of shared state.
4755bd8deadSopenharmony_ci
4765bd8deadSopenharmony_ci    Replace the title and first sentence of section D.1 with:
4775bd8deadSopenharmony_ci
4785bd8deadSopenharmony_ci   "D.1 Object Deletion Behavior (other than sync objects)
4795bd8deadSopenharmony_ci    ------------------------------------------------------
4805bd8deadSopenharmony_ci
4815bd8deadSopenharmony_ci    After a shared object (other than sync objects, discussed in section
4825bd8deadSopenharmony_ci    D.2) is deleted..."
4835bd8deadSopenharmony_ci
4845bd8deadSopenharmony_ci
4855bd8deadSopenharmony_ci    Insert a new section following "Object Deletion Behavior" (section
4865bd8deadSopenharmony_ci    D.1) describing sync object multicontext behavior. Renumber existing
4875bd8deadSopenharmony_ci    section D.2 "Propagating State Changes..." and all following D.*
4885bd8deadSopenharmony_ci    sections.
4895bd8deadSopenharmony_ci
4905bd8deadSopenharmony_ci   "D.2 Sync Objects and Multiple Contexts
4915bd8deadSopenharmony_ci    --------------------------------------
4925bd8deadSopenharmony_ci
4935bd8deadSopenharmony_ci    D.2.1 Sync Object Deletion Behavior
4945bd8deadSopenharmony_ci    -----------------------------------
4955bd8deadSopenharmony_ci
4965bd8deadSopenharmony_ci    Deleting sync objects is similar to other shared object types in
4975bd8deadSopenharmony_ci    that the name of the deleted object immediately becomes invalid but
4985bd8deadSopenharmony_ci    the underlying object will not be deleted until it is no longer in
4995bd8deadSopenharmony_ci    use. Unlike other shared object types, a sync object is determined
5005bd8deadSopenharmony_ci    to be in use if there is a corresponding fence command which has not
5015bd8deadSopenharmony_ci    yet completed (signaling the sync object), or if there are any GL
5025bd8deadSopenharmony_ci    clients and/or servers blocked on the sync object as a result of
5035bd8deadSopenharmony_ci    ClientWaitSync or WaitSync commands. Once any corresponding fence
5045bd8deadSopenharmony_ci    commands have completed, a sync object has been signaled, and all
5055bd8deadSopenharmony_ci    clients and/or servers blocked on that sync object have been
5065bd8deadSopenharmony_ci    unblocked, the object may then be deleted.
5075bd8deadSopenharmony_ci
5085bd8deadSopenharmony_ci    D.2.2 Multiple Waiters in Multiple Contexts
5095bd8deadSopenharmony_ci    -------------------------------------------
5105bd8deadSopenharmony_ci
5115bd8deadSopenharmony_ci    When multiple GL clients and/or servers are blocked on a single sync
5125bd8deadSopenharmony_ci    object and that sync object is signaled, all such blocks are
5135bd8deadSopenharmony_ci    released. The order in which blocks are released is
5145bd8deadSopenharmony_ci    implementation-dependent."
5155bd8deadSopenharmony_ci
5165bd8deadSopenharmony_ci
5175bd8deadSopenharmony_ci    Promote the fifth paragraph of section D.3 "Propagating State
5185bd8deadSopenharmony_ci    Changes" (following the itemized list of changes to an object) to a
5195bd8deadSopenharmony_ci    new subsection D.3.1. Renumber the existing subsection D.3.1
5205bd8deadSopenharmony_ci    "Definitions" and all following D.3.* subsections.
5215bd8deadSopenharmony_ci
5225bd8deadSopenharmony_ci   "D.3.1 Determining Completion of Changes to an object
5235bd8deadSopenharmony_ci    ----------------------------------------------------
5245bd8deadSopenharmony_ci
5255bd8deadSopenharmony_ci    The object T is considered to have been changed once a command such
5265bd8deadSopenharmony_ci    as described in section D.3 has completed. Completion of a
5275bd8deadSopenharmony_ci    command[fn5] may be determined either by calling Finish, or by
5285bd8deadSopenharmony_ci    calling FenceSync and executing a WaitSync command on the associated
5295bd8deadSopenharmony_ci    sync object. The second method does not require a round trip to the
5305bd8deadSopenharmony_ci    GL server and may be more efficient, particularly when changes to T
5315bd8deadSopenharmony_ci    in one context must be known to have completed before executing
5325bd8deadSopenharmony_ci    commands dependent on those changes in another context.
5335bd8deadSopenharmony_ci       [fn5: The GL already specifies that a single context processes
5345bd8deadSopenharmony_ci             commands in the order they are received. This means that a
5355bd8deadSopenharmony_ci             change to an object in a context at time <t> must be
5365bd8deadSopenharmony_ci             completed by the time a command issued in the same context
5375bd8deadSopenharmony_ci             at time <t+1> uses the result of that change.]"
5385bd8deadSopenharmony_ci
5395bd8deadSopenharmony_ci    Change all references to "calling Finish" or "using Finish" in
5405bd8deadSopenharmony_ci    section D.3.3 "Rules" to refer to section D.3.1.
5415bd8deadSopenharmony_ci
5425bd8deadSopenharmony_ciAdditions to the GLX 1.4 Specification
5435bd8deadSopenharmony_ci
5445bd8deadSopenharmony_ci    Insert a new section after section 2.5, "Texture Objects":
5455bd8deadSopenharmony_ci
5465bd8deadSopenharmony_ci    "2.6 Sync Objects
5475bd8deadSopenharmony_ci
5485bd8deadSopenharmony_ci    Sync objects are shared by rendering contexts in the same fashion as
5495bd8deadSopenharmony_ci    texture objects (see Appendix D, "Shared Objects and Multiple
5505bd8deadSopenharmony_ci    Contexts", of the OpenGL 3.1 Specification). If a sync object is
5515bd8deadSopenharmony_ci    blocked upon (glClientWaitSync or glWaitSync), signaled
5525bd8deadSopenharmony_ci    (glSignalSync), or has events associated with it (glFence) from more
5535bd8deadSopenharmony_ci    than one context, then it is up to the programmer to ensure that the
5545bd8deadSopenharmony_ci    correct order of operations results, and that race conditions and
5555bd8deadSopenharmony_ci    deadlocks are avoided.
5565bd8deadSopenharmony_ci
5575bd8deadSopenharmony_ci    All modifications to shared context state as a changing the status
5585bd8deadSopenharmony_ci    of a sync object are atomic. Also, a sync object will not be deleted
5595bd8deadSopenharmony_ci    until there are no longer any outstanding fence commands or blocks
5605bd8deadSopenharmony_ci    associated with it."
5615bd8deadSopenharmony_ci
5625bd8deadSopenharmony_ci    Replace the third paragraph of section 3.3.7, "Rendering Contexts":
5635bd8deadSopenharmony_ci
5645bd8deadSopenharmony_ci    "If <share_list> is not NULL, then all shareable GL server state
5655bd8deadSopenharmony_ci    (excluding texture objects named 0) will be shared by <share_list>
5665bd8deadSopenharmony_ci    and the newly created rendering context. An arbitrary number of
5675bd8deadSopenharmony_ci    GLXContexts can share server state. The server context state for all
5685bd8deadSopenharmony_ci    sharing contexts must exist in a single address space or a BadMatch
5695bd8deadSopenharmony_ci    error is generated."
5705bd8deadSopenharmony_ci
5715bd8deadSopenharmony_ciGLX Protocol
5725bd8deadSopenharmony_ci
5735bd8deadSopenharmony_ci    <TBD>
5745bd8deadSopenharmony_ci
5755bd8deadSopenharmony_ciErrors
5765bd8deadSopenharmony_ci
5775bd8deadSopenharmony_ci    INVALID_VALUE is generated if the <sync> parameter of
5785bd8deadSopenharmony_ci    ClientWaitSync, SignalSync, WaitSync, or GetSynciv is not the name
5795bd8deadSopenharmony_ci    of a sync object.
5805bd8deadSopenharmony_ci
5815bd8deadSopenharmony_ci    INVALID_VALUE is generated if the <sync> parameter of DeleteSync
5825bd8deadSopenharmony_ci    is neither zero nor the name of a sync object.
5835bd8deadSopenharmony_ci
5845bd8deadSopenharmony_ci    INVALID_ENUM is generated if the <condition> parameter of FenceSync
5855bd8deadSopenharmony_ci    is not SYNC_GPU_COMMANDS_COMPLETE.
5865bd8deadSopenharmony_ci
5875bd8deadSopenharmony_ci    INVALID_VALUE is generated if the <flags> parameter of
5885bd8deadSopenharmony_ci    ClientWaitSync contains bits other than SYNC_FLUSH_COMMANDS_BIT, or
5895bd8deadSopenharmony_ci    if the <flags> parameter of WaitSync is nonzero.
5905bd8deadSopenharmony_ci
5915bd8deadSopenharmony_ci    INVALID_ENUM is generated if the <mode> parameter of SignalSync is
5925bd8deadSopenharmony_ci    not SIGNALED.
5935bd8deadSopenharmony_ci
5945bd8deadSopenharmony_ci    INVALID_ENUM is generated if the <pname> parameter of GetSynciv is
5955bd8deadSopenharmony_ci    neither OBJECT_TYPE, SYNC_CONDITION, SYNC_FLAGS, nor SYNC_STATUS.
5965bd8deadSopenharmony_ci
5975bd8deadSopenharmony_ciNew State
5985bd8deadSopenharmony_ci
5995bd8deadSopenharmony_ciTable 6.X.  Sync Objects.
6005bd8deadSopenharmony_ci
6015bd8deadSopenharmony_ciGet value           Type  Get command Initial value                 Description           Section
6025bd8deadSopenharmony_ci------------------  ----  ----------- ----------------------------  ---------------       -------
6035bd8deadSopenharmony_ciOBJECT_TYPE         Z_1   GetSynciv  SYNC_FENCE             Type of sync object    5.2
6045bd8deadSopenharmony_ciSYNC_STATUS         Z_2   GetSynciv  UNSIGNALED             Sync object status     5.2
6055bd8deadSopenharmony_ciSYNC_CONDITION      Z_1   GetSynciv  SYNC_GPU_COMMANDS_COMPLETE    Sync object condition  5.2
6065bd8deadSopenharmony_ciSYNC_FLAGS          Z     GetSynciv  SYNC_FLAGS             Sync object flags      5.2
6075bd8deadSopenharmony_ci
6085bd8deadSopenharmony_ciNew Implementation Dependent State
6095bd8deadSopenharmony_ci
6105bd8deadSopenharmony_ciTable 40. Implementation Dependent Values (cont.)
6115bd8deadSopenharmony_ci
6125bd8deadSopenharmony_ciGet value           Type  Get command   Minimum value                 Description           Section
6135bd8deadSopenharmony_ci------------------  ----  ------------- ----------------------------  ---------------       -------
6145bd8deadSopenharmony_ciMAX_SERVER_WAIT_    Z^+   GetInteger64v 0                             Maximum WaitSync      5.2
6155bd8deadSopenharmony_ci    TIMEOUT                                                           timeout interval
6165bd8deadSopenharmony_ci
6175bd8deadSopenharmony_ciSample Code
6185bd8deadSopenharmony_ci
6195bd8deadSopenharmony_ci    ... kick off a length GL operation
6205bd8deadSopenharmony_ci    /* Place a fence and associate a fence sync object */
6215bd8deadSopenharmony_ci    GLsync sync = glFenceSync(GLSYNC_GPU_COMMANDS_COMPLETE, 0);
6225bd8deadSopenharmony_ci
6235bd8deadSopenharmony_ci    /* Elsewhere, wait for the sync to be signaled */
6245bd8deadSopenharmony_ci
6255bd8deadSopenharmony_ci    /* To wait a specified amount of time (possibly clamped), do
6265bd8deadSopenharmony_ci     * this to convert a time in seconds into nanoseconds:
6275bd8deadSopenharmony_ci     */
6285bd8deadSopenharmony_ci    GLuint64 timeout = num_seconds * ((GLuint64)1000 * 1000 * 1000);
6295bd8deadSopenharmony_ci    glWaitSync(sync, 0, timeout);
6305bd8deadSopenharmony_ci
6315bd8deadSopenharmony_ci    /* Or to determine the maximum possible wait interval and wait
6325bd8deadSopenharmony_ci     * that long, do this instead:
6335bd8deadSopenharmony_ci     */
6345bd8deadSopenharmony_ci    GLuint64 max_timeout;
6355bd8deadSopenharmony_ci    glGetInteger64v(GL_MAX_SERVER_WAIT_TIMEOUT, &max_timeout);
6365bd8deadSopenharmony_ci    glWaitSync(sync, 0, max_timeout);
6375bd8deadSopenharmony_ci
6385bd8deadSopenharmony_ciIssues
6395bd8deadSopenharmony_ci
6405bd8deadSopenharmony_ci    1) Are sync objects shareable between multiple contexts?
6415bd8deadSopenharmony_ci
6425bd8deadSopenharmony_ci        RESOLVED: YES. The sync object namespace is shared, and sync
6435bd8deadSopenharmony_ci        objects themselves may be shared or not. Shared sync objects can
6445bd8deadSopenharmony_ci        be blocked upon or deleted from any context they're shared with.
6455bd8deadSopenharmony_ci
6465bd8deadSopenharmony_ci        Enabling multi-context aware sync objects is a major change from
6475bd8deadSopenharmony_ci        earlier versions of the specification. We believe this is now OK
6485bd8deadSopenharmony_ci        because the rules defining sync object signaling behavior are
6495bd8deadSopenharmony_ci        clear enough to make us comfortable with restoring full
6505bd8deadSopenharmony_ci        multi-context awareness.
6515bd8deadSopenharmony_ci
6525bd8deadSopenharmony_ci    2) What specializations of sync objects are supported?
6535bd8deadSopenharmony_ci
6545bd8deadSopenharmony_ci        RESOLVED: Only fence sync objects (corresponding to synchronous
6555bd8deadSopenharmony_ci        command stream fences). Additionally, fence sync objects are
6565bd8deadSopenharmony_ci        constrained so that fence "stacking" is not allowed - the
6575bd8deadSopenharmony_ci        initial status of a fence sync is unsignaled, and it may only be
6585bd8deadSopenharmony_ci        signaled.
6595bd8deadSopenharmony_ci
6605bd8deadSopenharmony_ci        We expect to define a way to map sync objects into OpenCL events
6615bd8deadSopenharmony_ci        to help performance of CL/GL sharing.
6625bd8deadSopenharmony_ci
6635bd8deadSopenharmony_ci        EGL sync objects (from the EGL_KHR_sync extension) should be
6645bd8deadSopenharmony_ci        compatible with GL sync objects, although the sync object
6655bd8deadSopenharmony_ci        namespace may require remapping between APIs. Also, EGL sync
6665bd8deadSopenharmony_ci        objects do support fence stacking and unsignaling, possibly
6675bd8deadSopenharmony_ci        imposing greater complexity and risk of hanging when used with
6685bd8deadSopenharmony_ci        GL.
6695bd8deadSopenharmony_ci
6705bd8deadSopenharmony_ci        The sync object framework is intended to generalize to other
6715bd8deadSopenharmony_ci        types of sync objects, such as mappings of OS-specific events
6725bd8deadSopenharmony_ci        and semaphores, new specializations of sync objects such as
6735bd8deadSopenharmony_ci        "pulsed" sync objects associated with video retrace, or other
6745bd8deadSopenharmony_ci        command stream conditions, such as sync objects which would be
6755bd8deadSopenharmony_ci        associated with completion of single or multiple asynchronous GL
6765bd8deadSopenharmony_ci        commands.
6775bd8deadSopenharmony_ci
6785bd8deadSopenharmony_ci    3) What fence sync object conditions are supported?
6795bd8deadSopenharmony_ci
6805bd8deadSopenharmony_ci        RESOLVED: The conditions SYNC_GPU_COMMANDS_COMPLETE (equivalent
6815bd8deadSopenharmony_ci        to ALL_COMPLETED_NV in NV_fence), meaning that a fence command
6825bd8deadSopenharmony_ci        has completed in the GPU pipe.
6835bd8deadSopenharmony_ci
6845bd8deadSopenharmony_ci        In the future, we could define two additional conditions:
6855bd8deadSopenharmony_ci
6865bd8deadSopenharmony_ci        SYNC_SERVER_COMMANDS_COMPLETE would correspond to a command
6875bd8deadSopenharmony_ci        completing "in the server"; the exact definition of "server"
6885bd8deadSopenharmony_ci        would have to be nailed down, but generally meaning that the
6895bd8deadSopenharmony_ci        command has been issued to the GPU by the driver. The primary
6905bd8deadSopenharmony_ci        purpose of this condition would be to delay use of an object in
6915bd8deadSopenharmony_ci        one context until after it has been created in another context,
6925bd8deadSopenharmony_ci        so if it proves too difficult to define "server", the condition
6935bd8deadSopenharmony_ci        could be restricted to simply meaning that all object creation
6945bd8deadSopenharmony_ci        commands prior to the fence have realized their effect on server
6955bd8deadSopenharmony_ci        state.
6965bd8deadSopenharmony_ci
6975bd8deadSopenharmony_ci        SYNC_CLIENT_COMMANDS_COMPLETE, would correspond to a command
6985bd8deadSopenharmony_ci        being issued from the client to the server (although this can
6995bd8deadSopenharmony_ci        effectively be done already, by explicitly signaling a sync
7005bd8deadSopenharmony_ci        object in the client).
7015bd8deadSopenharmony_ci
7025bd8deadSopenharmony_ci    4) What state is associated with a sync object? Should state be
7035bd8deadSopenharmony_ci       validated at creation time, or when events are associated with a
7045bd8deadSopenharmony_ci       sync? This would express itself (for example) by passing a
7055bd8deadSopenharmony_ci       <condition> parameter to Fence(), rather than to Sync().
7065bd8deadSopenharmony_ci
7075bd8deadSopenharmony_ci        RESOLVED: sync object state includes specialization (type),
7085bd8deadSopenharmony_ci        condition, flags, and status. Status is mutable data; condition
7095bd8deadSopenharmony_ci        and flags are immutable properties defined defined at creation
7105bd8deadSopenharmony_ci        time.
7115bd8deadSopenharmony_ci
7125bd8deadSopenharmony_ci        In the future, additional state and data may be introduced, such
7135bd8deadSopenharmony_ci        as a timestamp when the sync object was last signaled, or a
7145bd8deadSopenharmony_ci        swapbuffer / media stream count (SBC/MSC, in digital media
7155bd8deadSopenharmony_ci        terminology), for a sync object triggered by display retrace.
7165bd8deadSopenharmony_ci
7175bd8deadSopenharmony_ci    5) What is the purpose of the flags argument to FenceSync?
7185bd8deadSopenharmony_ci
7195bd8deadSopenharmony_ci        RESOLVED: The flags argument is expected to be used by a vendor
7205bd8deadSopenharmony_ci        extension to create sync objects in a broader sharing domain
7215bd8deadSopenharmony_ci        than GLX/WGL share groups. In the future we may reintroduce the
7225bd8deadSopenharmony_ci        generic property list mechanism if a generic sync object
7235bd8deadSopenharmony_ci        creation call is defined for multiple types of sync objects, but
7245bd8deadSopenharmony_ci        for fence sync objects alone, the flags parameter is sufficient
7255bd8deadSopenharmony_ci        flexibility.
7265bd8deadSopenharmony_ci
7275bd8deadSopenharmony_ci    6) Can sync objects and NV_fence fences share enumerants and/or the
7285bd8deadSopenharmony_ci       namespace of fences / sync objects?
7295bd8deadSopenharmony_ci
7305bd8deadSopenharmony_ci        RESOLVED: NO. The sync object namespace cannot be the same as
7315bd8deadSopenharmony_ci        NV_fence since NV_fence does not put fence names on the share
7325bd8deadSopenharmony_ci        list, while sync objects and their names are shared. We will
7335bd8deadSopenharmony_ci        also not reuse enumerant values. The sync object interface is
7345bd8deadSopenharmony_ci        quite a bit different from NV_fence even though the underlying
7355bd8deadSopenharmony_ci        fence functionality is not.
7365bd8deadSopenharmony_ci
7375bd8deadSopenharmony_ci    7) Should we allow these commands to be compiled within display
7385bd8deadSopenharmony_ci       lists?
7395bd8deadSopenharmony_ci
7405bd8deadSopenharmony_ci        RESOLVED: WaitSync and SignalSync are display listable. They
7415bd8deadSopenharmony_ci        execute on the GL server or in the GL pipeline.
7425bd8deadSopenharmony_ci
7435bd8deadSopenharmony_ci        RESOLVED: ClientWaitSync and FenceSync are not display listable.
7445bd8deadSopenharmony_ci        ClientWaitSync is defined to block the application, not the
7455bd8deadSopenharmony_ci        server. FenceSync must return a value to the application.
7465bd8deadSopenharmony_ci
7475bd8deadSopenharmony_ci        (Note: this is not relevant to this draft of the extension,
7485bd8deadSopenharmony_ci        which is written against core OpenGL 3.1. However, an
7495bd8deadSopenharmony_ci        implementation supporting the ARB_compatibility extension should
7505bd8deadSopenharmony_ci        behave as described. We may wish to add this qualified language
7515bd8deadSopenharmony_ci        to the extension if it's to be shipped against such an
7525bd8deadSopenharmony_ci        implementation).
7535bd8deadSopenharmony_ci
7545bd8deadSopenharmony_ci    8) What happens if you set a fence command for a sync object while a
7555bd8deadSopenharmony_ci       previous fence command is still in flight? Are fences
7565bd8deadSopenharmony_ci       "stackable"? (also see issue 21)
7575bd8deadSopenharmony_ci
7585bd8deadSopenharmony_ci        RESOLVED: Fences are not stackable at present. A single fence
7595bd8deadSopenharmony_ci        command is associated with a fence sync object when it is
7605bd8deadSopenharmony_ci        created. In the future we might reintroduce the separate sync
7615bd8deadSopenharmony_ci        creation (Sync()) and fence-associated (Fence()) commands
7625bd8deadSopenharmony_ci        present in prior drafts, with all the complexity of stacking
7635bd8deadSopenharmony_ci        defined therein.
7645bd8deadSopenharmony_ci
7655bd8deadSopenharmony_ci        As with OS synchronization primitives, applications are
7665bd8deadSopenharmony_ci        responsible for using sync objects and fences in ways that avoid
7675bd8deadSopenharmony_ci        race conditions and hangs. Removing stackable fences may help
7685bd8deadSopenharmony_ci        reduce the possibility of such errors.
7695bd8deadSopenharmony_ci
7705bd8deadSopenharmony_ci        We are still considering potential performance issues and
7715bd8deadSopenharmony_ci        semantic difficulties of namespace sharing (e.g. when does a
7725bd8deadSopenharmony_ci        name returned by FenceSync become valid in other contexts of the
7735bd8deadSopenharmony_ci        share group) associated with this model.
7745bd8deadSopenharmony_ci
7755bd8deadSopenharmony_ci    9) What happens to *WaitSyncs blocking on a sync object, and to an
7765bd8deadSopenharmony_ci       associated fence command still pending execution, when the sync
7775bd8deadSopenharmony_ci       object is deleted?
7785bd8deadSopenharmony_ci
7795bd8deadSopenharmony_ci        RESOLVED: Following the OpenGL 3.0 shared object model, the sync
7805bd8deadSopenharmony_ci        object name is immediately deleted, but the underlying sync
7815bd8deadSopenharmony_ci        object is not deleted until all such outstanding references on
7825bd8deadSopenharmony_ci        it are removed.
7835bd8deadSopenharmony_ci
7845bd8deadSopenharmony_ci        NOTE: This specifies behavior left intentionally unspecified by
7855bd8deadSopenharmony_ci        earlier versions of this extension.
7865bd8deadSopenharmony_ci
7875bd8deadSopenharmony_ci    10) Is it possible to have multiple *WaitSyncs blocking on a single
7885bd8deadSopenharmony_ci        sync object?
7895bd8deadSopenharmony_ci
7905bd8deadSopenharmony_ci        RESOLVED: YES, since we support multi-context aware sync
7915bd8deadSopenharmony_ci        objects. *WaitSync might be issued from multiple contexts on the
7925bd8deadSopenharmony_ci        same sync object. Additionally, multiple WaitSync commands may
7935bd8deadSopenharmony_ci        be queued on a single GL server (although only one of them can
7945bd8deadSopenharmony_ci        actually be blocking at any given time).
7955bd8deadSopenharmony_ci
7965bd8deadSopenharmony_ci    11) Can we determine completion time of a sync object?
7975bd8deadSopenharmony_ci
7985bd8deadSopenharmony_ci        RESOLVED: NO.
7995bd8deadSopenharmony_ci
8005bd8deadSopenharmony_ci        In the future, we may support variants of sync objects that
8015bd8deadSopenharmony_ci        record their completion time in queriable object data.
8025bd8deadSopenharmony_ci
8035bd8deadSopenharmony_ci    12) Can we block on multiple sync objects?
8045bd8deadSopenharmony_ci
8055bd8deadSopenharmony_ci        RESOLVED: NO.
8065bd8deadSopenharmony_ci
8075bd8deadSopenharmony_ci        In the future, *WaitSyncs calls taking a list of sync object
8085bd8deadSopenharmony_ci        names, a logical condition (any/all complete), and optionally
8095bd8deadSopenharmony_ci        returning an index/name of a sync object triggering the
8105bd8deadSopenharmony_ci        condition, like the GL2_async_object API, could be added.
8115bd8deadSopenharmony_ci
8125bd8deadSopenharmony_ci    13) Why don't the entry points/enums have ARB appended?
8135bd8deadSopenharmony_ci
8145bd8deadSopenharmony_ci        This functionality is going directly into the OpenGL 3.2 core
8155bd8deadSopenharmony_ci        and also being defined as an extension for older platforms at
8165bd8deadSopenharmony_ci        the same time, so it does not use ARB suffixes, like other such
8175bd8deadSopenharmony_ci        new features going directly into the GL core.
8185bd8deadSopenharmony_ci
8195bd8deadSopenharmony_ci    14) Where can sync objects be waited on?
8205bd8deadSopenharmony_ci
8215bd8deadSopenharmony_ci        RESOLVED: In the client on the CPU, or in the GL server, either
8225bd8deadSopenharmony_ci        in the CPU or GPU.
8235bd8deadSopenharmony_ci
8245bd8deadSopenharmony_ci        Rather than specifying where to wait in the server, the
8255bd8deadSopenharmony_ci        implementation is allowed to choose.
8265bd8deadSopenharmony_ci
8275bd8deadSopenharmony_ci    15) Can the specialization of sync objects be changed, once created?
8285bd8deadSopenharmony_ci
8295bd8deadSopenharmony_ci        RESOLVED: NO.
8305bd8deadSopenharmony_ci
8315bd8deadSopenharmony_ci        This seems likely to cause errors and has little obvious use -
8325bd8deadSopenharmony_ci        making sync objects persistent (being able to reset their status
8335bd8deadSopenharmony_ci        and associate them with a new fence) should suffice to avoid
8345bd8deadSopenharmony_ci        excessive creation/deletion of objects.
8355bd8deadSopenharmony_ci
8365bd8deadSopenharmony_ci    16) How can sync objects be used to facilitate asynchronous
8375bd8deadSopenharmony_ci        operations, particularly large data transfer operations?
8385bd8deadSopenharmony_ci
8395bd8deadSopenharmony_ci        DISCUSSION: There are several methods. A more readily
8405bd8deadSopenharmony_ci        supportable one uses multiple GL contexts and threads, with work
8415bd8deadSopenharmony_ci        performed in one thread associated with a sync. Another thread
8425bd8deadSopenharmony_ci        finishes, tests for completion, or waits on that sync, depending
8435bd8deadSopenharmony_ci        on the exact semantic needed.
8445bd8deadSopenharmony_ci
8455bd8deadSopenharmony_ci        This method is implementable, but has the disadvantage of requiring
8465bd8deadSopenharmony_ci        multiple contexts, drawing surfaces, and CPU threads. It also
8475bd8deadSopenharmony_ci        requires some additional, possibly non-GL synchronization
8485bd8deadSopenharmony_ci        between the threads (so that the work thread knows when the sync
8495bd8deadSopenharmony_ci        created in the loader thread is valid - otherwise it can't be
8505bd8deadSopenharmony_ci        tested without raising an error!)
8515bd8deadSopenharmony_ci
8525bd8deadSopenharmony_ci        It seems analogous to pbuffers in terms of overhead. That
8535bd8deadSopenharmony_ci        suggests lighter-weight mechanisms may be preferable, in the
8545bd8deadSopenharmony_ci        same fashion that framebuffer objects have become preferable to
8555bd8deadSopenharmony_ci        pbuffers.
8565bd8deadSopenharmony_ci
8575bd8deadSopenharmony_ci        A more future-looking mechanism is to support multiple command
8585bd8deadSopenharmony_ci        streams within a single context. Then the expensive asynchronous
8595bd8deadSopenharmony_ci        operations can be kicked off without additional CPU threads,
8605bd8deadSopenharmony_ci        rendering surfaces, or contexts.
8615bd8deadSopenharmony_ci
8625bd8deadSopenharmony_ci        This concept has not been implemented in GL yet, although the
8635bd8deadSopenharmony_ci        original 3Dlabs white paper outlines an approach to it. The
8645bd8deadSopenharmony_ci        desire for consistency / reproducibility means that retrofitting
8655bd8deadSopenharmony_ci        multiple command streams onto the current API, defining when and
8665bd8deadSopenharmony_ci        how resources changed in one stream affect another stream, may
8675bd8deadSopenharmony_ci        require a great deal of spec work. Furthermore, most hardware
8685bd8deadSopenharmony_ci        does not actually support multiple command streams, at least in
8695bd8deadSopenharmony_ci        full generality.
8705bd8deadSopenharmony_ci
8715bd8deadSopenharmony_ci        If we do support multiple command streams, then at least at
8725bd8deadSopenharmony_ci        first, there will probably be severe restrictions on what
8735bd8deadSopenharmony_ci        commands could go in additional streams beyond the "main" or
8745bd8deadSopenharmony_ci        "default" stream.
8755bd8deadSopenharmony_ci
8765bd8deadSopenharmony_ci        In either case, we will probably need to either define new
8775bd8deadSopenharmony_ci        commands that are allowed to operate asynchronously (e.g.
8785bd8deadSopenharmony_ci        TexImageAsync) with respect to surrounding commands, or to
8795bd8deadSopenharmony_ci        overload existing commands to operate asynchronously when
8805bd8deadSopenharmony_ci        some global state is set, like the old SGI_async extension.
8815bd8deadSopenharmony_ci
8825bd8deadSopenharmony_ci        Note that buffer objects allow the GL to implement data transfer
8835bd8deadSopenharmony_ci        into, or out of, the buffer object to occur asynchronously.
8845bd8deadSopenharmony_ci        However, once the transfer is completed, that data is in a buffer
8855bd8deadSopenharmony_ci        object and not stored in memory that is under application control.
8865bd8deadSopenharmony_ci
8875bd8deadSopenharmony_ci        In defining these commands, we will probably need some way to
8885bd8deadSopenharmony_ci        associate a sync object with them at the time they're issued,
8895bd8deadSopenharmony_ci        not just place a fence following the async command. One reason
8905bd8deadSopenharmony_ci        for this is wanting to know when the application data passed
8915bd8deadSopenharmony_ci        into an asynchronous command has been consumed and can safely be
8925bd8deadSopenharmony_ci        modified by the app.
8935bd8deadSopenharmony_ci
8945bd8deadSopenharmony_ci    17) Can the query object framework be used to support sync objects?
8955bd8deadSopenharmony_ci
8965bd8deadSopenharmony_ci        RESOLVED: NO.
8975bd8deadSopenharmony_ci
8985bd8deadSopenharmony_ci        It is straightforward to map the sync object API onto queries,
8995bd8deadSopenharmony_ci        with the addition of a small number of entry points. However,
9005bd8deadSopenharmony_ci        the query object namespace is defined not to be shared. This
9015bd8deadSopenharmony_ci        makes it impossible to implement shared sync objects in the
9025bd8deadSopenharmony_ci        query namespace without the possibility of breaking existing
9035bd8deadSopenharmony_ci        code that uses the same query name in multiple contexts.
9045bd8deadSopenharmony_ci
9055bd8deadSopenharmony_ci        It is also possible to map occlusion queries into the sync
9065bd8deadSopenharmony_ci        object API, again with the addition of a small number of entry
9075bd8deadSopenharmony_ci        points. We might choose to do this in the future.
9085bd8deadSopenharmony_ci
9095bd8deadSopenharmony_ci    18) Do *WaitSync wait on an event, or on sync object status? What is
9105bd8deadSopenharmony_ci        the meaning of sync object status?
9115bd8deadSopenharmony_ci
9125bd8deadSopenharmony_ci        RESOLVED: *WaitSync blocks until the status of the sync object
9135bd8deadSopenharmony_ci        transitions to the signaled state. Sync object status is either
9145bd8deadSopenharmony_ci        signaled or unsignaled. More detailed rules describing
9155bd8deadSopenharmony_ci        signaling follow (these may need to be imbedded into the actual
9165bd8deadSopenharmony_ci        spec language):
9175bd8deadSopenharmony_ci
9185bd8deadSopenharmony_ci        (Note: much of the following discussion is not relevant for the
9195bd8deadSopenharmony_ci        constrained fence sync objects currently defined by this
9205bd8deadSopenharmony_ci        extension, as such objects start in the unsignaled state and may
9215bd8deadSopenharmony_ci        only transition to the signaled state, not the other way).
9225bd8deadSopenharmony_ci
9235bd8deadSopenharmony_ci        R1) A sync object has two possible status values: signaled or
9245bd8deadSopenharmony_ci            unsignaled (corresponding to SYNC_STATUS values of SIGNALED
9255bd8deadSopenharmony_ci            or UNSIGNALED, respectively).
9265bd8deadSopenharmony_ci
9275bd8deadSopenharmony_ci        R2) When created, the state of the sync object is signaled by
9285bd8deadSopenharmony_ci            default, but may be explicitly set to unsignaled.
9295bd8deadSopenharmony_ci
9305bd8deadSopenharmony_ci        R3) A fence command is inserted into a command stream. A sync
9315bd8deadSopenharmony_ci            object is not.
9325bd8deadSopenharmony_ci
9335bd8deadSopenharmony_ci        R4) When a fence command is inserted into a command stream using
9345bd8deadSopenharmony_ci            Fence(), the status of the sync object associated with that
9355bd8deadSopenharmony_ci            fence command is set to the unsignaled state.
9365bd8deadSopenharmony_ci
9375bd8deadSopenharmony_ci        R5) Multiple fence commands can be associated with the same sync
9385bd8deadSopenharmony_ci            object.
9395bd8deadSopenharmony_ci
9405bd8deadSopenharmony_ci        R6) A fence command, once its condition has been met, will set
9415bd8deadSopenharmony_ci            its associated sync object to the signaled state. The only
9425bd8deadSopenharmony_ci            condition currently supported is SYNC_GPU_COMMANDS_COMPLETE.
9435bd8deadSopenharmony_ci
9445bd8deadSopenharmony_ci        R7) A wait function, such as ClientWaitSync or WaitSync, waits
9455bd8deadSopenharmony_ci            on a sync object, not on a fence.
9465bd8deadSopenharmony_ci
9475bd8deadSopenharmony_ci        R8) A wait function called on a sync object in the unsignaled
9485bd8deadSopenharmony_ci            state will block. It unblocks (note, not "returns to the
9495bd8deadSopenharmony_ci            application") when the sync object transitions to the
9505bd8deadSopenharmony_ci            signaled state.
9515bd8deadSopenharmony_ci
9525bd8deadSopenharmony_ci        Some of the behaviors resulting from these rules are:
9535bd8deadSopenharmony_ci
9545bd8deadSopenharmony_ci        B1) Calling ClientWaitSync with a timeout of 0 will return TRUE
9555bd8deadSopenharmony_ci            if the sync object is in the signaled state. Note that
9565bd8deadSopenharmony_ci            calling ClientWaitSync with a timeout of 0 in a loop can
9575bd8deadSopenharmony_ci            miss state transitions.
9585bd8deadSopenharmony_ci        B2) Stacking fences is allowed. Each fence, once its condition
9595bd8deadSopenharmony_ci            has been met, will set its associated sync object to the
9605bd8deadSopenharmony_ci            signaled state. If the sync object is already in the
9615bd8deadSopenharmony_ci            signaled state, it stays in that state.
9625bd8deadSopenharmony_ci        B3) ClientWaitSync could take a timeout parameter and return a
9635bd8deadSopenharmony_ci            boolean. If the timeout period has expired, ClientWaitSync
9645bd8deadSopenharmony_ci            will unblock and return FALSE to the caller. If
9655bd8deadSopenharmony_ci            ClientWaitSync unblocks because the sync object it was
9665bd8deadSopenharmony_ci            waiting on is in the signaled state, it will return TRUE.
9675bd8deadSopenharmony_ci        B4) We could define a FinishMultipleSync() command that will
9685bd8deadSopenharmony_ci            unblock once all (or any) of the sync objects passed to it
9695bd8deadSopenharmony_ci            are in the signaled state (also see issue 12).
9705bd8deadSopenharmony_ci        B5) We could define a set/resetSyncObject function to manually
9715bd8deadSopenharmony_ci            set the sync object in the signaled or unsignaled state.
9725bd8deadSopenharmony_ci            This makes it easy for apps to reuse a sync object in the
9735bd8deadSopenharmony_ci            multi-context case, so the sync object can be blocked upon
9745bd8deadSopenharmony_ci            before a fence command is associated with it in the command
9755bd8deadSopenharmony_ci            stream.
9765bd8deadSopenharmony_ci        B6) We could define an API to convert a sync object into an OS
9775bd8deadSopenharmony_ci            specific synchronization primitive (Events on Windows, file
9785bd8deadSopenharmony_ci            descriptors or X-events or semaphores on Unix?)
9795bd8deadSopenharmony_ci
9805bd8deadSopenharmony_ci    19) Which of the behaviors defined in issue 18 should be added?
9815bd8deadSopenharmony_ci
9825bd8deadSopenharmony_ci        RESOLVED: Add B1, B2, and B3 (timeout functionality).
9835bd8deadSopenharmony_ci
9845bd8deadSopenharmony_ci        We considered several possibilities including passing a <unit
9855bd8deadSopenharmony_ci        duration,count> tuple, and adding a TIMEOUT_BIT to the flags to
9865bd8deadSopenharmony_ci        representing "forever". The end result of discussion was to
9875bd8deadSopenharmony_ci        introduce a new GL datatype, GLuint64. GLuint64 is a 64-bit
9885bd8deadSopenharmony_ci        unsigned integer representing intervals in nanoseconds - the
9895bd8deadSopenharmony_ci        same encoding as the Unadjusted System Time (UST) counter used
9905bd8deadSopenharmony_ci        in OpenML and OpenKODE. All future uses of time in the GL should
9915bd8deadSopenharmony_ci        use the GLuint64 datatype.
9925bd8deadSopenharmony_ci
9935bd8deadSopenharmony_ci        At present, the timeout duration passed to *WaitSync represents
9945bd8deadSopenharmony_ci        a time relative to when the driver actually begins waiting. A
9955bd8deadSopenharmony_ci        future extension could easily allow waiting until a specific UST
9965bd8deadSopenharmony_ci        by adding a bit to the flags specifying that timeout is
9975bd8deadSopenharmony_ci        absolute, not relative.
9985bd8deadSopenharmony_ci
9995bd8deadSopenharmony_ci        RESOLVED: Do not add B4 yet (easy to put in a future extension).
10005bd8deadSopenharmony_ci
10015bd8deadSopenharmony_ci        RESOLVED: Add B5 with a new glSignalSync call taking modes of
10025bd8deadSopenharmony_ci        SIGNALED or UNSIGNALED. Might add a PULSED mode in the future,
10035bd8deadSopenharmony_ci        but that's a bit weird - what if the sync object is already
10045bd8deadSopenharmony_ci        signaled?
10055bd8deadSopenharmony_ci
10065bd8deadSopenharmony_ci        RESOLVED: Add B6 via a WGL extension supporting only
10075bd8deadSopenharmony_ci        wglConvertSyncToEvent (no wglConvertEventToSync). Figure out the
10085bd8deadSopenharmony_ci        corresponding Unix/X functionality and define that as well -
10095bd8deadSopenharmony_ci        should it use pthreads? xsync objects? System V IPC semaphores?
10105bd8deadSopenharmony_ci        etc.
10115bd8deadSopenharmony_ci
10125bd8deadSopenharmony_ci    20) How can multi-context aware sync objects be used to synchronize
10135bd8deadSopenharmony_ci        two contexts?
10145bd8deadSopenharmony_ci
10155bd8deadSopenharmony_ci        NOTE: This example needs to be rewritten to accomodate changes
10165bd8deadSopenharmony_ci        to the API and asynchronous object creation. In particular,
10175bd8deadSopenharmony_ci        context B must wait for the shared sync object to be
10185bd8deadSopenharmony_ci        successfully created before waiting on it, which requires either
10195bd8deadSopenharmony_ci        platform-specific (non-OpenGL) code, or client-side cleverness
10205bd8deadSopenharmony_ci        suggested by Bill Licea-Kane. There should also be an example
10215bd8deadSopenharmony_ci        showing specifically how to use sync objects and server waiting
10225bd8deadSopenharmony_ci        to coordinate waiting on creation of another object.
10235bd8deadSopenharmony_ci
10245bd8deadSopenharmony_ci        Example of context B waiting on context A:
10255bd8deadSopenharmony_ci
10265bd8deadSopenharmony_ci        A:  // Create a sync object in the unsignaled state
10275bd8deadSopenharmony_ci            int props[] = {
10285bd8deadSopenharmony_ci                OBJECT_SHARED, TRUE,
10295bd8deadSopenharmony_ci                SYNC_STATUS, UNSIGNALED };
10305bd8deadSopenharmony_ci
10315bd8deadSopenharmony_ci            syncObjectA = Sync(SYNC_FENCE, 2, props);
10325bd8deadSopenharmony_ci        B:  // Block, since syncObjectA is in the unsignaled state
10335bd8deadSopenharmony_ci            ClientWaitSync(syncObjectA);
10345bd8deadSopenharmony_ci        A:  // Perform rendering that B should wait on
10355bd8deadSopenharmony_ci            render();
10365bd8deadSopenharmony_ci            // Insert a fence into the command stream. syncObjectA
10375bd8deadSopenharmony_ci            // remains in the unsignaled state until completion
10385bd8deadSopenharmony_ci            Fence(syncObjectA);
10395bd8deadSopenharmony_ci            // To prevent deadlock, A must make forward progress
10405bd8deadSopenharmony_ci            Flush();
10415bd8deadSopenharmony_ci        B:  // Once the fence command issued above completes, the
10425bd8deadSopenharmony_ci            // ClientWaitSync issued above will unblock and allow B
10435bd8deadSopenharmony_ci            // to continue.
10445bd8deadSopenharmony_ci
10455bd8deadSopenharmony_ci    21) What is the stacking behavior of fence commands?
10465bd8deadSopenharmony_ci
10475bd8deadSopenharmony_ci        RESOLVED: Stacking is not allowed.
10485bd8deadSopenharmony_ci
10495bd8deadSopenharmony_ci    22) What should the blocking API be called?
10505bd8deadSopenharmony_ci
10515bd8deadSopenharmony_ci        RESOLVED: ClientWaitSync for blocking on the client side.
10525bd8deadSopenharmony_ci        WaitSync for blocking on the GL server (CPU or GPU).
10535bd8deadSopenharmony_ci
10545bd8deadSopenharmony_ci        Previously we used FinishSync by analogy with NV_fence's
10555bd8deadSopenharmony_ci        'glFinishFence'. However, the call may return before an event
10565bd8deadSopenharmony_ci        has actually signaled a sync, due to timeout. Also, other sync
10575bd8deadSopenharmony_ci        object specializations do not necessarily have anything to do
10585bd8deadSopenharmony_ci        with command streams (timers, retrace events, OS events, etc.)
10595bd8deadSopenharmony_ci        So 'Finish' is the wrong name.
10605bd8deadSopenharmony_ci
10615bd8deadSopenharmony_ci    23) How are sync objects implemented in terms of generic object
10625bd8deadSopenharmony_ci        interfaces?
10635bd8deadSopenharmony_ci
10645bd8deadSopenharmony_ci        RESOLVED: An object property name which could be generic is
10655bd8deadSopenharmony_ci        introduced here (OBJECT_TYPE), but no generic object
10665bd8deadSopenharmony_ci        manipulation commands are defined.
10675bd8deadSopenharmony_ci
10685bd8deadSopenharmony_ci    24) Do we need a default sync object that is always present?
10695bd8deadSopenharmony_ci        (Notionally the "sync object named zero")?
10705bd8deadSopenharmony_ci
10715bd8deadSopenharmony_ci        RESOLVED: NO. Fence sync objects cannot provide this
10725bd8deadSopenharmony_ci        functionality. Multiple contexts just have to be clever about
10735bd8deadSopenharmony_ci        use of (potentially client-created) sync object names.
10745bd8deadSopenharmony_ci
10755bd8deadSopenharmony_ci        DISCUSSION: The use case for a default sync object is in
10765bd8deadSopenharmony_ci        coordinating object creation across contexts (see the
10775bd8deadSopenharmony_ci        out-of-date example in issue 20 as well). Suppose we want to
10785bd8deadSopenharmony_ci        know in context B when context A has successfully created an
10795bd8deadSopenharmony_ci        object, so we can start using it. It's possible to do this by
10805bd8deadSopenharmony_ci        inserting a fence command after object creation in A and waiting
10815bd8deadSopenharmony_ci        on sync completion in B. But to do this, first we must have a
10825bd8deadSopenharmony_ci        sync object that is known to exist in both A and B, creating a
10835bd8deadSopenharmony_ci        circular dependency!
10845bd8deadSopenharmony_ci
10855bd8deadSopenharmony_ci        There are several possible approaches.
10865bd8deadSopenharmony_ci
10875bd8deadSopenharmony_ci        1) Create a sync object in context A before forking another
10885bd8deadSopenharmony_ci        thread that would create context B and use it. This wouldn't
10895bd8deadSopenharmony_ci        help in the indirect rendering / separate process model case.
10905bd8deadSopenharmony_ci
10915bd8deadSopenharmony_ci        2) Punt to platform-specific code: create a sync object in A,
10925bd8deadSopenharmony_ci        verify it was successfully created in A, then use
10935bd8deadSopenharmony_ci        platform-specific IPC to let other threads / processes know the
10945bd8deadSopenharmony_ci        sync is ready for use to coordinate object creation. This is
10955bd8deadSopenharmony_ci        highly inelegant.
10965bd8deadSopenharmony_ci
10975bd8deadSopenharmony_ci        3) Mandate that all contexts in a share group have a single,
10985bd8deadSopenharmony_ci        shared sync object defined, which is present from context
10995bd8deadSopenharmony_ci        creation time. When requesting this default object, the driver
11005bd8deadSopenharmony_ci        will either create it, if it doesn't already exist, or return a
11015bd8deadSopenharmony_ci        handle to the existing default object, if it does. The key point
11025bd8deadSopenharmony_ci        is that the handle can be obtained in two different contexts
11035bd8deadSopenharmony_ci        without either one needing to do non-portable or non-GL
11045bd8deadSopenharmony_ci        operations before knowing the handle is valid.
11055bd8deadSopenharmony_ci
11065bd8deadSopenharmony_ci        4) Clever client in context B. Bill has commented on this and
11075bd8deadSopenharmony_ci        people seem to agree this is doable and won't cause any coding
11085bd8deadSopenharmony_ci        issues, so we're assuming it's correct.
11095bd8deadSopenharmony_ci
11105bd8deadSopenharmony_ci    25) Do we need the ability to WaitSync in the GPU, as well
11115bd8deadSopenharmony_ci        as in the server?
11125bd8deadSopenharmony_ci
11135bd8deadSopenharmony_ci        RESOLVED: The implementation is allowed to choose.
11145bd8deadSopenharmony_ci
11155bd8deadSopenharmony_ci    26) How will sync objects be linked to OpenCL events?
11165bd8deadSopenharmony_ci
11175bd8deadSopenharmony_ci        NOTE: This is an issue for a future extension defining a new
11185bd8deadSopenharmony_ci        type of sync object. A suggestion for that extension is
11195bd8deadSopenharmony_ci        circulating on the OpenCL mailing list. This will likely be done
11205bd8deadSopenharmony_ci        as a new command taking a CL event handle and returning a GL
11215bd8deadSopenharmony_ci        sync object behaving like a fence sync, but with a different
11225bd8deadSopenharmony_ci        object type, and triggered by the CL event rather than a fence.
11235bd8deadSopenharmony_ci
11245bd8deadSopenharmony_ci    27) What is the relationship between EGL and OpenGL sync objects?
11255bd8deadSopenharmony_ci
11265bd8deadSopenharmony_ci        The goal is that an EGL-based implementation could support both
11275bd8deadSopenharmony_ci        APIs to a single underlying sync object implementation. It is
11285bd8deadSopenharmony_ci        unlikely that the namespaces of EGL and GL sync objects could be
11295bd8deadSopenharmony_ci        shared, however.
11305bd8deadSopenharmony_ci
11315bd8deadSopenharmony_ci    28) What is the deletion behavior of sync objects?
11325bd8deadSopenharmony_ci
11335bd8deadSopenharmony_ci        RESOLVED: DeleteSync immediately releases the name, but
11345bd8deadSopenharmony_ci        "bindings" of the underlying object, e.g. outstanding fences or
11355bd8deadSopenharmony_ci        blocking commands, will keep its underlying storage around until
11365bd8deadSopenharmony_ci        all such commands complete and unblock all such waiters. This is
11375bd8deadSopenharmony_ci        consistent with the OpenGL 3.0 shared object appendix, except
11385bd8deadSopenharmony_ci        references are formed by commands and blocks, rather than by the
11395bd8deadSopenharmony_ci        attachment hierarchy.
11405bd8deadSopenharmony_ci
11415bd8deadSopenharmony_ci    29) Should there be an implementation-dependent maximum timeout
11425bd8deadSopenharmony_ci        interval?
11435bd8deadSopenharmony_ci
11445bd8deadSopenharmony_ci        RESOLVED: Not for client waits, which may block "forever", but a
11455bd8deadSopenharmony_ci        MAX_SERVER_WAIT_TIMEOUT implementation-dependent value exists,
11465bd8deadSopenharmony_ci        together with a new GetInteger64v query (see issue 30).
11475bd8deadSopenharmony_ci
11485bd8deadSopenharmony_ci        In the Windsor F2F, we agreed to remove the value FOREVER.
11495bd8deadSopenharmony_ci        Because any timeout can be clamped, FOREVER didn't really mean
11505bd8deadSopenharmony_ci        "forever", so it was misleading (and inconsistent with the
11515bd8deadSopenharmony_ci        special treatment of FOREVER in the EGL_KHR_sync spec) to have
11525bd8deadSopenharmony_ci        it. Instead we have a sample code section which shows how to
11535bd8deadSopenharmony_ci        wait a long time.
11545bd8deadSopenharmony_ci
11555bd8deadSopenharmony_ci    30) What is the type of the timeout interval?
11565bd8deadSopenharmony_ci
11575bd8deadSopenharmony_ci        RESOLVED: GLuint64. We previously typedefed uint64_t (or
11585bd8deadSopenharmony_ci        equivalent) as 'GLtime', but now that max timeout intervals are
11595bd8deadSopenharmony_ci        queriable, a query function is required. A generic query for
11605bd8deadSopenharmony_ci        64-bit integer data is more useful than a GLtime-specific query.
11615bd8deadSopenharmony_ci        Consequently the type of <timeout> has been changed to
11625bd8deadSopenharmony_ci        'GLuint64' and a corresponding 'GetInteger64v' query taking
11635bd8deadSopenharmony_ci        'GLint64' added (by symmetry with GetInteger, where unsigned
11645bd8deadSopenharmony_ci        quantities are queries with a function taking a pointer to a
11655bd8deadSopenharmony_ci        signed integer - the pointer conversion is harmless).
11665bd8deadSopenharmony_ci
11675bd8deadSopenharmony_ci        The existing GLintptr argument is not guaranteed to be at least
11685bd8deadSopenharmony_ci        64 bits long, so is not appropriate here.
11695bd8deadSopenharmony_ci
11705bd8deadSopenharmony_ci        NOTE: We might choose a type tag for GLuint64 state other than
11715bd8deadSopenharmony_ci        the existing 'Z^+'. It is indeed a non-negative integer but the
11725bd8deadSopenharmony_ci        difference in size might be worth noting in the state tables.
11735bd8deadSopenharmony_ci
11745bd8deadSopenharmony_ci    31) Potential naming issues
11755bd8deadSopenharmony_ci
11765bd8deadSopenharmony_ci        Are SYNC_CONDITION and SYNC_STATUS too confusingly similar? We
11775bd8deadSopenharmony_ci        could refine these to SYNC_FENCE_CONDITION and
11785bd8deadSopenharmony_ci        SYNC_SIGNAL_STATUS at some wordiness cost, although the existing
11795bd8deadSopenharmony_ci        names match the EGL sync object extension and consistency may be
11805bd8deadSopenharmony_ci        a virtue. There's also a question of whether future types of
11815bd8deadSopenharmony_ci        sync objects would have a use for conditions having nothing to
11825bd8deadSopenharmony_ci        do with fences, e.g. a display sync might have conditions
11835bd8deadSopenharmony_ci        corresponding to different points in the draw / retrace interval
11845bd8deadSopenharmony_ci        cycle, which argues in favor of the existing name.
11855bd8deadSopenharmony_ci
11865bd8deadSopenharmony_ci        There's still time to change names prior to approval of EGL and
11875bd8deadSopenharmony_ci        GL sync objects, if anyone wants to make suggestions.
11885bd8deadSopenharmony_ci
11895bd8deadSopenharmony_ci    32) Do we need an explicit signaling API (SignalSync)?
11905bd8deadSopenharmony_ci
11915bd8deadSopenharmony_ci        RESOLVED: NO, not for fence sync objects. In the future other
11925bd8deadSopenharmony_ci        types of sync objects may choose to reintroduce this API.
11935bd8deadSopenharmony_ci
11945bd8deadSopenharmony_ci    33) What is the datatype of a sync object handle?
11955bd8deadSopenharmony_ci
11965bd8deadSopenharmony_ci        RESOLVED: GLsync, which is defined as an anonymous struct
11975bd8deadSopenharmony_ci        pointer in the C binding. This eases implementability on 64 bit
11985bd8deadSopenharmony_ci        environments by allowing server pointer representations to be
11995bd8deadSopenharmony_ci        used.
12005bd8deadSopenharmony_ci
12015bd8deadSopenharmony_ciRevision History
12025bd8deadSopenharmony_ci
12035bd8deadSopenharmony_ci    Version 1, 2006/02/08 - First writeup as spec language, based on
12045bd8deadSopenharmony_ci    NV_fence.
12055bd8deadSopenharmony_ci
12065bd8deadSopenharmony_ci    Version 2, 2006/02/10 - WaitSync can only wait on fence syncs. Sync
12075bd8deadSopenharmony_ci    types are immutable once created - FenceSync can be called on an
12085bd8deadSopenharmony_ci    existing sync of type fence to rebind it to a new fence command, but
12095bd8deadSopenharmony_ci    it cannot be called on a non-fence sync. Expanded list of errors.
12105bd8deadSopenharmony_ci    Numbered issues list and added issues 13-16. Noted future "multiple
12115bd8deadSopenharmony_ci    command stream" concept in issue 16.
12125bd8deadSopenharmony_ci
12135bd8deadSopenharmony_ci    Version 3, 2006/02/14 - Change FenceSync behavior to leave the sync
12145bd8deadSopenharmony_ci    state undefined if a previously issued fence command is still
12155bd8deadSopenharmony_ci    in-flight when a fence sync is reset. Add a flags parameter to
12165bd8deadSopenharmony_ci    FinishSync which can be used to produce flushing behavior like
12175bd8deadSopenharmony_ci    NV_fence in the single-context use case, and note that in the
12185bd8deadSopenharmony_ci    multiple-context case, applications must do more synchronization
12195bd8deadSopenharmony_ci    work between threads themselves to ensure that a fence command
12205bd8deadSopenharmony_ci    issues in one context will reach the hardware before blocking
12215bd8deadSopenharmony_ci    another context.
12225bd8deadSopenharmony_ci
12235bd8deadSopenharmony_ci    Version 4, 2006/02/22 - change sharing behavior so the sync
12245bd8deadSopenharmony_ci    namespace is shared, but sync objects can only be used from the
12255bd8deadSopenharmony_ci    context they were created in. Add subsection 2.2.1 and new Appendix
12265bd8deadSopenharmony_ci    C describing types of shared objects and how sharing affects sync
12275bd8deadSopenharmony_ci    commands (also as a placeholder for a future, more general
12285bd8deadSopenharmony_ci    discussion of shared object semantics). Remove WaitSync, since
12295bd8deadSopenharmony_ci    that's useful when syncs are shared. Add issue 18 discussing the
12305bd8deadSopenharmony_ci    distinction between waiting on events vs. waiting on changes in sync
12315bd8deadSopenharmony_ci    status, and issue 19 discussing stacking of fence commands. Split
12325bd8deadSopenharmony_ci    FenceSync into two parts to create the sync vs. issue the fence
12335bd8deadSopenharmony_ci    command.
12345bd8deadSopenharmony_ci
12355bd8deadSopenharmony_ci    Version 5, 2006/02/24 - Add a bit to FenceSync to control the
12365bd8deadSopenharmony_ci    initial status value of the sync. Note that TestSync is polling the
12375bd8deadSopenharmony_ci    status value, not the condition which causes that status value to
12385bd8deadSopenharmony_ci    change. Make FinishSync return immediately if the status of the sync
12395bd8deadSopenharmony_ci    being waited on is true at the time it's called, and otherwise wait
12405bd8deadSopenharmony_ci    for the event underlying the status to occur; change issue 18
12415bd8deadSopenharmony_ci    accordingly.
12425bd8deadSopenharmony_ci
12435bd8deadSopenharmony_ci    Version 6, 2006/02/24 - Added Contributors list. Marked explicitly
12445bd8deadSopenharmony_ci    RESOLVED all issues that have been closed, including issues 2, 3, 6
12455bd8deadSopenharmony_ci    (partly unresolved), 7, 8 (merged with 19), 9, 10, 15, 17, and 18.
12465bd8deadSopenharmony_ci    Allow stacking behavior for Fence and define FinishSync to wait on
12475bd8deadSopenharmony_ci    the most recently issued fence command at the time FinishSync was
12485bd8deadSopenharmony_ci    called. Note that DeleteSyncs() may be called while fence commands
12495bd8deadSopenharmony_ci    are outstanding for a sync (issue 9).
12505bd8deadSopenharmony_ci
12515bd8deadSopenharmony_ci    Version 7, 2006/03/07 - Modify DeleteSyncs behavior to allow
12525bd8deadSopenharmony_ci    deleting syncs from contexts other than the creator, to avoid
12535bd8deadSopenharmony_ci    orphaned & undeleteable syncs.
12545bd8deadSopenharmony_ci
12555bd8deadSopenharmony_ci    Version 8, 2006/03/09 - A terminology change from "sync types" to
12565bd8deadSopenharmony_ci    "sync specializations" affects wording of several issues. Full
12575bd8deadSopenharmony_ci    multi-context awareness has been restored, with the aid of a compact
12585bd8deadSopenharmony_ci    set of rules defining sync signaling behavior (see issue 18). This
12595bd8deadSopenharmony_ci    significantly changes the resolution and discussion of issues 1, 8
12605bd8deadSopenharmony_ci    (FinishSync blocks on the first outstanding fence command to
12615bd8deadSopenharmony_ci    complete, not the most recently issued one), 9 (sync destruction is
12625bd8deadSopenharmony_ci    delayed until all outstanding fence commands complete), 10, and 18
12635bd8deadSopenharmony_ci    (describe the rules), and in the corresponding spec language. Added
12645bd8deadSopenharmony_ci    issues 19-21 discussing additional ways to control sync signaling,
12655bd8deadSopenharmony_ci    and providing several examples of multi-context sync usage. Enum
12665bd8deadSopenharmony_ci    values will not be shared with NV_fence.
12675bd8deadSopenharmony_ci
12685bd8deadSopenharmony_ci    Version 9, 2006/03/13 - Inserting multiple outstanding fence
12695bd8deadSopenharmony_ci    commands on a sync from different contexts may not be supported.
12705bd8deadSopenharmony_ci    Delaying sync destruction until there are no outstanding commands
12715bd8deadSopenharmony_ci    may be too expensive to support. Note resolution of new features
12725bd8deadSopenharmony_ci    (support timeouts, form TBD; support SignalSync; support conversion
12735bd8deadSopenharmony_ci    of syncs to OS events, at least for WGL). Add SignalSync spec
12745bd8deadSopenharmony_ci    language.
12755bd8deadSopenharmony_ci
12765bd8deadSopenharmony_ci    Version 10, 2006/03/20 - major rewrite to replace fence-specific
12775bd8deadSopenharmony_ci    discussion in FinishSync with Barthold's more powerful and generic
12785bd8deadSopenharmony_ci    "signaled"/"unsignaled" terminology (also changed name of
12795bd8deadSopenharmony_ci    SYNC_UNTRIGGERED_STATUS_BIT to SYNC_UNSIGNALED_BIT). Added a timeout
12805bd8deadSopenharmony_ci    parameter to FinishSync and removed the now-redundant TestSync.
12815bd8deadSopenharmony_ci    Introduced the notion of UST time and the GLtime datatype to
12825bd8deadSopenharmony_ci    represent it. FinishSync now returns a condition code explaining why
12835bd8deadSopenharmony_ci    it completed. Corrected "GetFenceuiv" to "GetSyncuiv" in several
12845bd8deadSopenharmony_ci    places. Changed value of SYNC_FLUSH_COMMANDS_BIT to be exclusive
12855bd8deadSopenharmony_ci    with SYNC_UNSIGNALED_BIT, even though they are passed to separate
12865bd8deadSopenharmony_ci    <flag> arguments, since we don't know their future uses.
12875bd8deadSopenharmony_ci
12885bd8deadSopenharmony_ci    Version 11, 2006/03/23 - noted potential IP concern (first mentioned
12895bd8deadSopenharmony_ci    WRT GL2_async_core at the March 2003 ARB meeting). Updated
12905bd8deadSopenharmony_ci    description of sync deletion for consistency with the description of
12915bd8deadSopenharmony_ci    texture object deletion in the GLX 1.4 specification. Noted in issue
12925bd8deadSopenharmony_ci    8 and Appendix C that inserting fence commands on the same sync from
12935bd8deadSopenharmony_ci    multiple threads is allowed. New issue 22 for better naming of
12945bd8deadSopenharmony_ci    FinishSync. Noted that accuracy of GLtime is system-dependent. Fixed
12955bd8deadSopenharmony_ci    several typos and added a missing error condition for FinishSync.
12965bd8deadSopenharmony_ci
12975bd8deadSopenharmony_ci    Version 12, 2006/03/31 - Changed FinishSync to ClientWaitSync. Note
12985bd8deadSopenharmony_ci    that ClientWaitSync behavior is explicitly undefined (and note
12995bd8deadSopenharmony_ci    several of the possible consequences) when a sync object being
13005bd8deadSopenharmony_ci    blocked upon is deleted. Used shorthand "signaled" and "unsignaled"
13015bd8deadSopenharmony_ci    in many places rather than the wordier "placed into the signaled
13025bd8deadSopenharmony_ci    state". Changed sync status to SIGNALED/UNSIGNALED rather than
13035bd8deadSopenharmony_ci    TRUE/FALSE, and rewrote SignalSync language accordingly. Updated
13045bd8deadSopenharmony_ci    Appendix C description of multicontext behavior to explicitly
13055bd8deadSopenharmony_ci    describe full multi-context awareness. Use "sync object"
13065bd8deadSopenharmony_ci    consistently throughout and drop the "sync" shorthand. Use
13075bd8deadSopenharmony_ci    "unsignaled" everywhere, instead of "non-signaled". Clean up Errors
13085bd8deadSopenharmony_ci    section, but don't remove errors just because they're inferred from
13095bd8deadSopenharmony_ci    the core spec - many other extensions also try to be comprehensive
13105bd8deadSopenharmony_ci    in listing errors.
13115bd8deadSopenharmony_ci
13125bd8deadSopenharmony_ci    Version 13, 2006/04/03 - Add overview paragraph to start of section
13135bd8deadSopenharmony_ci    5.6. Replace "poll" terminology with "test". Disambiguate status
13145bd8deadSopenharmony_ci    value returned from ClientWaitSync when the sync was signaled at
13155bd8deadSopenharmony_ci    call time, but timeout was zero. Clarify that fence commands are not
13165bd8deadSopenharmony_ci    events, but their execution triggers events.
13175bd8deadSopenharmony_ci
13185bd8deadSopenharmony_ci    Version 14, 2008/06/08 - Merge changes from the Longs Peak object
13195bd8deadSopenharmony_ci    model version of sync objects back into the GL2 API version for use
13205bd8deadSopenharmony_ci    in OpenGL 3.0. Introduce generic object interfaces using GL2 names
13215bd8deadSopenharmony_ci    and explicit attribute lists instead of attribute objects and use
13225bd8deadSopenharmony_ci    those as the base of sync object manipulation. Move the object
13235bd8deadSopenharmony_ci    shared flag, condition, and status into the attribute list. Replace
13245bd8deadSopenharmony_ci    FenceSync creation flags with Sync using an explicit object
13255bd8deadSopenharmony_ci    type parameter together with an attribute list mechanism. Add
13265bd8deadSopenharmony_ci    WaitSync and rename SYNC_GPU_COMMANDS_COMPLETE to allow for possible
13275bd8deadSopenharmony_ci    future definition of server and client completion conditions as
13285bd8deadSopenharmony_ci    discussed in issue 3. Add issues 23 and 24 discussing generic object
13295bd8deadSopenharmony_ci    interfaces and the potential utility of a default sync object.
13305bd8deadSopenharmony_ci
13315bd8deadSopenharmony_ci    Version 15, 2009/04/23 - Merge changes from (abandoned) draft GL 3.0
13325bd8deadSopenharmony_ci    language back into this extension for consideration as a GL 3.2 /
13335bd8deadSopenharmony_ci    ARB extension feature. Minor API and terminology changes, including
13345bd8deadSopenharmony_ci    generating sync names at creation time instead of using Gen*
13355bd8deadSopenharmony_ci    functions changing DeleteSyncs to DeleteSync, and using
13365bd8deadSopenharmony_ci    sync-specific GetSynciv instead of GetObjectiv. Specify that
13375bd8deadSopenharmony_ci    multiple waiters on a sync object are all released when it's
13385bd8deadSopenharmony_ci    signaled. Added new issues 25-28 and moved the Issues list to the
13395bd8deadSopenharmony_ci    bottom of the document.
13405bd8deadSopenharmony_ci
13415bd8deadSopenharmony_ci    Version 16, 2009/05/03 - Change Fence -> FenceSync and merge sync
13425bd8deadSopenharmony_ci    creation into the command, removing Sync (until other sync types are
13435bd8deadSopenharmony_ci    supported), and also removing the ability to stack fences on a
13445bd8deadSopenharmony_ci    single fence sync object. Remove <where> parameter from WaitSync and
13455bd8deadSopenharmony_ci    allow it to wait in either the server or GPU. Make syncs always
13465bd8deadSopenharmony_ci    shared and remove OBJECT_SHARED property. Add issue 29 on whether
13475bd8deadSopenharmony_ci    implementation-dependent max timeout intervals should be defined.
13485bd8deadSopenharmony_ci
13495bd8deadSopenharmony_ci    Version 17, 2009/05/06 - Replace GLtime with GLuint64. Add
13505bd8deadSopenharmony_ci    implementation-dependent maximum timeout interval state in table 40.
13515bd8deadSopenharmony_ci    Modify *WaitSync to clamp requested timeout to the appropriate
13525bd8deadSopenharmony_ci    maximum interval. Add GetInteger64v query for these values and issue
13535bd8deadSopenharmony_ci    30 about the type signature of the query. Add clarification in
13545bd8deadSopenharmony_ci    FenceSync of what it means for a fence command to complete. Add
13555bd8deadSopenharmony_ci    issue 31 about possibly confusing token naming. Additional minor
13565bd8deadSopenharmony_ci    typos and wording changes from Greg.
13575bd8deadSopenharmony_ci
13585bd8deadSopenharmony_ci    Version 18, 2009/05/08 - Generate INVALID_VALUE instead of
13595bd8deadSopenharmony_ci    INVALID_OPERATION when passing <sync> parameters that are not the
13605bd8deadSopenharmony_ci    names of sync objects. Remove leftover language saying that a bit of
13615bd8deadSopenharmony_ci    state is needed to specify if the sync is shared or not. Add
13625bd8deadSopenharmony_ci    clarification that requested <timeout> intervals are adjusted to the
13635bd8deadSopenharmony_ci    closest value supported by the implementation, and a footnote that
13645bd8deadSopenharmony_ci    FOREVER is just shorthand for the longest representable timeout.
13655bd8deadSopenharmony_ci    Change parameter names and error handling for GetSynciv to be
13665bd8deadSopenharmony_ci    consistent with other variable-length queries such as
13675bd8deadSopenharmony_ci    GetActiveAttrib.
13685bd8deadSopenharmony_ci
13695bd8deadSopenharmony_ci    Version 19, 2009/05/14 - Remove FOREVER and add sample code showing
13705bd8deadSopenharmony_ci    how to wait in the server for a specified time, or for the
13715bd8deadSopenharmony_ci    implementation-dependent maximum possible time. Resolve issue 24 by
13725bd8deadSopenharmony_ci    saying we don't need a "default sync object".
13735bd8deadSopenharmony_ci
13745bd8deadSopenharmony_ci    Version 20, 2009/05/15 - Re-tag all issues still marked as
13755bd8deadSopenharmony_ci    unresolved - none of them affect sync functionality, they are more
13765bd8deadSopenharmony_ci    speculative for future uses of syncs, or details of spec writing.
13775bd8deadSopenharmony_ci
13785bd8deadSopenharmony_ci    Version 21, 2009/07/01 - "Sync" up with 3.2 core spec draft:
13795bd8deadSopenharmony_ci      * Use GLsync instead of GLuint for sync object handle type in all
13805bd8deadSopenharmony_ci        relevant commands,
13815bd8deadSopenharmony_ci      * Change type of FenceSync <condition> to GLenum.
13825bd8deadSopenharmony_ci      * Add <flags> argument to FenceSync and corresponding SYNC_FLAGS
13835bd8deadSopenharmony_ci        property.
13845bd8deadSopenharmony_ci      * Remove MAX_CLIENT_WAIT_TIMEOUT.
13855bd8deadSopenharmony_ci      * Clarify that the actual client wait time may be longer than the
13865bd8deadSopenharmony_ci        requested <timeout> and that TIMEOUT_EXPIRED may be
13875bd8deadSopenharmony_ci        returned even when ClientWaitSync is called with a
13885bd8deadSopenharmony_ci        <timeout> of zero.
13895bd8deadSopenharmony_ci      * Require the <timeout> parameter to WaitSync to be a no-op value.
13905bd8deadSopenharmony_ci      * Remove SignalSync, until a sync object type other than a fence
13915bd8deadSopenharmony_ci        sync is defined.
13925bd8deadSopenharmony_ci      * Change type of <flags> parameter to
13935bd8deadSopenharmony_ci        ClientWaitSync and WaitSync to GLbitfield.
13945bd8deadSopenharmony_ci      * Fix spelling of SYNC_FLUSH_COMMANDS_BIT
13955bd8deadSopenharmony_ci      * Add issues 31-33 describing some of the changes.
13965bd8deadSopenharmony_ci
13975bd8deadSopenharmony_ci    Version 22, 2009/07/01 - Add TIMEOUT_IGNORED and WAIT_FAILED to New
13985bd8deadSopenharmony_ci    Tokens list.
13995bd8deadSopenharmony_ci
14005bd8deadSopenharmony_ci    Version 23, 2009/07/20 (Apollo 11 commemorative edition) - Assign
14015bd8deadSopenharmony_ci    enum values.
14025bd8deadSopenharmony_ci
14035bd8deadSopenharmony_ci    Version 24, 2009/07/24 - Rename stray GetSyncuiv functions to
14045bd8deadSopenharmony_ci    GetSynciv.
14055bd8deadSopenharmony_ci
14065bd8deadSopenharmony_ci    Version 25, 2009/09/18 - Correct spelling of SYNC_FLUSH_COMMAND_BIT
14075bd8deadSopenharmony_ci    to SYNC_FLUSH_COMMANDS_BIT in several places.
1408