15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    ARB_draw_elements_base_vertex
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_ARB_draw_elements_base_vertex
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContributors
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Daniel Koch, TransGaming
125bd8deadSopenharmony_ci    James Helferty, TransGaming
135bd8deadSopenharmony_ci    Jeff Bolz, NVIDIA
145bd8deadSopenharmony_ci    Bruce Merry, ARM
155bd8deadSopenharmony_ci    Ian Romanick, Intel
165bd8deadSopenharmony_ci    Jon Leech, Khronos
175bd8deadSopenharmony_ci
185bd8deadSopenharmony_ciContact
195bd8deadSopenharmony_ci
205bd8deadSopenharmony_ci    Daniel Koch, TransGaming (daniel 'at' transgaming.com)
215bd8deadSopenharmony_ci
225bd8deadSopenharmony_ciNotice
235bd8deadSopenharmony_ci
245bd8deadSopenharmony_ci    Copyright (c) 2009-2013 The Khronos Group Inc. Copyright terms at
255bd8deadSopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
265bd8deadSopenharmony_ci
275bd8deadSopenharmony_ciSpecification Update Policy
285bd8deadSopenharmony_ci
295bd8deadSopenharmony_ci    Khronos-approved extension specifications are updated in response to
305bd8deadSopenharmony_ci    issues and bugs prioritized by the Khronos OpenGL Working Group. For
315bd8deadSopenharmony_ci    extensions which have been promoted to a core Specification, fixes will
325bd8deadSopenharmony_ci    first appear in the latest version of that core Specification, and will
335bd8deadSopenharmony_ci    eventually be backported to the extension document. This policy is
345bd8deadSopenharmony_ci    described in more detail at
355bd8deadSopenharmony_ci        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
365bd8deadSopenharmony_ci
375bd8deadSopenharmony_ciStatus
385bd8deadSopenharmony_ci
395bd8deadSopenharmony_ci    Complete. Approved by the ARB on July 3, 2009.
405bd8deadSopenharmony_ci
415bd8deadSopenharmony_ciVersion
425bd8deadSopenharmony_ci
435bd8deadSopenharmony_ci    Last Modified Date:  August 22, 2019
445bd8deadSopenharmony_ci    Version:             4
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ciNumber
475bd8deadSopenharmony_ci
485bd8deadSopenharmony_ci    ARB Extension #62
495bd8deadSopenharmony_ci
505bd8deadSopenharmony_ciDependencies
515bd8deadSopenharmony_ci
525bd8deadSopenharmony_ci    This extension is written against the OpenGL 3.1 Specification but
535bd8deadSopenharmony_ci    can apply to prior specifications.
545bd8deadSopenharmony_ci
555bd8deadSopenharmony_ci    This extension interacts with ARB_draw_instanced.
565bd8deadSopenharmony_ci
575bd8deadSopenharmony_ci    This extension interacts with EXT_draw_instanced.
585bd8deadSopenharmony_ci
595bd8deadSopenharmony_ci    This extension interacts with ARB_instanced_arrays.
605bd8deadSopenharmony_ci
615bd8deadSopenharmony_ci    This extension interacts with ARB_compatibility.
625bd8deadSopenharmony_ci
635bd8deadSopenharmony_ciOverview
645bd8deadSopenharmony_ci
655bd8deadSopenharmony_ci    This extension provides a method to specify a "base vertex offset"
665bd8deadSopenharmony_ci    value which is effectively added to every vertex index that is
675bd8deadSopenharmony_ci    transferred through DrawElements.
685bd8deadSopenharmony_ci
695bd8deadSopenharmony_ci    This mechanism can be used to decouple a set of indices from the
705bd8deadSopenharmony_ci    actual vertex array that it is referencing. This is useful if an
715bd8deadSopenharmony_ci    application stores multiple indexed models in a single vertex array.
725bd8deadSopenharmony_ci    The same index array can be used to draw the model no matter where
735bd8deadSopenharmony_ci    it ends up in a larger vertex array simply by changing the base
745bd8deadSopenharmony_ci    vertex value. Without this functionality, it would be necessary to
755bd8deadSopenharmony_ci    rebind all the vertex attributes every time geometry is switched and
765bd8deadSopenharmony_ci    this can have larger performance penalty.
775bd8deadSopenharmony_ci
785bd8deadSopenharmony_ci    For example consider the (very contrived and simple) example of
795bd8deadSopenharmony_ci    drawing two triangles to form a quad. In the typical example you
805bd8deadSopenharmony_ci    have the following setup:
815bd8deadSopenharmony_ci
825bd8deadSopenharmony_ci          vertices                indices
835bd8deadSopenharmony_ci         ----------                -----
845bd8deadSopenharmony_ci      0 | (-1,  1) |            0 |  0  |
855bd8deadSopenharmony_ci      1 | (-1, -1) |            1 |  1  |
865bd8deadSopenharmony_ci      2 | ( 1, -1) |            2 |  2  |
875bd8deadSopenharmony_ci      3 | ( 1,  1) |            3 |  3  |
885bd8deadSopenharmony_ci         ----------             4 |  0  |
895bd8deadSopenharmony_ci                                5 |  2  |
905bd8deadSopenharmony_ci                                   -----
915bd8deadSopenharmony_ci    which is normally rendered with the call
925bd8deadSopenharmony_ci
935bd8deadSopenharmony_ci       DrawElements(TRIANGLES, 6, UNSIGNED_BYTE, &indices).
945bd8deadSopenharmony_ci
955bd8deadSopenharmony_ci    Now consider the case where the vertices you want to draw are not at
965bd8deadSopenharmony_ci    the start of a vertex array but are instead located at offset 100
975bd8deadSopenharmony_ci    into a larger array:
985bd8deadSopenharmony_ci
995bd8deadSopenharmony_ci           vertices2             indices2
1005bd8deadSopenharmony_ci           ----------             -----
1015bd8deadSopenharmony_ci              ....             0 | 100 |
1025bd8deadSopenharmony_ci      100 | (-1,  1) |         1 | 101 |
1035bd8deadSopenharmony_ci      101 | (-1, -1) |         2 | 102 |
1045bd8deadSopenharmony_ci      102 | ( 1, -1) |         3 | 103 |
1055bd8deadSopenharmony_ci      103 | ( 1,  1) |         4 | 100 |
1065bd8deadSopenharmony_ci              ....             5 | 102 |
1075bd8deadSopenharmony_ci           ----------             -----
1085bd8deadSopenharmony_ci
1095bd8deadSopenharmony_ci    The typical choices for rendering this are to rebind your vertex
1105bd8deadSopenharmony_ci    attributes with an additional offset of 100*stride, or to create an
1115bd8deadSopenharmony_ci    new array of indices (as indices2 in the example). However both
1125bd8deadSopenharmony_ci    rebinding vertex attributes and rebuilding index arrays can be quite
1135bd8deadSopenharmony_ci    costly activities.
1145bd8deadSopenharmony_ci
1155bd8deadSopenharmony_ci    With the new drawing commands introduced by this extension you can
1165bd8deadSopenharmony_ci    instead draw using vertices2 and the new draw call:
1175bd8deadSopenharmony_ci
1185bd8deadSopenharmony_ci       DrawElementsBaseVertex(TRIANGLES, 6, UNSIGNED_BYTE, &indices, 100)
1195bd8deadSopenharmony_ci
1205bd8deadSopenharmony_ciNew Procedures and Functions
1215bd8deadSopenharmony_ci
1225bd8deadSopenharmony_ci    void DrawElementsBaseVertex(enum mode, sizei count, enum type,
1235bd8deadSopenharmony_ci         const void *indices, int basevertex);
1245bd8deadSopenharmony_ci
1255bd8deadSopenharmony_ci    void DrawRangeElementsBaseVertex(enum mode, uint start, uint end,
1265bd8deadSopenharmony_ci         sizei count, enum type, const void *indices, int basevertex);
1275bd8deadSopenharmony_ci
1285bd8deadSopenharmony_ci    void DrawElementsInstancedBaseVertex(enum mode, sizei count,
1295bd8deadSopenharmony_ci         enum type, const void *indices, sizei instancecount, int basevertex);
1305bd8deadSopenharmony_ci
1315bd8deadSopenharmony_ci    void MultiDrawElementsBaseVertex(enum mode, const sizei *count, enum type,
1325bd8deadSopenharmony_ci         const void *const *indices, sizei drawcount, const int *basevertex)
1335bd8deadSopenharmony_ci
1345bd8deadSopenharmony_ciNew Tokens
1355bd8deadSopenharmony_ci
1365bd8deadSopenharmony_ci    None
1375bd8deadSopenharmony_ci
1385bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 3.1 Specification (OpenGL Operation)
1395bd8deadSopenharmony_ci
1405bd8deadSopenharmony_ci    Add the following to the end of Section 2.8.1 "Transferring Array Elements"
1415bd8deadSopenharmony_ci
1425bd8deadSopenharmony_ci    "When one of the *BaseVertex drawing commands specified in section
1435bd8deadSopenharmony_ci    2.8.2 is used, the primitive restart comparison occurs before the
1445bd8deadSopenharmony_ci    <basevertex> offset is added to the array index."
1455bd8deadSopenharmony_ci
1465bd8deadSopenharmony_ci    Add the following to Section 2.8.2 "Drawing Commands"
1475bd8deadSopenharmony_ci
1485bd8deadSopenharmony_ci    "The commands
1495bd8deadSopenharmony_ci      void DrawElementsBaseVertex(enum mode, sizei count, enum type,
1505bd8deadSopenharmony_ci           const void *indices, int basevertex);
1515bd8deadSopenharmony_ci
1525bd8deadSopenharmony_ci      void DrawRangeElementsBaseVertex(enum mode, uint start, uint end,
1535bd8deadSopenharmony_ci           sizei count, enum type, const void *indices, int basevertex);
1545bd8deadSopenharmony_ci
1555bd8deadSopenharmony_ci      void DrawElementsInstancedBaseVertex(enum mode, sizei count,
1565bd8deadSopenharmony_ci           enum type, const void *indices, sizei instancecount, int basevertex);
1575bd8deadSopenharmony_ci
1585bd8deadSopenharmony_ci    are equivalent to the commands with the same base name (without the
1595bd8deadSopenharmony_ci    "BaseVertex" suffix) except that the <i>th element transferred by
1605bd8deadSopenharmony_ci    the corresponding draw call will be taken from element
1615bd8deadSopenharmony_ci       <indices>[<i>] + <basevertex>
1625bd8deadSopenharmony_ci    of each enabled array. If the resulting value is larger than the
1635bd8deadSopenharmony_ci    maximum value representable by <type> it should behave as if the
1645bd8deadSopenharmony_ci    calculation were upconverted to 32-bit unsigned integers (with
1655bd8deadSopenharmony_ci    wrapping on overflow conditions). The operation is undefined if the
1665bd8deadSopenharmony_ci    sum would be negative and should be handled as described in Section
1675bd8deadSopenharmony_ci    2.9.2. For DrawRangeElementsBaseVertex, the index values must lie
1685bd8deadSopenharmony_ci    between <start> and <end> inclusive, prior to adding the
1695bd8deadSopenharmony_ci    <basevertex> offset. Index values lying outside the range
1705bd8deadSopenharmony_ci    [<start>,<end>] are treated in the same way as DrawRangeElements.
1715bd8deadSopenharmony_ci
1725bd8deadSopenharmony_ci    The command
1735bd8deadSopenharmony_ci
1745bd8deadSopenharmony_ci      void MultiDrawElementsBaseVertex(enum mode, const sizei *count,
1755bd8deadSopenharmony_ci           enum type, const void *const *indices, sizei drawcount, const int *basevertex);
1765bd8deadSopenharmony_ci
1775bd8deadSopenharmony_ci    behaves identically to DrawElementsBaseVertex except that
1785bd8deadSopenharmony_ci    <drawcount> separate lists of elements are specified instead. It has
1795bd8deadSopenharmony_ci    the same effect as:
1805bd8deadSopenharmony_ci
1815bd8deadSopenharmony_ci      for (i = 0; i < drawcount; i++) {
1825bd8deadSopenharmony_ci        if (count[i] > 0)
1835bd8deadSopenharmony_ci          DrawElementsBaseVertex(mode, count[i], type, indices[i],
1845bd8deadSopenharmony_ci                                 basevertex[i]);
1855bd8deadSopenharmony_ci      }"
1865bd8deadSopenharmony_ci
1875bd8deadSopenharmony_ci
1885bd8deadSopenharmony_ci    In Section 2.9.5 "Array Indices in Buffer Offer Objects" add
1895bd8deadSopenharmony_ci    references to the new drawing commands.
1905bd8deadSopenharmony_ci
1915bd8deadSopenharmony_ci    In the third paragraph, replace the second sentence (which begins
1925bd8deadSopenharmony_ci    with "MultiDrawElements also sources...") with the following
1935bd8deadSopenharmony_ci    sentences:
1945bd8deadSopenharmony_ci
1955bd8deadSopenharmony_ci    "DrawElementsBaseVertex, DrawRangeElementsBaseVertex, and
1965bd8deadSopenharmony_ci    DrawElementsInstancedBaseVertex also source their vertices from that
1975bd8deadSopenharmony_ci    buffer object, adding the <basevertex> offset to the appropriate
1985bd8deadSopenharmony_ci    vertex index as a final step before indexing into the vertex buffer;
1995bd8deadSopenharmony_ci    this does not affect the calculation of the base pointer for the
2005bd8deadSopenharmony_ci    index array. Finally, MultiDrawElements and
2015bd8deadSopenharmony_ci    MultiDrawElementsBaseVertex also source their indices from that
2025bd8deadSopenharmony_ci    buffer object, using its <indices> parameter as a pointer to an
2035bd8deadSopenharmony_ci    array of pointers that represet offsets into the buffer object."
2045bd8deadSopenharmony_ci
2055bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 3.1 Specification (Rasterization)
2065bd8deadSopenharmony_ci
2075bd8deadSopenharmony_ci    None
2085bd8deadSopenharmony_ci
2095bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 3.1 Specification (Per-Fragment
2105bd8deadSopenharmony_ciOperations and the Frame Buffer)
2115bd8deadSopenharmony_ci
2125bd8deadSopenharmony_ci    None
2135bd8deadSopenharmony_ci
2145bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 3.1 Specification (Special
2155bd8deadSopenharmony_ciFunctions)
2165bd8deadSopenharmony_ci
2175bd8deadSopenharmony_ci    None
2185bd8deadSopenharmony_ci
2195bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 3.1 Specification (State and
2205bd8deadSopenharmony_ciState Requests)
2215bd8deadSopenharmony_ci
2225bd8deadSopenharmony_ci    None
2235bd8deadSopenharmony_ci
2245bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications
2255bd8deadSopenharmony_ci
2265bd8deadSopenharmony_ci    None
2275bd8deadSopenharmony_ci
2285bd8deadSopenharmony_ciDependencies on OpenGL 3.1
2295bd8deadSopenharmony_ci
2305bd8deadSopenharmony_ci    If OpenGL 3.1 is not supported, ignore all references to
2315bd8deadSopenharmony_ci    DrawElementsInstanced and DrawElementsInstancedBaseVertex
2325bd8deadSopenharmony_ci
2335bd8deadSopenharmony_ciDependencies on the ARB_draw_instanced extension
2345bd8deadSopenharmony_ci
2355bd8deadSopenharmony_ci    If ARB_draw_instanced is supported, the functionality provided by
2365bd8deadSopenharmony_ci    DrawElementsInstancedBaseVertex can also be described in terms of
2375bd8deadSopenharmony_ci    DrawElementsInstancedARB instead of DrawElementsInstanced.
2385bd8deadSopenharmony_ci
2395bd8deadSopenharmony_ciDependencies on the EXT_draw_instanced extension
2405bd8deadSopenharmony_ci
2415bd8deadSopenharmony_ci    If EXT_draw_instanced is supported, the functionality provided by
2425bd8deadSopenharmony_ci    DrawElementsInstancedBaseVertex can also be described in terms of
2435bd8deadSopenharmony_ci    DrawElementsInstancedEXT instead of DrawElementsInstanced.
2445bd8deadSopenharmony_ci
2455bd8deadSopenharmony_ciDependencies on the ARB_instanced_arrays extension
2465bd8deadSopenharmony_ci
2475bd8deadSopenharmony_ci    If ARB_instanced_arrays is supported, the functionality provided by
2485bd8deadSopenharmony_ci    DrawElementsInstancedBaseVertex can also be described in
2495bd8deadSopenharmony_ci    terms of DrawElementsInstancedARB instead of DrawElementsInstanced.
2505bd8deadSopenharmony_ci
2515bd8deadSopenharmony_ciDependencies on the ARB_compatibility extension
2525bd8deadSopenharmony_ci
2535bd8deadSopenharmony_ci    When the ARB_compatibility extension is supported, the base vertex
2545bd8deadSopenharmony_ci    functionality applies to both buffer objects and client-side vertex
2555bd8deadSopenharmony_ci    arrays. Additionally there may be some textual differences in the
2565bd8deadSopenharmony_ci    specification because the behaviour of DrawElements is defined in
2575bd8deadSopenharmony_ci    terms of ArrayElement, but the functionality remains the same. Note
2585bd8deadSopenharmony_ci    in particular the interaction with the primitive restart index as
2595bd8deadSopenharmony_ci    identified in Issue 5.
2605bd8deadSopenharmony_ci
2615bd8deadSopenharmony_ci    When ARB_compatibility is supported edit the first bullet point of
2625bd8deadSopenharmony_ci    the "Shader Inputs" subsection of Section 2.14.7 "Shader Execution"
2635bd8deadSopenharmony_ci    and replace the language enumerating the drawing commands which
2645bd8deadSopenharmony_ci    specify a complete primitive for the purposes of defining
2655bd8deadSopenharmony_ci    gl_VertexID to be more general purpose:
2665bd8deadSopenharmony_ci        "(a vertex array drawing command other than ArrayElement)."
2675bd8deadSopenharmony_ci
2685bd8deadSopenharmony_ciErrors
2695bd8deadSopenharmony_ci
2705bd8deadSopenharmony_ci    The *BaseVertex commands have identical error conditions to the
2715bd8deadSopenharmony_ci    non-*BaseVertex functions, and all values of <basevertex> are legal
2725bd8deadSopenharmony_ci    (with the exception of ones which cause accesses outside of vertex
2735bd8deadSopenharmony_ci    arrays or bound buffers as described in Section 2.9.2).
2745bd8deadSopenharmony_ci
2755bd8deadSopenharmony_ciNew State
2765bd8deadSopenharmony_ci
2775bd8deadSopenharmony_ci    None
2785bd8deadSopenharmony_ci
2795bd8deadSopenharmony_ciNew Implementation Dependent State
2805bd8deadSopenharmony_ci
2815bd8deadSopenharmony_ci    None
2825bd8deadSopenharmony_ci
2835bd8deadSopenharmony_ciIssues
2845bd8deadSopenharmony_ci
2855bd8deadSopenharmony_ci    1. What should this extension be called?
2865bd8deadSopenharmony_ci
2875bd8deadSopenharmony_ci       RESOLVED: Using ARB_draw_elements_base_vertex.
2885bd8deadSopenharmony_ci
2895bd8deadSopenharmony_ci       DISCUSSION: Using the base "draw_elements" since this extension
2905bd8deadSopenharmony_ci       adds a new variant to the DrawElements family of commands which
2915bd8deadSopenharmony_ci       takes an additional parameter. Since the new suffix on the
2925bd8deadSopenharmony_ci       drawing commands is "BaseVertex" it makes sense to call this
2935bd8deadSopenharmony_ci       "draw_elements_base_vertex" (and it is more aesthetically
2945bd8deadSopenharmony_ci       pleasing then "draw_elements_basevertex".
2955bd8deadSopenharmony_ci
2965bd8deadSopenharmony_ci       Initial versions of this extension were called
2975bd8deadSopenharmony_ci       "draw_elements_offset" (see Issue 9).
2985bd8deadSopenharmony_ci
2995bd8deadSopenharmony_ci       Other alternatives considered: index_offset or element_offset.
3005bd8deadSopenharmony_ci       These variants might have been more suitable if we had used a
3015bd8deadSopenharmony_ci       different mechanism for specifying the base vertex offset (see
3025bd8deadSopenharmony_ci       Issue 2).
3035bd8deadSopenharmony_ci
3045bd8deadSopenharmony_ci    2. Should we have a per-draw call parameter or should this be
3055bd8deadSopenharmony_ci       specified via some other mechanism (ELEMENT_ARRAY bind parameter,
3065bd8deadSopenharmony_ci       global state, etc).
3075bd8deadSopenharmony_ci
3085bd8deadSopenharmony_ci       RESOLVED. Using per-draw call.
3095bd8deadSopenharmony_ci
3105bd8deadSopenharmony_ci       DISCUSSION: If per-draw call we need entry points to specify the
3115bd8deadSopenharmony_ci       equivalent of DrawElements, DrawRangeElements,
3125bd8deadSopenharmony_ci       DrawElementsInstanced and possibly MultiDrawElements, but with an
3135bd8deadSopenharmony_ci       additional parameter.
3145bd8deadSopenharmony_ci
3155bd8deadSopenharmony_ci       Per binding point, such as
3165bd8deadSopenharmony_ci       glBindBufferBaseVertex(ELEMENT_ARRAY_BUFFER, id, 1234)? If
3175bd8deadSopenharmony_ci       per-ELEMENT_ARRAY binding point, the application will need to
3185bd8deadSopenharmony_ci       rebind the index buffer every time they wish to adjust the
3195bd8deadSopenharmony_ci       basevertex, which partially defeats the purpose of this
3205bd8deadSopenharmony_ci       extension. As well this would make it more difficult to support
3215bd8deadSopenharmony_ci       client arrays in an implementation which supports
3225bd8deadSopenharmony_ci       ARB_compatibility.
3235bd8deadSopenharmony_ci
3245bd8deadSopenharmony_ci       If this is a global state, should it be server or client state?
3255bd8deadSopenharmony_ci       Is it per-gc? We could have a separate API call, e.g.
3265bd8deadSopenharmony_ci       glIndexOffset(1234), that would be per-VAO. This method doesn't
3275bd8deadSopenharmony_ci       require rebinding buffers and would work fine for client vertex
3285bd8deadSopenharmony_ci       arrays. In many ways though having a global state doesn't make
3295bd8deadSopenharmony_ci       much sense, since it is may only relevant for a single draw call,
3305bd8deadSopenharmony_ci       and encapsulating this in the VAO-state may mean that additional
3315bd8deadSopenharmony_ci       VAO must be created.
3325bd8deadSopenharmony_ci
3335bd8deadSopenharmony_ci    3. This functionality seems vaguely familiar. Do any other APIs have
3345bd8deadSopenharmony_ci       this functionality?
3355bd8deadSopenharmony_ci
3365bd8deadSopenharmony_ci       YES. This is equivalent to the BaseVertexIndex (d3d9) or
3375bd8deadSopenharmony_ci       BaseVertexLocation (d3d10) indexed drawing parameters in
3385bd8deadSopenharmony_ci       Direct3D.
3395bd8deadSopenharmony_ci
3405bd8deadSopenharmony_ci    4. Should there be a MultiDrawElementsBaseVertex? If so, should it
3415bd8deadSopenharmony_ci       take a single basevertex or an array of them?
3425bd8deadSopenharmony_ci
3435bd8deadSopenharmony_ci       RESOLVED: YES. Let's add it for completeness. It seems to make
3445bd8deadSopenharmony_ci       the most sense to pass in an array of basevertex parameters for
3455bd8deadSopenharmony_ci       this command, as this provides the most flexibility, and it works
3465bd8deadSopenharmony_ci       well to define it in terms of DrawElementsBaseVertex.
3475bd8deadSopenharmony_ci
3485bd8deadSopenharmony_ci    5. What are the interactions with primitive restart?
3495bd8deadSopenharmony_ci
3505bd8deadSopenharmony_ci       RESOLVED. The primitive restart comparison occurs before adding
3515bd8deadSopenharmony_ci       the basevertex.
3525bd8deadSopenharmony_ci
3535bd8deadSopenharmony_ci       DISCUSSION:
3545bd8deadSopenharmony_ci       DX10 and existing hardware do the primitive restart comparison
3555bd8deadSopenharmony_ci       before adding the basevertex. It's really the only sane thing to
3565bd8deadSopenharmony_ci       do, otherwise the app would have to change the restartindex to
3575bd8deadSopenharmony_ci       depend on the basevertex.
3585bd8deadSopenharmony_ci
3595bd8deadSopenharmony_ci       This is counterintuitively not the result you would get if
3605bd8deadSopenharmony_ci       DrawElements were still defined in terms of ArrayElement and you
3615bd8deadSopenharmony_ci       defined these in the natural way
3625bd8deadSopenharmony_ci       (ArrayElement(indices[i]+basevertex)), but this is likely what
3635bd8deadSopenharmony_ci       developers want and also what the hardware does.
3645bd8deadSopenharmony_ci
3655bd8deadSopenharmony_ci    6. What happens if indices[i]+basevertex is larger than the max
3665bd8deadSopenharmony_ci       value representable by <type>.
3675bd8deadSopenharmony_ci
3685bd8deadSopenharmony_ci       RESOLVED. Behave as if everything is upconverted to 32-bit
3695bd8deadSopenharmony_ci       unsigned integers. If the addition over/underflows 32-bits, it
3705bd8deadSopenharmony_ci       wraps. This is the behaviour D3D10 uses and likely how it is
3715bd8deadSopenharmony_ci       implemented in hardware.
3725bd8deadSopenharmony_ci
3735bd8deadSopenharmony_ci    7. What happens if the sum is negative (ie indices[i]+basevertex < 0)?
3745bd8deadSopenharmony_ci
3755bd8deadSopenharmony_ci       RESOLVED: Undefined. This should be handled the same way as a
3765bd8deadSopenharmony_ci       buffer that accesses out of bounds data. This is defined in
3775bd8deadSopenharmony_ci       Section 2.9.2 "Effects of Accessing Outside of Buffer Bounds". If
3785bd8deadSopenharmony_ci       detected this results in a GL error, otherwise it has undefined
3795bd8deadSopenharmony_ci       results and may result in GL interruption or termination. This is
3805bd8deadSopenharmony_ci       also undefined under Direct3D.
3815bd8deadSopenharmony_ci
3825bd8deadSopenharmony_ci    8. For DrawRangeElementsBaseVertex, is the intent that indices[i]
3835bd8deadSopenharmony_ci       are all in [start,end] and not indices[i]+basevertex?
3845bd8deadSopenharmony_ci
3855bd8deadSopenharmony_ci       RESOLVED: YES, indices[i] must be in the range [start,end].
3865bd8deadSopenharmony_ci
3875bd8deadSopenharmony_ci       DISCUSSION: There doesn't appear to be a hardware or driver
3885bd8deadSopenharmony_ci       reason to prefer one interpretation over the other. D3D9 treats
3895bd8deadSopenharmony_ci       the MinIndex parameter to the DrawIndexedPrimitive call as
3905bd8deadSopenharmony_ci       relative to the index buffer, so in the interests of
3915bd8deadSopenharmony_ci       compatibility we will make the same choice.
3925bd8deadSopenharmony_ci
3935bd8deadSopenharmony_ci    9. The word "offset" sounds like it should be measured in bytes. Is
3945bd8deadSopenharmony_ci       there a better term we could use for this?
3955bd8deadSopenharmony_ci
3965bd8deadSopenharmony_ci       RESOLVED: Use "BaseVertex" and call the parameter <basevertex>.
3975bd8deadSopenharmony_ci
3985bd8deadSopenharmony_ci       BACKGROUND:
3995bd8deadSopenharmony_ci       Initial drafts of this extension used the suffix "Offset" on the
4005bd8deadSopenharmony_ci       DrawElement calls, and the new parameter was named
4015bd8deadSopenharmony_ci       "vertexoffset".
4025bd8deadSopenharmony_ci
4035bd8deadSopenharmony_ci       DISCUSSION: What other term could we use?
4045bd8deadSopenharmony_ci
4055bd8deadSopenharmony_ci       Possibly something with "base" in it, partly because DX has that
4065bd8deadSopenharmony_ci       in the name and partly because it reminds one of ListBase and
4075bd8deadSopenharmony_ci       texture base level. However it does conflict with the meaning of
4085bd8deadSopenharmony_ci       "base" in BindBufferBase...
4095bd8deadSopenharmony_ci
4105bd8deadSopenharmony_ci   10. Clarification is needed when using an ELEMENT_ARRAY_BUFFER, since
4115bd8deadSopenharmony_ci       <indices> is actually an offset into a VBO rather than an array
4125bd8deadSopenharmony_ci       itself.
4135bd8deadSopenharmony_ci
4145bd8deadSopenharmony_ci       DISCUSSION: When ELEMENT_ARRAY_BUFFERS are used to provide the
4155bd8deadSopenharmony_ci       index data (as they must be in GL 3.1 without the
4165bd8deadSopenharmony_ci       ARB_compatibility extension) the <indices> parameters to the
4175bd8deadSopenharmony_ci       DrawElements calls are treated as offsets into the buffer objects
4185bd8deadSopenharmony_ci       as described in Sections 2.9.4 and 2.9.5.
4195bd8deadSopenharmony_ci
4205bd8deadSopenharmony_ci       Logically this is as if a <realindices> array were computed as
4215bd8deadSopenharmony_ci       follows: <type> realindices = (<type>)((byte)bufferptr +
4225bd8deadSopenharmony_ci       ((byte)indices - (byte)NULL))
4235bd8deadSopenharmony_ci
4245bd8deadSopenharmony_ci       Then base vertex offset is then computed as "realindices[i] +
4255bd8deadSopenharmony_ci       basevertex"
4265bd8deadSopenharmony_ci
4275bd8deadSopenharmony_ci   11. Why do the new function entry points in this extension not have
4285bd8deadSopenharmony_ci       the "ARB" suffixes like other ARB extensions?
4295bd8deadSopenharmony_ci
4305bd8deadSopenharmony_ci       RESOLVED: This extension is a strict subset of the functionality
4315bd8deadSopenharmony_ci       already in OpenGL 3.2. This extension exists only to support that
4325bd8deadSopenharmony_ci       functionality on older versions of OpenGL and on hardware which
4335bd8deadSopenharmony_ci       is not OpenGL 3.x capable. Since there are no possible behavior
4345bd8deadSopenharmony_ci       changes between the ARB extension and core features, source code
4355bd8deadSopenharmony_ci       compatibility is improved by not using suffixes on the extension.
4365bd8deadSopenharmony_ci
4375bd8deadSopenharmony_ciRevision History
4385bd8deadSopenharmony_ci
4395bd8deadSopenharmony_ci    Rev.    Date    Author     Changes
4405bd8deadSopenharmony_ci    ----  -------- ---------  ----------------------------------------
4415bd8deadSopenharmony_ci     0.1   4/29/09  dgkoch     initial skeleton
4425bd8deadSopenharmony_ci     0.2   4/30/09  dgkoch     first cut at per-draw call spec
4435bd8deadSopenharmony_ci     0.3   4/30/09  dgkoch     add issues 4-10, fix some typos and error in the example
4445bd8deadSopenharmony_ci                               based on comments from JB, BM
4455bd8deadSopenharmony_ci     0.4   5/06/09  dgkoch     resolved issue 2, sticking with per-draw call
4465bd8deadSopenharmony_ci                               resolved issue 4, add MultiDrawElementsBaseVertex w/ array
4475bd8deadSopenharmony_ci                               resolved issue 5, primitive restart compare happens first
4485bd8deadSopenharmony_ci                               resolved issue 6, behave as if 32-bit, including wrapping
4495bd8deadSopenharmony_ci                               resolved issue 7, undefined behaviour
4505bd8deadSopenharmony_ci                               resolved issue 8, indices[i] lies in the range [start,end]
4515bd8deadSopenharmony_ci                               sugggested resolution for issue 9: "BaseVertex"
4525bd8deadSopenharmony_ci                               clarified issue 10
4535bd8deadSopenharmony_ci                               misc formatting and typo fixes
4545bd8deadSopenharmony_ci     0.5   5/07/09  dgkoch     flipped y-coord in example
4555bd8deadSopenharmony_ci                               fixed spacing and typos
4565bd8deadSopenharmony_ci                               added more disscussion to Issue 2
4575bd8deadSopenharmony_ci                               removed clause from Issue 7 which contradicted Issue 6
4585bd8deadSopenharmony_ci     0.6   5/15/09  dgkoch     add resolution to issue 9, and rename appropriately
4595bd8deadSopenharmony_ci                               resolve issue 1
4605bd8deadSopenharmony_ci                               add interactions/dependencies
4615bd8deadSopenharmony_ci                               minor updates to the overview
4625bd8deadSopenharmony_ci                               update textual edits to reflect issues 5-8, 10
4635bd8deadSopenharmony_ci                               add issue 11
4645bd8deadSopenharmony_ci     0.7   5/18/09  dgkoch     minor grammer, spelling and typographical errors
4655bd8deadSopenharmony_ci                               Add interaction with ARB_compatibility
4665bd8deadSopenharmony_ci     1     6/26/09  dgkoch     resync language with GL3.2 spec
4675bd8deadSopenharmony_ci                               Add more interactions with ARB_compatibility
4685bd8deadSopenharmony_ci     2     7/21/09  dgkoch     resync language with 20090630 3.2 spec
4695bd8deadSopenharmony_ci     3     8/02/09  Jon Leech  Reformat to 80 columns and assign ARB
4705bd8deadSopenharmony_ci                               extension number.
4715bd8deadSopenharmony_ci     4     8/22/19  N Stewart  Parameter naming and const aligned to 4.6 core spec.
472