15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    NV_fence
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_NV_fence
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    John Spitzer, NVIDIA Corporation (jspitzer 'at' nvidia.com)
125bd8deadSopenharmony_ci    Mark Kilgard, NVIDIA Corporation (mjk 'at' nvidia.com)
135bd8deadSopenharmony_ci
145bd8deadSopenharmony_ciContributors
155bd8deadSopenharmony_ci
165bd8deadSopenharmony_ci    John Spitzer
175bd8deadSopenharmony_ci    Mark Kilgard
185bd8deadSopenharmony_ci    Acorn Pooley
195bd8deadSopenharmony_ci
205bd8deadSopenharmony_ciNotice
215bd8deadSopenharmony_ci
225bd8deadSopenharmony_ci    Copyright NVIDIA Corporation, 2000, 2001.
235bd8deadSopenharmony_ci
245bd8deadSopenharmony_ciIP Status
255bd8deadSopenharmony_ci
265bd8deadSopenharmony_ci    NVIDIA Proprietary.
275bd8deadSopenharmony_ci
285bd8deadSopenharmony_ciStatus
295bd8deadSopenharmony_ci
305bd8deadSopenharmony_ci    Shipping as of June 8, 2000 (version 1.0)
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ci    Shipping as of November, 2003 (version 1.1)
335bd8deadSopenharmony_ci
345bd8deadSopenharmony_ci    Version 1.2 adds ES support and clarification; otherwise identical to 1.1.
355bd8deadSopenharmony_ci
365bd8deadSopenharmony_ciVersion
375bd8deadSopenharmony_ci
385bd8deadSopenharmony_ci    December 17, 2008 (version 1.2)
395bd8deadSopenharmony_ci
405bd8deadSopenharmony_ciNumber
415bd8deadSopenharmony_ci
425bd8deadSopenharmony_ci    OpenGL Extension #222
435bd8deadSopenharmony_ci    OpenGL ES Extension #52
445bd8deadSopenharmony_ci
455bd8deadSopenharmony_ciDependencies
465bd8deadSopenharmony_ci
475bd8deadSopenharmony_ci    This extension is written against the OpenGL 1.2.1 Specification.
485bd8deadSopenharmony_ci    It can also be used with OpenGL ES (see the section, "Dependencies on
495bd8deadSopenharmony_ci    OpenGL ES," below).
505bd8deadSopenharmony_ci
515bd8deadSopenharmony_ciOverview
525bd8deadSopenharmony_ci
535bd8deadSopenharmony_ci    The goal of this extension is provide a finer granularity of
545bd8deadSopenharmony_ci    synchronizing GL command completion than offered by standard OpenGL,
555bd8deadSopenharmony_ci    which offers only two mechanisms for synchronization: Flush and Finish.
565bd8deadSopenharmony_ci    Since Flush merely assures the user that the commands complete in a
575bd8deadSopenharmony_ci    finite (though undetermined) amount of time, it is, thus, of only
585bd8deadSopenharmony_ci    modest utility.  Finish, on the other hand, stalls CPU execution
595bd8deadSopenharmony_ci    until all pending GL commands have completed.  This extension offers
605bd8deadSopenharmony_ci    a middle ground - the ability to "finish" a subset of the command
615bd8deadSopenharmony_ci    stream, and the ability to determine whether a given command has
625bd8deadSopenharmony_ci    completed or not.
635bd8deadSopenharmony_ci
645bd8deadSopenharmony_ci    This extension introduces the concept of a "fence" to the OpenGL
655bd8deadSopenharmony_ci    command stream.  Once the fence is inserted into the command stream, it
665bd8deadSopenharmony_ci    can be queried for a given condition - typically, its completion.
675bd8deadSopenharmony_ci    Moreover, the application may also request a partial Finish -- that is,
685bd8deadSopenharmony_ci    all commands prior to the fence will be forced to complete until control
695bd8deadSopenharmony_ci    is returned to the calling process.  These new mechanisms allow for
705bd8deadSopenharmony_ci    synchronization between the host CPU and the GPU, which may be accessing
715bd8deadSopenharmony_ci    the same resources (typically memory).
725bd8deadSopenharmony_ci
735bd8deadSopenharmony_ci    This extension is useful in conjunction with NV_vertex_array_range
745bd8deadSopenharmony_ci    to determine when vertex information has been pulled from the
755bd8deadSopenharmony_ci    vertex array range.  Once a fence has been tested TRUE or finished,
765bd8deadSopenharmony_ci    all vertex indices issued before the fence must have been pulled.
775bd8deadSopenharmony_ci    This ensures that the vertex data memory corresponding to the issued
785bd8deadSopenharmony_ci    vertex indices can be safely modified (assuming no other outstanding
795bd8deadSopenharmony_ci    vertex indices are issued subsequent to the fence).
805bd8deadSopenharmony_ci    
815bd8deadSopenharmony_ciIssues
825bd8deadSopenharmony_ci
835bd8deadSopenharmony_ci    Do we need an IsFenceNV command?
845bd8deadSopenharmony_ci
855bd8deadSopenharmony_ci        RESOLUTION:  Yes.  Not sure who would use this, but it's in there.
865bd8deadSopenharmony_ci        Semantics currently follow the texture object definition --
875bd8deadSopenharmony_ci        that is, calling IsFenceNV before SetFenceNV will return FALSE.
885bd8deadSopenharmony_ci
895bd8deadSopenharmony_ci    Are the fences sharable between multiple contexts?
905bd8deadSopenharmony_ci
915bd8deadSopenharmony_ci        RESOLUTION:  No.
925bd8deadSopenharmony_ci
935bd8deadSopenharmony_ci        Potentially this could change with a subsequent extension.
945bd8deadSopenharmony_ci
955bd8deadSopenharmony_ci    What other conditions will be supported?
965bd8deadSopenharmony_ci
975bd8deadSopenharmony_ci        Only ALL_COMPLETED_NV will be supported initially.  Future extensions
985bd8deadSopenharmony_ci        may wish to implement additional fence conditions.
995bd8deadSopenharmony_ci
1005bd8deadSopenharmony_ci    What is the relative performance of the calls?
1015bd8deadSopenharmony_ci
1025bd8deadSopenharmony_ci        Execution of a SetFenceNV is not free, but will not trigger a
1035bd8deadSopenharmony_ci        Flush or Finish.
1045bd8deadSopenharmony_ci
1055bd8deadSopenharmony_ci    Is the TestFenceNV call really necessary?  How often would this be used
1065bd8deadSopenharmony_ci    compared to the FinishFenceNV call (which also flushes to ensure this
1075bd8deadSopenharmony_ci    happens in finite time)?
1085bd8deadSopenharmony_ci
1095bd8deadSopenharmony_ci        It is conceivable that a user may use TestFenceNV to decide
1105bd8deadSopenharmony_ci        which portion of memory should be used next without stalling
1115bd8deadSopenharmony_ci        the CPU.  An example of this would be a scenario where a single
1125bd8deadSopenharmony_ci        AGP buffer is used for both static (unchanged for multiple frames)
1135bd8deadSopenharmony_ci        and dynamic (changed every frame) data.  If the user has written
1145bd8deadSopenharmony_ci        dynamic data to all banks dedicated to dynamic data, and still
1155bd8deadSopenharmony_ci        has more dynamic objects to write, the user would first want to
1165bd8deadSopenharmony_ci        check if the first dynamic object has completed, before writing
1175bd8deadSopenharmony_ci        into the buffer.  If the object has not completed, instead of
1185bd8deadSopenharmony_ci        stalling the CPU with a FinishFenceNV call, it would possibly
1195bd8deadSopenharmony_ci        be better to start overwriting static objects instead.
1205bd8deadSopenharmony_ci
1215bd8deadSopenharmony_ci    What should happen if TestFenceNV is called for a name before SetFenceNV
1225bd8deadSopenharmony_ci    is called?
1235bd8deadSopenharmony_ci
1245bd8deadSopenharmony_ci        We generate an INVALID_OPERATION error, and return TRUE.
1255bd8deadSopenharmony_ci        This follows the semantics for texture object names before
1265bd8deadSopenharmony_ci        they are bound, in that they acquire their state upon binding.
1275bd8deadSopenharmony_ci        We will arbitrarily return TRUE for consistency.
1285bd8deadSopenharmony_ci
1295bd8deadSopenharmony_ci    What should happen if FinishFenceNV is called for a name before
1305bd8deadSopenharmony_ci    SetFenceNV is called?
1315bd8deadSopenharmony_ci
1325bd8deadSopenharmony_ci        RESOLUTION:  Generate an INVALID_OPERATION error because the
1335bd8deadSopenharmony_ci        fence id does not exist yet.  SetFenceNV must be called to create
1345bd8deadSopenharmony_ci        a fence.
1355bd8deadSopenharmony_ci
1365bd8deadSopenharmony_ci    Do we need a mechanism to query which condition a given fence was
1375bd8deadSopenharmony_ci    set with?
1385bd8deadSopenharmony_ci
1395bd8deadSopenharmony_ci        RESOLUTION:  Yes, use glGetFenceivNV with FENCE_CONDITION_NV.
1405bd8deadSopenharmony_ci
1415bd8deadSopenharmony_ci    Should we allow these commands to be compiled within display list?
1425bd8deadSopenharmony_ci    Which ones?  How about within Begin/End pairs?
1435bd8deadSopenharmony_ci
1445bd8deadSopenharmony_ci        RESOLUTION:  DeleteFencesNV, FinishFenceNV, GenFencesNV,
1455bd8deadSopenharmony_ci        TestFenceNV, and IsFenceNV are executed immediately while
1465bd8deadSopenharmony_ci        SetFenceNV is compiled.  Do not allow any of these commands
1475bd8deadSopenharmony_ci        within Begin/End pairs.
1485bd8deadSopenharmony_ci
1495bd8deadSopenharmony_ci    Can fences be used as a form of performance monitoring?
1505bd8deadSopenharmony_ci
1515bd8deadSopenharmony_ci        Yes, with some caveats.  By setting and testing or finishing
1525bd8deadSopenharmony_ci        fences, developers can measure the GPU latency for completing
1535bd8deadSopenharmony_ci        GL operations.  For example, developers might do the following:
1545bd8deadSopenharmony_ci
1555bd8deadSopenharmony_ci          start = getCurrentTime();
1565bd8deadSopenharmony_ci          updateTextures();
1575bd8deadSopenharmony_ci          glSetFenceNV(TEXTURE_LOAD_FENCE, GL_ALL_COMPLETED_NV);
1585bd8deadSopenharmony_ci          drawBackground();
1595bd8deadSopenharmony_ci          glSetFenceNV(DRAW_BACKGROUND_FENCE, GL_ALL_COMPLETED_NV);
1605bd8deadSopenharmony_ci          drawCharacters();
1615bd8deadSopenharmony_ci          glSetFenceNV(DRAW_CHARACTERS_FENCE, GL_ALL_COMPLETED_NV);
1625bd8deadSopenharmony_ci
1635bd8deadSopenharmony_ci          glFinishFenceNV(TEXTURE_LOAD_FENCE);
1645bd8deadSopenharmony_ci          textureLoadEnd = getCurrentTime();
1655bd8deadSopenharmony_ci
1665bd8deadSopenharmony_ci          glFinishFenceNV(DRAW_BACKGROUND_FENCE);
1675bd8deadSopenharmony_ci          drawBackgroundEnd = getCurrentTime();
1685bd8deadSopenharmony_ci
1695bd8deadSopenharmony_ci          glFinishFenceNV(DRAW_CHARACTERS_FENCE);
1705bd8deadSopenharmony_ci          drawCharactersEnd = getCurrentTime();
1715bd8deadSopenharmony_ci
1725bd8deadSopenharmony_ci          printf("texture load time = %d\n", textureLoadEnd - start);
1735bd8deadSopenharmony_ci          printf("draw background time = %d\n", drawBackgroundEnd - textureLoadEnd);
1745bd8deadSopenharmony_ci          printf("draw characters time = %d\n", drawCharacters - drawBackgroundEnd);
1755bd8deadSopenharmony_ci
1765bd8deadSopenharmony_ci        Note that there is a small amount of overhead associated with
1775bd8deadSopenharmony_ci        inserting each fence into the GL command stream.  Each fence
1785bd8deadSopenharmony_ci        causes the GL command stream to momentarily idle (idling the
1795bd8deadSopenharmony_ci        entire GPU pipeline).  The significance of this idling should
1805bd8deadSopenharmony_ci        be small if there are a small number of fences and large amount
1815bd8deadSopenharmony_ci        of intervening commands.
1825bd8deadSopenharmony_ci
1835bd8deadSopenharmony_ci        If the time between two fences is zero or very near zero,
1845bd8deadSopenharmony_ci        it probably means that a GPU-CPU synchronization such as a
1855bd8deadSopenharmony_ci        glFinish probably occurred.  A glFinish is an explicit GPU-CPU
1865bd8deadSopenharmony_ci        synchronization, but sometimes implicit GPU-CPU synchronizations
1875bd8deadSopenharmony_ci        are performed by the driver.
1885bd8deadSopenharmony_ci
1895bd8deadSopenharmony_ci    What happens if you set the same fence object twice?
1905bd8deadSopenharmony_ci
1915bd8deadSopenharmony_ci        The second SetFenceNV clobbers whatever status the fence object
1925bd8deadSopenharmony_ci        previously had by forcing the object's status to GL_TRUE.
1935bd8deadSopenharmony_ci        The completion of the first SetFenceNV's fence command placed
1945bd8deadSopenharmony_ci        in the command stream is ignored (its completion does NOT
1955bd8deadSopenharmony_ci        update the fence object's status).  The second SetFenceNV sets a
1965bd8deadSopenharmony_ci        new fence command in the GL command stream.  This second fence
1975bd8deadSopenharmony_ci        command will update the fence object's status (assuming it is
1985bd8deadSopenharmony_ci        not ignored by a subsequent SetFenceNV to the same fence object).
1995bd8deadSopenharmony_ci
2005bd8deadSopenharmony_ci    What happens to a fence command that is still pending execution
2015bd8deadSopenharmony_ci    when its fence object is deleted?
2025bd8deadSopenharmony_ci
2035bd8deadSopenharmony_ci        The fence command completion is ignored.
2045bd8deadSopenharmony_ci
2055bd8deadSopenharmony_ci    What happens if you use an arbitrary number for the SetFenceNV() <fence>
2065bd8deadSopenharmony_ci    parameter instead of obtaining the name from GenFences()?
2075bd8deadSopenharmony_ci
2085bd8deadSopenharmony_ci        This works fine (just as with texture objects).
2095bd8deadSopenharmony_ci
2105bd8deadSopenharmony_ciNew Procedures and Functions
2115bd8deadSopenharmony_ci
2125bd8deadSopenharmony_ci    void GenFencesNV(sizei n, uint *fences);
2135bd8deadSopenharmony_ci
2145bd8deadSopenharmony_ci    void DeleteFencesNV(sizei n, const uint *fences);
2155bd8deadSopenharmony_ci
2165bd8deadSopenharmony_ci    void SetFenceNV(uint fence, enum condition);
2175bd8deadSopenharmony_ci
2185bd8deadSopenharmony_ci    boolean TestFenceNV(uint fence);
2195bd8deadSopenharmony_ci
2205bd8deadSopenharmony_ci    void FinishFenceNV(uint fence);
2215bd8deadSopenharmony_ci
2225bd8deadSopenharmony_ci    boolean IsFenceNV(uint fence);
2235bd8deadSopenharmony_ci
2245bd8deadSopenharmony_ci    void GetFenceivNV(uint fence, enum pname, int *params);
2255bd8deadSopenharmony_ci
2265bd8deadSopenharmony_ciNew Tokens
2275bd8deadSopenharmony_ci
2285bd8deadSopenharmony_ci    Accepted by the <condition> parameter of SetFenceNV:
2295bd8deadSopenharmony_ci
2305bd8deadSopenharmony_ci        ALL_COMPLETED_NV                   0x84F2
2315bd8deadSopenharmony_ci
2325bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetFenceivNV:
2335bd8deadSopenharmony_ci
2345bd8deadSopenharmony_ci        FENCE_STATUS_NV                    0x84F3
2355bd8deadSopenharmony_ci        FENCE_CONDITION_NV                 0x84F4
2365bd8deadSopenharmony_ci
2375bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 1.2.1 Specification (Special Functions)
2385bd8deadSopenharmony_ci
2395bd8deadSopenharmony_ci    Add to the end of Section 5.4 "Display Lists"
2405bd8deadSopenharmony_ci
2415bd8deadSopenharmony_ci    "DeleteFencesNV, FinishFenceNV, GenFencesNV, GetFenceivNV,
2425bd8deadSopenharmony_ci    TestFenceNV, and IsFenceNV are not complied into display lists but
2435bd8deadSopenharmony_ci    are executed immediately."
2445bd8deadSopenharmony_ci
2455bd8deadSopenharmony_ci    After the discussion of Flush and Finish (Section 5.5) add a
2465bd8deadSopenharmony_ci    description of the fence operations:
2475bd8deadSopenharmony_ci
2485bd8deadSopenharmony_ci    "5.X  Fences
2495bd8deadSopenharmony_ci
2505bd8deadSopenharmony_ci    The command 
2515bd8deadSopenharmony_ci
2525bd8deadSopenharmony_ci       void SetFenceNV(uint fence, enum condition);
2535bd8deadSopenharmony_ci
2545bd8deadSopenharmony_ci    creates a fence object named <fence> if one does not already exist
2555bd8deadSopenharmony_ci    and sets a fence command within the GL command stream.  If the named
2565bd8deadSopenharmony_ci    fence object already exists, a new fence command is set within the GL
2575bd8deadSopenharmony_ci    command stream (and any previous pending fence command corresponding
2585bd8deadSopenharmony_ci    to the fence object is ignored).  Whether or not a new fence object is
2595bd8deadSopenharmony_ci    created, SetFenceNV assigns the named fence object a status of FALSE
2605bd8deadSopenharmony_ci    and a condition as set by the condition argument.  The condition
2615bd8deadSopenharmony_ci    argument must be ALL_COMPLETED_NV.  Once the fence's condition is
2625bd8deadSopenharmony_ci    satisfied within the command stream, the corresponding fence object's
2635bd8deadSopenharmony_ci    state is changed to TRUE.  For a condition of ALL_COMPLETED_NV,
2645bd8deadSopenharmony_ci    this is completion of the fence command and all preceding commands.
2655bd8deadSopenharmony_ci    No other state is affected by execution of the fence command.  The name
2665bd8deadSopenharmony_ci    <fence> may be one returned by GenFencesNV() but that is not required.
2675bd8deadSopenharmony_ci
2685bd8deadSopenharmony_ci    A fence's state can be queried by calling the command
2695bd8deadSopenharmony_ci
2705bd8deadSopenharmony_ci      boolean TestFenceNV(uint fence);
2715bd8deadSopenharmony_ci
2725bd8deadSopenharmony_ci    The command
2735bd8deadSopenharmony_ci
2745bd8deadSopenharmony_ci      void FinishFenceNV(uint fence);
2755bd8deadSopenharmony_ci
2765bd8deadSopenharmony_ci    forces all GL commands prior to the fence to satisfy the condition
2775bd8deadSopenharmony_ci    set within SetFenceNV, which, in this spec, is always completion.
2785bd8deadSopenharmony_ci    FinishFenceNV does not return until all effects from these commands
2795bd8deadSopenharmony_ci    on GL client and server state and the framebuffer are fully realized.
2805bd8deadSopenharmony_ci
2815bd8deadSopenharmony_ci    The command
2825bd8deadSopenharmony_ci
2835bd8deadSopenharmony_ci      void GenFencesNV(sizei n, uint *fences);
2845bd8deadSopenharmony_ci
2855bd8deadSopenharmony_ci    returns n previously unused fence names in fences.  These names
2865bd8deadSopenharmony_ci    are marked as used, for the purposes of GenFencesNV only, but
2875bd8deadSopenharmony_ci    corresponding fence objects do not exist (have no state) until created
2885bd8deadSopenharmony_ci    with SetFenceNV().
2895bd8deadSopenharmony_ci
2905bd8deadSopenharmony_ci    Fences are deleted by calling
2915bd8deadSopenharmony_ci
2925bd8deadSopenharmony_ci      void DeleteFencesNV(sizei n, const uint *fences);
2935bd8deadSopenharmony_ci
2945bd8deadSopenharmony_ci    fences contains n names of fences to be deleted.  After a fence is
2955bd8deadSopenharmony_ci    deleted, it has no state, and its name is again unused.  Unused names
2965bd8deadSopenharmony_ci    in fences are silently ignored.
2975bd8deadSopenharmony_ci
2985bd8deadSopenharmony_ci    If the fence passed to TestFenceNV or FinishFenceNV is not the name of an
2995bd8deadSopenharmony_ci    existing fence, the error INVALID_OPERATION is generated.  In this case,
3005bd8deadSopenharmony_ci    TestFenceNV will return TRUE, for the sake of consistency.
3015bd8deadSopenharmony_ci
3025bd8deadSopenharmony_ci    State must be maintained to indicate which fence integers are
3035bd8deadSopenharmony_ci    currently used or set.  In the initial state, no indices are in use.
3045bd8deadSopenharmony_ci    When a fence integer is set, the condition and status of the fence
3055bd8deadSopenharmony_ci    are also maintained.  The status is a boolean.  The condition is
3065bd8deadSopenharmony_ci    the value last set as the condition by SetFenceNV.
3075bd8deadSopenharmony_ci
3085bd8deadSopenharmony_ci    Once the status of a fence has been finished (via FinishFenceNV)
3095bd8deadSopenharmony_ci    or tested and the returned status is TRUE (via either TestFenceNV
3105bd8deadSopenharmony_ci    or GetFenceivNV querying the FENCE_STATUS_NV), the status remains
3115bd8deadSopenharmony_ci    TRUE until the next SetFenceNV of the fence."
3125bd8deadSopenharmony_ci
3135bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 1.2.1 Specification (State and State Requests)
3145bd8deadSopenharmony_ci
3155bd8deadSopenharmony_ci    Insert new section after Section 6.1.10 "Minmax Query"
3165bd8deadSopenharmony_ci
3175bd8deadSopenharmony_ci    "6.1.11 Fence Query
3185bd8deadSopenharmony_ci
3195bd8deadSopenharmony_ci    The command
3205bd8deadSopenharmony_ci
3215bd8deadSopenharmony_ci      boolean IsFenceNV(uint fence);
3225bd8deadSopenharmony_ci
3235bd8deadSopenharmony_ci    return TRUE if <fence> is the name of an existing fence.  If <fence> is
3245bd8deadSopenharmony_ci    not the name of an existing fence, or if an error condition occurs,
3255bd8deadSopenharmony_ci    IsFenceNV returns FALSE.  A name returned by GenFencesNV, but not yet set
3265bd8deadSopenharmony_ci    via SetFenceNV, is not the name of an existing fence.
3275bd8deadSopenharmony_ci
3285bd8deadSopenharmony_ci    The command
3295bd8deadSopenharmony_ci
3305bd8deadSopenharmony_ci      void GetFenceivNV(uint fence, enum pname, int *params)
3315bd8deadSopenharmony_ci
3325bd8deadSopenharmony_ci    obtains the indicated fence state for the specified fence in the array
3335bd8deadSopenharmony_ci    params.  pname must be either FENCE_STATUS_NV or FENCE_CONDITION_NV.
3345bd8deadSopenharmony_ci    The INVALID_OPERATION error is generated if the named fence does
3355bd8deadSopenharmony_ci    not exist."
3365bd8deadSopenharmony_ci
3375bd8deadSopenharmony_ciAdditions to the GLX Specification
3385bd8deadSopenharmony_ci
3395bd8deadSopenharmony_ci    None
3405bd8deadSopenharmony_ci
3415bd8deadSopenharmony_ciGLX Protocol
3425bd8deadSopenharmony_ci
3435bd8deadSopenharmony_ci    Seven new GL commands are added.
3445bd8deadSopenharmony_ci
3455bd8deadSopenharmony_ci    The following rendering command is sent to the sever as part of a
3465bd8deadSopenharmony_ci    glXRender request:
3475bd8deadSopenharmony_ci
3485bd8deadSopenharmony_ci        SetFenceNV
3495bd8deadSopenharmony_ci            2           12              rendering command length
3505bd8deadSopenharmony_ci            2           4143            rendering command opcode
3515bd8deadSopenharmony_ci            4           CARD32          fence
3525bd8deadSopenharmony_ci            4           CARD32          condition
3535bd8deadSopenharmony_ci
3545bd8deadSopenharmony_ci    The remaining five commands are non-rendering commands.  These
3555bd8deadSopenharmony_ci    commands are sent separately (i.e., not as part of a glXRender or
3565bd8deadSopenharmony_ci    glXRenderLarge request), using the glXVendorPrivateWithReply request:
3575bd8deadSopenharmony_ci
3585bd8deadSopenharmony_ci        DeleteFencesNV
3595bd8deadSopenharmony_ci            1           CARD8           opcode (X assigned)
3605bd8deadSopenharmony_ci            1           17              GLX opcode (glXVendorPrivateWithReply)
3615bd8deadSopenharmony_ci            2           4+n             request length
3625bd8deadSopenharmony_ci            4           1276            vendor specific opcode
3635bd8deadSopenharmony_ci            4           GLX_CONTEXT_TAG context tag
3645bd8deadSopenharmony_ci            4           INT32           n
3655bd8deadSopenharmony_ci            n*4         LISTofCARD32    fences
3665bd8deadSopenharmony_ci
3675bd8deadSopenharmony_ci        GenFencesNV
3685bd8deadSopenharmony_ci            1           CARD8           opcode (X assigned)
3695bd8deadSopenharmony_ci            1           17              GLX opcode (glXVendorPrivateWithReply)
3705bd8deadSopenharmony_ci            2           4               request length
3715bd8deadSopenharmony_ci            4           1277            vendor specific opcode
3725bd8deadSopenharmony_ci            4           GLX_CONTEXT_TAG context tag
3735bd8deadSopenharmony_ci            4           INT32           n
3745bd8deadSopenharmony_ci          =>
3755bd8deadSopenharmony_ci            1           1               reply
3765bd8deadSopenharmony_ci            1                           unused
3775bd8deadSopenharmony_ci            2           CARD16          sequence number
3785bd8deadSopenharmony_ci            4           n               reply length
3795bd8deadSopenharmony_ci            24                          unused
3805bd8deadSopenharmony_ci            n*4         LISTofCARD322   fences
3815bd8deadSopenharmony_ci
3825bd8deadSopenharmony_ci        IsFenceNV
3835bd8deadSopenharmony_ci            1           CARD8           opcode (X assigned)
3845bd8deadSopenharmony_ci            1           17              GLX opcode (glXVendorPrivateWithReply)
3855bd8deadSopenharmony_ci            2           4               request length
3865bd8deadSopenharmony_ci            4           1278            vendor specific opcode
3875bd8deadSopenharmony_ci            4           GLX_CONTEXT_TAG context tag
3885bd8deadSopenharmony_ci            4           INT32           n
3895bd8deadSopenharmony_ci          =>
3905bd8deadSopenharmony_ci            1           1               reply
3915bd8deadSopenharmony_ci            1                           unused
3925bd8deadSopenharmony_ci            2           CARD16          sequence number
3935bd8deadSopenharmony_ci            4           0               reply length
3945bd8deadSopenharmony_ci            4           BOOL32          return value
3955bd8deadSopenharmony_ci            20                          unused
3965bd8deadSopenharmony_ci
3975bd8deadSopenharmony_ci        TestFenceNV
3985bd8deadSopenharmony_ci            1           CARD8           opcode (X assigned)
3995bd8deadSopenharmony_ci            1           17              GLX opcode (glXVendorPrivateWithReply)
4005bd8deadSopenharmony_ci            2           4               request length
4015bd8deadSopenharmony_ci            4           1279            vendor specific opcode
4025bd8deadSopenharmony_ci            4           GLX_CONTEXT_TAG context tag
4035bd8deadSopenharmony_ci            4           INT32           fence
4045bd8deadSopenharmony_ci          =>
4055bd8deadSopenharmony_ci            1           1               reply
4065bd8deadSopenharmony_ci            1                           unused
4075bd8deadSopenharmony_ci            2           CARD16          sequence number
4085bd8deadSopenharmony_ci            4           0               reply length
4095bd8deadSopenharmony_ci            4           BOOL32          return value
4105bd8deadSopenharmony_ci            20                          unused
4115bd8deadSopenharmony_ci
4125bd8deadSopenharmony_ci        GetFenceivNV
4135bd8deadSopenharmony_ci            1           CARD8           opcode (X assigned)
4145bd8deadSopenharmony_ci            1           17              GLX opcode (glXVendorPrivateWithReply)
4155bd8deadSopenharmony_ci            2           5               request length
4165bd8deadSopenharmony_ci            4           1280            vendor specific opcode
4175bd8deadSopenharmony_ci            4           GLX_CONTEXT_TAG context tag
4185bd8deadSopenharmony_ci            4           INT32           fence
4195bd8deadSopenharmony_ci            4           CARD32          pname
4205bd8deadSopenharmony_ci          =>
4215bd8deadSopenharmony_ci            1           1               reply
4225bd8deadSopenharmony_ci            1                           unused
4235bd8deadSopenharmony_ci            2           CARD16          sequence number
4245bd8deadSopenharmony_ci            4           m               reply length, m=(n==1?0:n)
4255bd8deadSopenharmony_ci            4                           unused
4265bd8deadSopenharmony_ci            4           CARD32          n
4275bd8deadSopenharmony_ci
4285bd8deadSopenharmony_ci            if (n=1) this follows:
4295bd8deadSopenharmony_ci
4305bd8deadSopenharmony_ci            4           INT32           params
4315bd8deadSopenharmony_ci            12                          unused
4325bd8deadSopenharmony_ci
4335bd8deadSopenharmony_ci            otherwise this follows:
4345bd8deadSopenharmony_ci
4355bd8deadSopenharmony_ci            16                          unused
4365bd8deadSopenharmony_ci            n*4         LISTofINT32     params
4375bd8deadSopenharmony_ci
4385bd8deadSopenharmony_ci        FinishFenceNV
4395bd8deadSopenharmony_ci            1           CARD8           opcode (X assigned)
4405bd8deadSopenharmony_ci            1           17              GLX opcode (glXVendorPrivateWithReply)
4415bd8deadSopenharmony_ci            2           4               request length
4425bd8deadSopenharmony_ci            4           1312            vendor specific opcode
4435bd8deadSopenharmony_ci            4           GLX_CONTEXT_TAG context tag
4445bd8deadSopenharmony_ci            4           INT32           fence
4455bd8deadSopenharmony_ci          =>
4465bd8deadSopenharmony_ci            1           1               reply
4475bd8deadSopenharmony_ci            1                           unused
4485bd8deadSopenharmony_ci            2           CARD16          sequence number
4495bd8deadSopenharmony_ci            4           0               reply length
4505bd8deadSopenharmony_ci            24                          unused
4515bd8deadSopenharmony_ci
4525bd8deadSopenharmony_ciErrors
4535bd8deadSopenharmony_ci
4545bd8deadSopenharmony_ci    INVALID_VALUE is generated if GenFencesNV or DeleteFencesNV parameter <n>
4555bd8deadSopenharmony_ci    is negative.
4565bd8deadSopenharmony_ci
4575bd8deadSopenharmony_ci    INVALID_OPERATION is generated if the fence used in TestFenceNV,
4585bd8deadSopenharmony_ci    FinishFenceNV or GetFenceivNV is not the name of an existing fence.
4595bd8deadSopenharmony_ci
4605bd8deadSopenharmony_ci    INVALID_ENUM is generated if the condition used in SetFenceNV
4615bd8deadSopenharmony_ci    is not ALL_COMPLETED_NV.
4625bd8deadSopenharmony_ci
4635bd8deadSopenharmony_ci    INVALID_OPERATION is generated if any of the commands defined in
4645bd8deadSopenharmony_ci    this extension is executed between the execution of Begin and the
4655bd8deadSopenharmony_ci    corresponding execution of End.
4665bd8deadSopenharmony_ci
4675bd8deadSopenharmony_ciNew State
4685bd8deadSopenharmony_ci
4695bd8deadSopenharmony_ciTable 6.X.  Fence Objects.
4705bd8deadSopenharmony_ci
4715bd8deadSopenharmony_ciGet value           Type  Get command   Initial value                 Description      Section  Attribute
4725bd8deadSopenharmony_ci------------------  ----  ------------  ----------------------------  ---------------  -------  ---------
4735bd8deadSopenharmony_ciFENCE_STATUS_NV     B     GetFenceivNV  determined by 1st SetFenceNV  Fence status     5.X      -
4745bd8deadSopenharmony_ciFENCE_CONDITION_NV  Z1    GetFenceivNV  determined by 1st SetFenceNV  Fence condition  5.X      -
4755bd8deadSopenharmony_ci
4765bd8deadSopenharmony_ciNew Implementation Dependent State
4775bd8deadSopenharmony_ci
4785bd8deadSopenharmony_ci    None
4795bd8deadSopenharmony_ci
4805bd8deadSopenharmony_ciDependencies on OpenGL ES
4815bd8deadSopenharmony_ci
4825bd8deadSopenharmony_ci    If implemented for OpenGL ES, NV_fence acts as described in this spec,
4835bd8deadSopenharmony_ci    except:
4845bd8deadSopenharmony_ci
4855bd8deadSopenharmony_ci        * Ignore all references to display lists and immediate mode, including
4865bd8deadSopenharmony_ci          changes to section 5.4 "Display Lists".
4875bd8deadSopenharmony_ci        * Ignore all references to GLX and GLX protocol.
4885bd8deadSopenharmony_ci
4895bd8deadSopenharmony_ciGeForce Implementation Details
4905bd8deadSopenharmony_ci
4915bd8deadSopenharmony_ci    This section describes implementation-defined limits for GeForce:
4925bd8deadSopenharmony_ci
4935bd8deadSopenharmony_ci        SetFenceNV calls are not free.  They should be used prudently,
4945bd8deadSopenharmony_ci        and a "good number" of commands should be sent between calls to
4955bd8deadSopenharmony_ci        SetFenceNV.  Each fence insertion will cause the GPU's command
4965bd8deadSopenharmony_ci        processing to go momentarily idle.  Testing or finishing a fence
4975bd8deadSopenharmony_ci        may require an one or more somewhat expensive uncached reads.
4985bd8deadSopenharmony_ci
4995bd8deadSopenharmony_ci        Do not leave a fence untested or unfinished for an extremely large
5005bd8deadSopenharmony_ci        interval of intervening fences.  If more than approximately 2
5015bd8deadSopenharmony_ci        billion (specifically 2^31-1) intervening fences are inserted into
5025bd8deadSopenharmony_ci        the GL command stream before a fence is tested or finished, said
5035bd8deadSopenharmony_ci        fence may indicate an incorrect status.  Note that certain GL
5045bd8deadSopenharmony_ci        operations involving display lists, compiled vertex arrays, and
5055bd8deadSopenharmony_ci        textures may insert fences implicitly for internal driver use.
5065bd8deadSopenharmony_ci
5075bd8deadSopenharmony_ci        In practice, this limitation is unlikely to be a practical
5085bd8deadSopenharmony_ci        limitation if fences are finished or tested within a few frames
5095bd8deadSopenharmony_ci        of their insertion into the GL command stream.
5105bd8deadSopenharmony_ci
5115bd8deadSopenharmony_ciRevision History
5125bd8deadSopenharmony_ci
5135bd8deadSopenharmony_ci    November 13, 2000 - GLX enumerant values assigned
5145bd8deadSopenharmony_ci
5155bd8deadSopenharmony_ci    October 3, 2003 - Changed version to 1.1.  glFinishFenceNV should
5165bd8deadSopenharmony_ci    not be compiled into display lists but rather executed immediately
5175bd8deadSopenharmony_ci    when called during display list construction.  Version 1.0 allowed
5185bd8deadSopenharmony_ci    this though it should not have been allowed.  Changed GLX protocol
5195bd8deadSopenharmony_ci    so that FinishFenceNV is a non-render request with a reply now.
5205bd8deadSopenharmony_ci    Thanks to Bob Beretta for noticing this issue.
5215bd8deadSopenharmony_ci
5225bd8deadSopenharmony_ci    Also fix a typo in the GLX protocol specification for IsFenceNV so
5235bd8deadSopenharmony_ci    the reply is 32 (not 33) bytes.
5245bd8deadSopenharmony_ci
5255bd8deadSopenharmony_ci    December 17. 2008 - Add "Dependencies on OpenGL ES" section.  Clarify
5265bd8deadSopenharmony_ci    generation of fence name vs creation of the fence itself.
527