15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    NV_primitive_restart
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_NV_primitive_restart
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Matt Craighead, NVIDIA Corporation (mcraighead 'at' nvidia.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciNotice
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    Copyright NVIDIA Corporation, 2002.
165bd8deadSopenharmony_ci
175bd8deadSopenharmony_ciIP Status
185bd8deadSopenharmony_ci
195bd8deadSopenharmony_ci    NVIDIA Proprietary.
205bd8deadSopenharmony_ci
215bd8deadSopenharmony_ciStatus
225bd8deadSopenharmony_ci
235bd8deadSopenharmony_ci    Implemented in CineFX (NV30) Emulation driver, August 2002.
245bd8deadSopenharmony_ci    Shipping in Release 40 NVIDIA driver for CineFX hardware, January 2003.
255bd8deadSopenharmony_ci
265bd8deadSopenharmony_ciVersion
275bd8deadSopenharmony_ci
285bd8deadSopenharmony_ci    NVIDIA Date: August 29, 2002 (version 0.1)
295bd8deadSopenharmony_ci
305bd8deadSopenharmony_ciNumber
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ci    285
335bd8deadSopenharmony_ci
345bd8deadSopenharmony_ciDependencies
355bd8deadSopenharmony_ci
365bd8deadSopenharmony_ci    Written based on the wording of the OpenGL 1.3 specification.
375bd8deadSopenharmony_ci
385bd8deadSopenharmony_ciOverview
395bd8deadSopenharmony_ci
405bd8deadSopenharmony_ci    This extension allows applications to easily and inexpensively
415bd8deadSopenharmony_ci    restart a primitive in its middle.  A "primitive restart" is simply
425bd8deadSopenharmony_ci    the same as an End command, followed by another Begin command with
435bd8deadSopenharmony_ci    the same mode as the original.  The typical expected use of this
445bd8deadSopenharmony_ci    feature is to draw a mesh with many triangle strips, though primitive
455bd8deadSopenharmony_ci    restarts are legal for all primitive types, even for points (where
465bd8deadSopenharmony_ci    they are not useful).
475bd8deadSopenharmony_ci
485bd8deadSopenharmony_ci    Although the EXT_multi_draw_arrays extension did reduce the overhead
495bd8deadSopenharmony_ci    of such drawing techniques, they still remain more expensive than one
505bd8deadSopenharmony_ci    would like.
515bd8deadSopenharmony_ci
525bd8deadSopenharmony_ci    This extension provides an extremely lightweight primitive restart,
535bd8deadSopenharmony_ci    which is accomplished by allowing the application to choose a special
545bd8deadSopenharmony_ci    index number that signals that a primitive restart should occur,
555bd8deadSopenharmony_ci    rather than a vertex being provoked.  This index can be an arbitrary
565bd8deadSopenharmony_ci    32-bit integer for maximum application convenience.
575bd8deadSopenharmony_ci
585bd8deadSopenharmony_ci    In addition, for full orthogonality, a special OpenGL command is
595bd8deadSopenharmony_ci    provided to restart primitives when in immediate mode.  This command
605bd8deadSopenharmony_ci    is not likely to increase performance in any significant fashion, but
615bd8deadSopenharmony_ci    providing it greatly simplifies the specification and implementation
625bd8deadSopenharmony_ci    of display list compilation and indirect rendering.
635bd8deadSopenharmony_ci
645bd8deadSopenharmony_ciIssues
655bd8deadSopenharmony_ci
665bd8deadSopenharmony_ci    *   What should the default primitive restart index be?
675bd8deadSopenharmony_ci
685bd8deadSopenharmony_ci        RESOLVED: Zero.  It's tough to pick another number that is
695bd8deadSopenharmony_ci        meaningful for all three element data types.  In practice, apps
705bd8deadSopenharmony_ci        are likely to set it to 0xFFFF or 0xFFFFFFFF.
715bd8deadSopenharmony_ci
725bd8deadSopenharmony_ci    *   Are primitives other than triangle strips supported?
735bd8deadSopenharmony_ci
745bd8deadSopenharmony_ci        RESOLVED: Yes.  One example of how this can be useful is for
755bd8deadSopenharmony_ci        rendering a heightfield.  The "standard" way to render a
765bd8deadSopenharmony_ci        heightfield uses a number of triangle strips, one for each row of
775bd8deadSopenharmony_ci        the grid.  Another method, which can produce higher-quality
785bd8deadSopenharmony_ci        meshes, is to render a number of 8-triangle triangle fans.  This
795bd8deadSopenharmony_ci        has the effect of alternating the direction of tessellation, as
805bd8deadSopenharmony_ci        shown in the diagram below.  Primitive restarts enhance the
815bd8deadSopenharmony_ci        performance of both techniques.
825bd8deadSopenharmony_ci
835bd8deadSopenharmony_ci        -------------------------        -------------------------
845bd8deadSopenharmony_ci        | /| /| /| /| /| /| /| /|        |\ | /|\ | /|\ | /|\ | /|
855bd8deadSopenharmony_ci        |/ |/ |/ |/ |/ |/ |/ |/ |        | \|/ | \|/ | \|/ | \|/ |
865bd8deadSopenharmony_ci        -------------------------        ---*-----*-----*-----*---
875bd8deadSopenharmony_ci        | /| /| /| /| /| /| /| /|        | /|\ | /|\ | /|\ | /|\ |
885bd8deadSopenharmony_ci        |/ |/ |/ |/ |/ |/ |/ |/ |        |/ | \|/ | \|/ | \|/ | \|
895bd8deadSopenharmony_ci        -------------------------        -------------------------
905bd8deadSopenharmony_ci
915bd8deadSopenharmony_ci                Two strips             Four fans (centers marked '*')
925bd8deadSopenharmony_ci
935bd8deadSopenharmony_ci    *   How is this feature turned on and off?
945bd8deadSopenharmony_ci
955bd8deadSopenharmony_ci        RESOLVED: Via a glEnable/DisableClientState setting.  It is not
965bd8deadSopenharmony_ci        possible to select a restart index that is guaranteed to be
975bd8deadSopenharmony_ci        unused.
985bd8deadSopenharmony_ci
995bd8deadSopenharmony_ci    *   Is the immediate mode PrimitiveRestartNV needed?
1005bd8deadSopenharmony_ci
1015bd8deadSopenharmony_ci        RESOLVED: Yes.  It is difficult to make indirect rendering to
1025bd8deadSopenharmony_ci        work without it, and it is near impossible to make display lists
1035bd8deadSopenharmony_ci        work without it.  It is a very clean way to resolve these issues.
1045bd8deadSopenharmony_ci
1055bd8deadSopenharmony_ci    *   How is indirect rendering handled?
1065bd8deadSopenharmony_ci
1075bd8deadSopenharmony_ci        RESOLVED: Because of PrimitiveRestartNV, it works very easily.
1085bd8deadSopenharmony_ci        PrimitiveRestartNV has a wire protocol and therefore it can
1095bd8deadSopenharmony_ci        easily be inserted as needed.  The server tracks the current
1105bd8deadSopenharmony_ci        Begin mode, relieving the client of this burden.
1115bd8deadSopenharmony_ci
1125bd8deadSopenharmony_ci        Note that in practice, we expect that this feature is essentially
1135bd8deadSopenharmony_ci        useless for indirect rendering.
1145bd8deadSopenharmony_ci
1155bd8deadSopenharmony_ci    *   How does this extension interact with NV_element_array and
1165bd8deadSopenharmony_ci        NV_vertex_array_range?
1175bd8deadSopenharmony_ci
1185bd8deadSopenharmony_ci        RESOLVED: It doesn't, not even for performance.  It should be
1195bd8deadSopenharmony_ci        fast on hardware that supports the feature with or without the
1205bd8deadSopenharmony_ci        use of element arrays, with or without vertex array range.
1215bd8deadSopenharmony_ci
1225bd8deadSopenharmony_ci        XXXmjc Is it feasible to guarantee fast performance even in the
1235bd8deadSopenharmony_ci        non-VAR, non-CVA, non-DRE case???  Possibly not.
1245bd8deadSopenharmony_ci
1255bd8deadSopenharmony_ci    *   Does this extension affect ArrayElement and DrawArrays, or just
1265bd8deadSopenharmony_ci        DrawElements?
1275bd8deadSopenharmony_ci
1285bd8deadSopenharmony_ci        RESOLVED: All of them.  It applies to ArrayElement and to the
1295bd8deadSopenharmony_ci        rest as a consequence.  It is likely not useful with any other
1305bd8deadSopenharmony_ci        than DrawElements, but nevertheless not prohibited.
1315bd8deadSopenharmony_ci
1325bd8deadSopenharmony_ci    *   In the case of ArrayElement, what happens if the restart index is
1335bd8deadSopenharmony_ci        used outside Begin/End?
1345bd8deadSopenharmony_ci
1355bd8deadSopenharmony_ci        RESOLVED: Since this is defined as being equivalent to a call to
1365bd8deadSopenharmony_ci        PrimitiveRestartNV, and PrimitiveRestartNV is an
1375bd8deadSopenharmony_ci        INVALID_OPERATION when not inside Begin/End, this is just an
1385bd8deadSopenharmony_ci        error.
1395bd8deadSopenharmony_ci
1405bd8deadSopenharmony_ci    *   For DrawRangeElements/LockArrays purposes, must the restart index
1415bd8deadSopenharmony_ci        lie within the start/end range?
1425bd8deadSopenharmony_ci
1435bd8deadSopenharmony_ci        RESOLVED: No, this would to some extent defeat the point if the
1445bd8deadSopenharmony_ci        restart index was, e.g., 0xFFFFFFFF.  I don't believe any spec
1455bd8deadSopenharmony_ci        language is required here, since hitting this index does not
1465bd8deadSopenharmony_ci        cause a vertex to be dereferenced.
1475bd8deadSopenharmony_ci
1485bd8deadSopenharmony_ci    *   Should this state push/pop?
1495bd8deadSopenharmony_ci
1505bd8deadSopenharmony_ci        RESOLVED: Yes, as vertex array client state.
1515bd8deadSopenharmony_ci
1525bd8deadSopenharmony_ciNew Procedures and Functions
1535bd8deadSopenharmony_ci
1545bd8deadSopenharmony_ci    void PrimitiveRestartNV(void);
1555bd8deadSopenharmony_ci    void PrimitiveRestartIndexNV(uint index);
1565bd8deadSopenharmony_ci
1575bd8deadSopenharmony_ciNew Tokens
1585bd8deadSopenharmony_ci
1595bd8deadSopenharmony_ci    Accepted by the <array> parameter of EnableClientState and
1605bd8deadSopenharmony_ci    DisableClientState, by the <cap> parameter of IsEnabled, and by
1615bd8deadSopenharmony_ci    the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and
1625bd8deadSopenharmony_ci    GetDoublev:
1635bd8deadSopenharmony_ci
1645bd8deadSopenharmony_ci        PRIMITIVE_RESTART_NV                           0x8558
1655bd8deadSopenharmony_ci
1665bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
1675bd8deadSopenharmony_ci    GetFloatv, and GetDoublev:
1685bd8deadSopenharmony_ci
1695bd8deadSopenharmony_ci        PRIMITIVE_RESTART_INDEX_NV                     0x8559
1705bd8deadSopenharmony_ci
1715bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 1.3 Specification (OpenGL Operation)
1725bd8deadSopenharmony_ci
1735bd8deadSopenharmony_ci    Add a section 2.6.X "Primitive Restarts", immediately after section
1745bd8deadSopenharmony_ci    2.6.2 "Polygon Edges" (page 19):
1755bd8deadSopenharmony_ci
1765bd8deadSopenharmony_ci    "2.6.X  Primitive Restarts
1775bd8deadSopenharmony_ci
1785bd8deadSopenharmony_ci    An OpenGL primitive may be restarted with the command
1795bd8deadSopenharmony_ci
1805bd8deadSopenharmony_ci      void PrimitiveRestartNV(void)
1815bd8deadSopenharmony_ci
1825bd8deadSopenharmony_ci    Between the execution of a Begin and its corresponding End, this
1835bd8deadSopenharmony_ci    command is equivalent to a call to End, followed by a call to Begin
1845bd8deadSopenharmony_ci    where the mode argument is the same mode as that used by the previous
1855bd8deadSopenharmony_ci    Begin.  Outside the execution of a Begin and its corresponding End,
1865bd8deadSopenharmony_ci    this command generates the error INVALID_OPERATION."
1875bd8deadSopenharmony_ci
1885bd8deadSopenharmony_ci
1895bd8deadSopenharmony_ci    Add PrimitiveRestartNV to the list of commands that are allowed
1905bd8deadSopenharmony_ci    between Begin and End in section 2.6.3 "GL Commands within Begin/End"
1915bd8deadSopenharmony_ci    (page 19).
1925bd8deadSopenharmony_ci
1935bd8deadSopenharmony_ci
1945bd8deadSopenharmony_ci    Add to section 2.8 "Vertex Arrays", after the description of
1955bd8deadSopenharmony_ci    ArrayElement (page 24):
1965bd8deadSopenharmony_ci
1975bd8deadSopenharmony_ci    "Primitive restarting is enabled or disabled by calling
1985bd8deadSopenharmony_ci    EnableClientState or DisableClientState with parameter
1995bd8deadSopenharmony_ci    PRIMITIVE_RESTART_NV.  The command
2005bd8deadSopenharmony_ci
2015bd8deadSopenharmony_ci      void PrimitiveRestartIndexNV(uint index)
2025bd8deadSopenharmony_ci
2035bd8deadSopenharmony_ci    specifies the index of a vertex array element that is treated
2045bd8deadSopenharmony_ci    specially when primitive restarting is enabled.  When ArrayElement is
2055bd8deadSopenharmony_ci    called between an execution of Begin and the corresponding execution
2065bd8deadSopenharmony_ci    of End, if i is equal to PRIMITIVE_RESTART_INDEX_NV, then no vertex
2075bd8deadSopenharmony_ci    data is derefererenced, and no current vertex state is modified.
2085bd8deadSopenharmony_ci    Instead, it is as if PrimitiveRestartNV had been called."
2095bd8deadSopenharmony_ci
2105bd8deadSopenharmony_ci
2115bd8deadSopenharmony_ci    Replace the last paragraph of section 2.8 "Vertex Arrays" (page 28)
2125bd8deadSopenharmony_ci    with the following:
2135bd8deadSopenharmony_ci
2145bd8deadSopenharmony_ci    "If the number of supported texture units (the value of
2155bd8deadSopenharmony_ci    MAX_TEXTURE_UNITS) is k, then the client state required to implement
2165bd8deadSopenharmony_ci    vertex arrays consists of 7+k boolean values, 5+k memory pointers,
2175bd8deadSopenharmony_ci    5+k integer stride values, 4+k symbolic constants representing array
2185bd8deadSopenharmony_ci    types, 3+k integers representing values per element, and an unsigned
2195bd8deadSopenharmony_ci    integer representing the restart index.  In the initial state, the
2205bd8deadSopenharmony_ci    boolean values are each disabled, the memory pointers are each null,
2215bd8deadSopenharmony_ci    the strides are each zero, the array types are each FLOAT, the
2225bd8deadSopenharmony_ci    integers representing values per element are each four, and the
2235bd8deadSopenharmony_ci    restart index is zero."
2245bd8deadSopenharmony_ci
2255bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 1.3 Specification (Rasterization)
2265bd8deadSopenharmony_ci
2275bd8deadSopenharmony_ci    None.
2285bd8deadSopenharmony_ci
2295bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 1.3 Specification (Per-Fragment
2305bd8deadSopenharmony_ciOperations and the Frame Buffer)
2315bd8deadSopenharmony_ci
2325bd8deadSopenharmony_ci    None.
2335bd8deadSopenharmony_ci
2345bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 1.3 Specification (Special Functions)
2355bd8deadSopenharmony_ci
2365bd8deadSopenharmony_ci    Add to the end of Section 5.4 "Display Lists":
2375bd8deadSopenharmony_ci
2385bd8deadSopenharmony_ci    "PrimitiveRestartIndexNV is not compiled into display lists, but is
2395bd8deadSopenharmony_ci    executed immediately."
2405bd8deadSopenharmony_ci
2415bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 1.3 Specification (State and
2425bd8deadSopenharmony_ciState Requests)
2435bd8deadSopenharmony_ci
2445bd8deadSopenharmony_ci    None.
2455bd8deadSopenharmony_ci
2465bd8deadSopenharmony_ciGLX Protocol
2475bd8deadSopenharmony_ci
2485bd8deadSopenharmony_ci    The following rendering commands are sent to the server as part of
2495bd8deadSopenharmony_ci    glXRender requests:
2505bd8deadSopenharmony_ci
2515bd8deadSopenharmony_ci        PrimitiveRestartNV
2525bd8deadSopenharmony_ci            2       4               rendering command length
2535bd8deadSopenharmony_ci            2       364             rendering command opcode
2545bd8deadSopenharmony_ci
2555bd8deadSopenharmony_ci        PrimitiveRestartIndexNV
2565bd8deadSopenharmony_ci            2       8               rendering command length
2575bd8deadSopenharmony_ci            2       365             rendering command opcode
2585bd8deadSopenharmony_ci            4       CARD32          index
2595bd8deadSopenharmony_ci
2605bd8deadSopenharmony_ciErrors
2615bd8deadSopenharmony_ci
2625bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if PrimitiveRestartNV is
2635bd8deadSopenharmony_ci    called outside the execution of Begin and the corresponding execution
2645bd8deadSopenharmony_ci    of End.
2655bd8deadSopenharmony_ci
2665bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if PrimitiveRestartIndexNV
2675bd8deadSopenharmony_ci    is called between the execution of Begin and the corresponding
2685bd8deadSopenharmony_ci    execution of End.
2695bd8deadSopenharmony_ci
2705bd8deadSopenharmony_ciNew State
2715bd8deadSopenharmony_ci
2725bd8deadSopenharmony_ci                                                           Initial
2735bd8deadSopenharmony_ci   Get Value                       Get Command     Type    Value      Sec    Attrib
2745bd8deadSopenharmony_ci   ---------                       -----------     ----    -------    ----   ------------
2755bd8deadSopenharmony_ci   PRIMITIVE_RESTART_NV            IsEnabled       B       FALSE      2.8    vertex-array
2765bd8deadSopenharmony_ci   PRIMITIVE_RESTART_INDEX_NV      GetIntegerv     Z+      0          2.8    vertex-array
2775bd8deadSopenharmony_ci
2785bd8deadSopenharmony_ciRevision History
2795bd8deadSopenharmony_ci
2805bd8deadSopenharmony_ci    none yet
281