15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci ARB_indirect_parameters 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_ARB_indirect_parameters 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Graham Sellers (graham.sellers 'at' amd.com) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciContributors 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci ??? 165bd8deadSopenharmony_ci 175bd8deadSopenharmony_ciNotice 185bd8deadSopenharmony_ci 195bd8deadSopenharmony_ci Copyright (c) 2013 The Khronos Group Inc. Copyright terms at 205bd8deadSopenharmony_ci http://www.khronos.org/registry/speccopyright.html 215bd8deadSopenharmony_ci 225bd8deadSopenharmony_ciSpecification Update Policy 235bd8deadSopenharmony_ci 245bd8deadSopenharmony_ci Khronos-approved extension specifications are updated in response to 255bd8deadSopenharmony_ci issues and bugs prioritized by the Khronos OpenGL Working Group. For 265bd8deadSopenharmony_ci extensions which have been promoted to a core Specification, fixes will 275bd8deadSopenharmony_ci first appear in the latest version of that core Specification, and will 285bd8deadSopenharmony_ci eventually be backported to the extension document. This policy is 295bd8deadSopenharmony_ci described in more detail at 305bd8deadSopenharmony_ci https://www.khronos.org/registry/OpenGL/docs/update_policy.php 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ciStatus 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ci Complete. Approved by the ARB on June 3, 2013. 355bd8deadSopenharmony_ci Ratified by the Khronos Board of Promoters on July 19, 2013. 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ciVersion 385bd8deadSopenharmony_ci 395bd8deadSopenharmony_ci Last Modified Date: 11 November 2020 405bd8deadSopenharmony_ci Revision: 5 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ciNumber 435bd8deadSopenharmony_ci 445bd8deadSopenharmony_ci ARB Extension #154 455bd8deadSopenharmony_ci 465bd8deadSopenharmony_ciDependencies 475bd8deadSopenharmony_ci 485bd8deadSopenharmony_ci OpenGL 4.2 is required. 495bd8deadSopenharmony_ci 505bd8deadSopenharmony_ci This extension is written against Version 4.3 of the Core Profile OpenGL 515bd8deadSopenharmony_ci Specification, dated February 14, 2013 and Version 4.30 of the OpenGL 525bd8deadSopenharmony_ci Shading Language Specification, dated February 7, 2013. 535bd8deadSopenharmony_ci 545bd8deadSopenharmony_ciOverview 555bd8deadSopenharmony_ci 565bd8deadSopenharmony_ci OpenGL 4.3 (with the introduction of the GL_ARB_multi_draw_indirect 575bd8deadSopenharmony_ci extension) enhanced the ability of OpenGL to allow a large sets of 585bd8deadSopenharmony_ci parameters for indirect draws (introduced with OpenGL 4.0) into a buffer 595bd8deadSopenharmony_ci object and dispatch the entire list with one API call. This allows, for 605bd8deadSopenharmony_ci example, a shader (such as a compute shader via shader storage buffers, 615bd8deadSopenharmony_ci or a geometry shader via transform feedback) to produce lists of draw 625bd8deadSopenharmony_ci commands that can then be consumed by OpenGL without a server-client 635bd8deadSopenharmony_ci round trip. However, when a variable and potentially unknown number of 645bd8deadSopenharmony_ci draws are produced by such a shader, it becomes difficult to know how 655bd8deadSopenharmony_ci many draws are in the output array(s). Applications must resort to 665bd8deadSopenharmony_ci techniques such as transform feedback primitive queries, or mapping 675bd8deadSopenharmony_ci buffers containing the content of atomic counters, which can cause stalls 685bd8deadSopenharmony_ci or bubbles in the OpenGL pipeline. 695bd8deadSopenharmony_ci 705bd8deadSopenharmony_ci This extension introduces the concept of the "parameter buffer", which 715bd8deadSopenharmony_ci is a target allowing buffers to store parameters for certain drawing 725bd8deadSopenharmony_ci commands. Also in this extension, new variants of MultiDrawArraysIndirect 735bd8deadSopenharmony_ci and MultiDrawElementsIndirect are introduced that source some of their 745bd8deadSopenharmony_ci parameters from this buffer. Further commands could potentially be 755bd8deadSopenharmony_ci introduced that source other parameters from a buffer. 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ciNew Procedures and Functions 785bd8deadSopenharmony_ci 795bd8deadSopenharmony_ci void MultiDrawArraysIndirectCountARB(enum mode, 805bd8deadSopenharmony_ci const void *indirect, 815bd8deadSopenharmony_ci intptr drawcount, 825bd8deadSopenharmony_ci sizei maxdrawcount, 835bd8deadSopenharmony_ci sizei stride); 845bd8deadSopenharmony_ci 855bd8deadSopenharmony_ci void MultiDrawElementsIndirectCountARB(enum mode, 865bd8deadSopenharmony_ci enum type, 875bd8deadSopenharmony_ci const void *indirect, 885bd8deadSopenharmony_ci intptr drawcount, 895bd8deadSopenharmony_ci sizei maxdrawcount, 905bd8deadSopenharmony_ci sizei stride); 915bd8deadSopenharmony_ci 925bd8deadSopenharmony_ciNew Tokens 935bd8deadSopenharmony_ci 945bd8deadSopenharmony_ci Accepted by the <target> parameters of BindBuffer, BufferData, 955bd8deadSopenharmony_ci BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, 965bd8deadSopenharmony_ci GetBufferPointerv, MapBufferRange, FlushMappedBufferRange, 975bd8deadSopenharmony_ci GetBufferParameteriv, and CopyBufferSubData: 985bd8deadSopenharmony_ci 995bd8deadSopenharmony_ci PARAMETER_BUFFER_ARB 0x80EE 1005bd8deadSopenharmony_ci 1015bd8deadSopenharmony_ci Accepted by the <value> parameter of GetIntegerv, GetBooleanv, GetFloatv, 1025bd8deadSopenharmony_ci and GetDoublev: 1035bd8deadSopenharmony_ci 1045bd8deadSopenharmony_ci PARAMETER_BUFFER_BINDING_ARB 0x80EF 1055bd8deadSopenharmony_ci 1065bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 4.3 (Core Profile) Specification 1075bd8deadSopenharmony_ci(Drawing Commands Using Vertex Arrays) 1085bd8deadSopenharmony_ci 1095bd8deadSopenharmony_ci Modifications to Section 6.1 "Creating and Binding Buffer Objects" 1105bd8deadSopenharmony_ci 1115bd8deadSopenharmony_ci Add to Table 6.1: Buffer object binding targets: 1125bd8deadSopenharmony_ci 1135bd8deadSopenharmony_ci Target name Purpose Described in section(s) 1145bd8deadSopenharmony_ci -------------------- --------------- ------------------------ 1155bd8deadSopenharmony_ci PARAMETER_BUFFER_ARB draw parameters 10.5 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ciAdditions to Chapter 7 of the OpenGL 4.3 (Core Profile) Specification 1185bd8deadSopenharmony_ci(Programs and Shader) 1195bd8deadSopenharmony_ci 1205bd8deadSopenharmony_ci Modifications to Section 7.12.2 "Shader Memory Access Synchronization" 1215bd8deadSopenharmony_ci 1225bd8deadSopenharmony_ci Replace the bullet point describing COMMAND_BARRIER_BIT with 1235bd8deadSopenharmony_ci 1245bd8deadSopenharmony_ci - COMMAND_BARRIER_BIT: Command data sourced from buffer objects by 1255bd8deadSopenharmony_ci Draw*Indirect, MultiDraw*IndirectCount, and DispatchComputeIndirect 1265bd8deadSopenharmony_ci commands after the barrier will reflect data written by shaders 1275bd8deadSopenharmony_ci prior to the barrier. The buffer objects affected by this bit 1285bd8deadSopenharmony_ci are derived from the DRAW_INDIRECT_BUFFER, DISPATCH_INDIRECT_BUFFER, 1295bd8deadSopenharmony_ci and PARAMETER_BUFFER_ARB bindings. 1305bd8deadSopenharmony_ci 1315bd8deadSopenharmony_ciAdditions to Chapter 10 of the OpenGL 4.3 (Core Profile) Specification 1325bd8deadSopenharmony_ci(Drawing Commands Using Vertex Arrays) 1335bd8deadSopenharmony_ci 1345bd8deadSopenharmony_ci Add to Section 10.5, "Drawing Commands Using Vertex Arrays", after the 1355bd8deadSopenharmony_ci introduction of MultiDrawArraysIndirect, p.311: 1365bd8deadSopenharmony_ci 1375bd8deadSopenharmony_ci The command 1385bd8deadSopenharmony_ci 1395bd8deadSopenharmony_ci void MultiDrawArraysIndirectCountARB(enum mode, 1405bd8deadSopenharmony_ci const void *indirect, 1415bd8deadSopenharmony_ci intptr drawcount, 1425bd8deadSopenharmony_ci sizei maxdrawcount, 1435bd8deadSopenharmony_ci sizei stride); 1445bd8deadSopenharmony_ci 1455bd8deadSopenharmony_ci behaves similarly to MultiDrawArraysIndirect, except that <drawcount> 1465bd8deadSopenharmony_ci defines an offset (in bytes) into the buffer object bound to the 1475bd8deadSopenharmony_ci PARAMETER_BUFFER_ARB binding point at which a single <sizei> typed value 1485bd8deadSopenharmony_ci is stored, which contains the draw count. <maxdrawcount> specifies the 1495bd8deadSopenharmony_ci maximum number of draws that are expected to be stored in the buffer. 1505bd8deadSopenharmony_ci If the value stored at <drawcount> into the buffer is greater than 1515bd8deadSopenharmony_ci <maxdrawcount>, an implementation stop processing draws after 1525bd8deadSopenharmony_ci <maxdrawcount> parameter sets. <drawcount> must be a multiple of four. 1535bd8deadSopenharmony_ci 1545bd8deadSopenharmony_ci Add to Section 10.5, "Drawing Commands Using Vertex Arrays", after the 1555bd8deadSopenharmony_ci introduction of MultiDrawElementsIndirect, p.316: 1565bd8deadSopenharmony_ci 1575bd8deadSopenharmony_ci The command 1585bd8deadSopenharmony_ci 1595bd8deadSopenharmony_ci void MultiDrawElementsIndirectCountARB(enum mode, 1605bd8deadSopenharmony_ci enum type, 1615bd8deadSopenharmony_ci const void *indirect, 1625bd8deadSopenharmony_ci intptr drawcount, 1635bd8deadSopenharmony_ci sizei maxdrawcount, 1645bd8deadSopenharmony_ci sizei stride); 1655bd8deadSopenharmony_ci 1665bd8deadSopenharmony_ci behaves similarly to MultiDrawElementsIndirect, except that <drawcount> 1675bd8deadSopenharmony_ci defines an offset (in bytes) into the buffer object bound to the 1685bd8deadSopenharmony_ci PARAMETER_BUFFER_ARB binding point at which a single <sizei> typed value 1695bd8deadSopenharmony_ci is stored, which contains the draw count. <maxdrawcount> specifies the 1705bd8deadSopenharmony_ci maximum number of draws that are expected to be stored in the buffer. 1715bd8deadSopenharmony_ci If the value stored at <drawcount> into the buffer is greater than 1725bd8deadSopenharmony_ci <maxdrawcount>, an implementation stop processing draws after 1735bd8deadSopenharmony_ci <maxdrawcount> parameter sets. <drawcount> must be a multiple of four. 1745bd8deadSopenharmony_ci 1755bd8deadSopenharmony_ciErrors 1765bd8deadSopenharmony_ci 1775bd8deadSopenharmony_ci INVALID_OPERATION is generated by MultiDrawArraysIndirectCountARB or 1785bd8deadSopenharmony_ci MultiDrawElementsIndirectCountARB if no buffer is bound to the 1795bd8deadSopenharmony_ci PARAMETER_BUFFER_ARB binding point. 1805bd8deadSopenharmony_ci 1815bd8deadSopenharmony_ci INVALID_VALUE is generated by MultiDrawArraysIndirectCountARB or 1825bd8deadSopenharmony_ci MultiDrawElementsIndirectCountARB if <drawcount> is not a multiple of 1835bd8deadSopenharmony_ci four. 1845bd8deadSopenharmony_ci 1855bd8deadSopenharmony_ci INVALID_OPERATION is generated by MultiDrawArraysIndirectCountARB or 1865bd8deadSopenharmony_ci MultiDrawElementsIndirectCountARB if reading a <sizei> typed value 1875bd8deadSopenharmony_ci from the buffer bound to the PARAMETER_BUFFER_ARB target at the offset 1885bd8deadSopenharmony_ci specified by <drawcount> would result in an out-of-bounds access. 1895bd8deadSopenharmony_ci 1905bd8deadSopenharmony_ciNew State 1915bd8deadSopenharmony_ci 1925bd8deadSopenharmony_ci Append to Table 23.5, "Vertex Array Data (not in Vertex Array objects)" 1935bd8deadSopenharmony_ci 1945bd8deadSopenharmony_ci +-------------------------------+------+--------------+---------+-----------------------------------+----------+ 1955bd8deadSopenharmony_ci | Get Value | | Get | Initial | | | 1965bd8deadSopenharmony_ci | Value | Type | Command | Value | Description | Sec | 1975bd8deadSopenharmony_ci +-------------------------------+------+--------------+---------+-----------------------------------+--------- + 1985bd8deadSopenharmony_ci | PARAMETER_BUFFER_BINDING_ARB | Z+ | GetIntegerv | 0 | Indirect parameter buffer binding | 13.5 | 1995bd8deadSopenharmony_ci +-------------------------------+------+--------------+---------+-----------------------------------+--------- + 2005bd8deadSopenharmony_ci 2015bd8deadSopenharmony_ciIssues 2025bd8deadSopenharmony_ci 2035bd8deadSopenharmony_ci 1) Is this extension named appropriately? Is it too generic? 2045bd8deadSopenharmony_ci 2055bd8deadSopenharmony_ci DISCUSSION: We'd rather lean towards the generic and be forward-looking. 2065bd8deadSopenharmony_ci It's conceivable we could add further commands that source some or all 2075bd8deadSopenharmony_ci of their parameters from a buffer object in the future. 2085bd8deadSopenharmony_ci 2095bd8deadSopenharmony_ciRevision History 2105bd8deadSopenharmony_ci 2115bd8deadSopenharmony_ci Rev. Date Author Changes 2125bd8deadSopenharmony_ci ---- -------- -------- ----------------------------------------- 2135bd8deadSopenharmony_ci 2145bd8deadSopenharmony_ci 1 05/16/2013 gsellers Initial draft based on multi_draw_indirect2 2155bd8deadSopenharmony_ci 2 05/29/2013 gsellers Rename MultiDrawArraysIndirectCount and 2165bd8deadSopenharmony_ci MultiDrawElementsIndirectCount. 2175bd8deadSopenharmony_ci Add issue (1) 2185bd8deadSopenharmony_ci 3 06/20/2013 pdaniell Modify the <indirect> parameter type to 2195bd8deadSopenharmony_ci const void *. 2205bd8deadSopenharmony_ci 4 10/23/2017 nhaehnle Add COMMAND_BARRIER_BIT language. 2215bd8deadSopenharmony_ci 5 11/11/2020 pdaniell Fix the type of the maxdrawcount parameter 2225bd8deadSopenharmony_ci of MultiDrawArraysIndirectCountARB to be 2235bd8deadSopenharmony_ci sizei making it consistent in the extension. 224