This extension exposes the EXT_multi_draw_arrays functionality to WebGL.
CAD vendors rendering large models comprised of many individual parts face scalability issues issuing large numbers of draw calls from WebGL. This extension reduces draw call overhead by allowing better batching.
multiDrawArraysEXT
and multiDrawElementsEXT
entry points are added. These provide a counterpoint to instanced rendering and are more flexible for certain scenarios.offset
arguments to multiDrawArraysEXT
and multiDrawElementsEXT
choose the starting offset into their respective typed arrays or sequences. This primarily avoids allocation of temporary typed array views.var ext = gl.getExtension("EXT_multi_draw_arrays"); { // multiDrawArrays variant. let firsts = new Int32Array(...); let counts = new Int32Array(...); ext.multiDrawArraysEXT(gl.TRIANGLES, firsts, 0, counts, 0, firsts.length); } { // multiDrawElements variant. // Assumes that the indices which have been previously uploaded to the // ELEMENT_ARRAY_BUFFER are to be treated as UNSIGNED_SHORT. let counts = new Int32Array(...); let offsets = new Int32Array(...); ext.multiDrawElementsEXT(gl.TRIANGLES, counts, 0, gl.UNSIGNED_SHORT, offsets, 0, counts.length); }