1Name 2 3 ARB_indirect_parameters 4 5Name Strings 6 7 GL_ARB_indirect_parameters 8 9Contact 10 11 Graham Sellers (graham.sellers 'at' amd.com) 12 13Contributors 14 15 ??? 16 17Notice 18 19 Copyright (c) 2013 The Khronos Group Inc. Copyright terms at 20 http://www.khronos.org/registry/speccopyright.html 21 22Specification Update Policy 23 24 Khronos-approved extension specifications are updated in response to 25 issues and bugs prioritized by the Khronos OpenGL Working Group. For 26 extensions which have been promoted to a core Specification, fixes will 27 first appear in the latest version of that core Specification, and will 28 eventually be backported to the extension document. This policy is 29 described in more detail at 30 https://www.khronos.org/registry/OpenGL/docs/update_policy.php 31 32Status 33 34 Complete. Approved by the ARB on June 3, 2013. 35 Ratified by the Khronos Board of Promoters on July 19, 2013. 36 37Version 38 39 Last Modified Date: 11 November 2020 40 Revision: 5 41 42Number 43 44 ARB Extension #154 45 46Dependencies 47 48 OpenGL 4.2 is required. 49 50 This extension is written against Version 4.3 of the Core Profile OpenGL 51 Specification, dated February 14, 2013 and Version 4.30 of the OpenGL 52 Shading Language Specification, dated February 7, 2013. 53 54Overview 55 56 OpenGL 4.3 (with the introduction of the GL_ARB_multi_draw_indirect 57 extension) enhanced the ability of OpenGL to allow a large sets of 58 parameters for indirect draws (introduced with OpenGL 4.0) into a buffer 59 object and dispatch the entire list with one API call. This allows, for 60 example, a shader (such as a compute shader via shader storage buffers, 61 or a geometry shader via transform feedback) to produce lists of draw 62 commands that can then be consumed by OpenGL without a server-client 63 round trip. However, when a variable and potentially unknown number of 64 draws are produced by such a shader, it becomes difficult to know how 65 many draws are in the output array(s). Applications must resort to 66 techniques such as transform feedback primitive queries, or mapping 67 buffers containing the content of atomic counters, which can cause stalls 68 or bubbles in the OpenGL pipeline. 69 70 This extension introduces the concept of the "parameter buffer", which 71 is a target allowing buffers to store parameters for certain drawing 72 commands. Also in this extension, new variants of MultiDrawArraysIndirect 73 and MultiDrawElementsIndirect are introduced that source some of their 74 parameters from this buffer. Further commands could potentially be 75 introduced that source other parameters from a buffer. 76 77New Procedures and Functions 78 79 void MultiDrawArraysIndirectCountARB(enum mode, 80 const void *indirect, 81 intptr drawcount, 82 sizei maxdrawcount, 83 sizei stride); 84 85 void MultiDrawElementsIndirectCountARB(enum mode, 86 enum type, 87 const void *indirect, 88 intptr drawcount, 89 sizei maxdrawcount, 90 sizei stride); 91 92New Tokens 93 94 Accepted by the <target> parameters of BindBuffer, BufferData, 95 BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, 96 GetBufferPointerv, MapBufferRange, FlushMappedBufferRange, 97 GetBufferParameteriv, and CopyBufferSubData: 98 99 PARAMETER_BUFFER_ARB 0x80EE 100 101 Accepted by the <value> parameter of GetIntegerv, GetBooleanv, GetFloatv, 102 and GetDoublev: 103 104 PARAMETER_BUFFER_BINDING_ARB 0x80EF 105 106Additions to Chapter 6 of the OpenGL 4.3 (Core Profile) Specification 107(Drawing Commands Using Vertex Arrays) 108 109 Modifications to Section 6.1 "Creating and Binding Buffer Objects" 110 111 Add to Table 6.1: Buffer object binding targets: 112 113 Target name Purpose Described in section(s) 114 -------------------- --------------- ------------------------ 115 PARAMETER_BUFFER_ARB draw parameters 10.5 116 117Additions to Chapter 7 of the OpenGL 4.3 (Core Profile) Specification 118(Programs and Shader) 119 120 Modifications to Section 7.12.2 "Shader Memory Access Synchronization" 121 122 Replace the bullet point describing COMMAND_BARRIER_BIT with 123 124 - COMMAND_BARRIER_BIT: Command data sourced from buffer objects by 125 Draw*Indirect, MultiDraw*IndirectCount, and DispatchComputeIndirect 126 commands after the barrier will reflect data written by shaders 127 prior to the barrier. The buffer objects affected by this bit 128 are derived from the DRAW_INDIRECT_BUFFER, DISPATCH_INDIRECT_BUFFER, 129 and PARAMETER_BUFFER_ARB bindings. 130 131Additions to Chapter 10 of the OpenGL 4.3 (Core Profile) Specification 132(Drawing Commands Using Vertex Arrays) 133 134 Add to Section 10.5, "Drawing Commands Using Vertex Arrays", after the 135 introduction of MultiDrawArraysIndirect, p.311: 136 137 The command 138 139 void MultiDrawArraysIndirectCountARB(enum mode, 140 const void *indirect, 141 intptr drawcount, 142 sizei maxdrawcount, 143 sizei stride); 144 145 behaves similarly to MultiDrawArraysIndirect, except that <drawcount> 146 defines an offset (in bytes) into the buffer object bound to the 147 PARAMETER_BUFFER_ARB binding point at which a single <sizei> typed value 148 is stored, which contains the draw count. <maxdrawcount> specifies the 149 maximum number of draws that are expected to be stored in the buffer. 150 If the value stored at <drawcount> into the buffer is greater than 151 <maxdrawcount>, an implementation stop processing draws after 152 <maxdrawcount> parameter sets. <drawcount> must be a multiple of four. 153 154 Add to Section 10.5, "Drawing Commands Using Vertex Arrays", after the 155 introduction of MultiDrawElementsIndirect, p.316: 156 157 The command 158 159 void MultiDrawElementsIndirectCountARB(enum mode, 160 enum type, 161 const void *indirect, 162 intptr drawcount, 163 sizei maxdrawcount, 164 sizei stride); 165 166 behaves similarly to MultiDrawElementsIndirect, except that <drawcount> 167 defines an offset (in bytes) into the buffer object bound to the 168 PARAMETER_BUFFER_ARB binding point at which a single <sizei> typed value 169 is stored, which contains the draw count. <maxdrawcount> specifies the 170 maximum number of draws that are expected to be stored in the buffer. 171 If the value stored at <drawcount> into the buffer is greater than 172 <maxdrawcount>, an implementation stop processing draws after 173 <maxdrawcount> parameter sets. <drawcount> must be a multiple of four. 174 175Errors 176 177 INVALID_OPERATION is generated by MultiDrawArraysIndirectCountARB or 178 MultiDrawElementsIndirectCountARB if no buffer is bound to the 179 PARAMETER_BUFFER_ARB binding point. 180 181 INVALID_VALUE is generated by MultiDrawArraysIndirectCountARB or 182 MultiDrawElementsIndirectCountARB if <drawcount> is not a multiple of 183 four. 184 185 INVALID_OPERATION is generated by MultiDrawArraysIndirectCountARB or 186 MultiDrawElementsIndirectCountARB if reading a <sizei> typed value 187 from the buffer bound to the PARAMETER_BUFFER_ARB target at the offset 188 specified by <drawcount> would result in an out-of-bounds access. 189 190New State 191 192 Append to Table 23.5, "Vertex Array Data (not in Vertex Array objects)" 193 194 +-------------------------------+------+--------------+---------+-----------------------------------+----------+ 195 | Get Value | | Get | Initial | | | 196 | Value | Type | Command | Value | Description | Sec | 197 +-------------------------------+------+--------------+---------+-----------------------------------+--------- + 198 | PARAMETER_BUFFER_BINDING_ARB | Z+ | GetIntegerv | 0 | Indirect parameter buffer binding | 13.5 | 199 +-------------------------------+------+--------------+---------+-----------------------------------+--------- + 200 201Issues 202 203 1) Is this extension named appropriately? Is it too generic? 204 205 DISCUSSION: We'd rather lean towards the generic and be forward-looking. 206 It's conceivable we could add further commands that source some or all 207 of their parameters from a buffer object in the future. 208 209Revision History 210 211 Rev. Date Author Changes 212 ---- -------- -------- ----------------------------------------- 213 214 1 05/16/2013 gsellers Initial draft based on multi_draw_indirect2 215 2 05/29/2013 gsellers Rename MultiDrawArraysIndirectCount and 216 MultiDrawElementsIndirectCount. 217 Add issue (1) 218 3 06/20/2013 pdaniell Modify the <indirect> parameter type to 219 const void *. 220 4 10/23/2017 nhaehnle Add COMMAND_BARRIER_BIT language. 221 5 11/11/2020 pdaniell Fix the type of the maxdrawcount parameter 222 of MultiDrawArraysIndirectCountARB to be 223 sizei making it consistent in the extension. 224