In WebGL-based applications, each draw call represents a request to render a mesh or a part of a mesh. Drawing multiple objects with separate draw calls can quickly become a performance bottleneck, especially when dealing with scenes containing a large number of objects or complex animations. Reducing the number of draw calls is critical for achieving smooth and responsive 3D experiences on the web.
The WEBGL_multi_draw extension is an WebGL extension that allows multiple draw calls to be batched together into a single call. This extension has the potential to significantly reduce the overhead associated with issuing individual draw calls, leading to improved rendering performance.
Yes, it could be interesting to support this extension (even more so when WebGPU supports it), but we’ll have to find a good design to add it to the engine, as we don’t want to add too much javascript code to support it, which would cancel out the benefit of using the new API…
Maybe something like BatchedMesh of three.js, or InstancedMesh with count and offset. Also, a static api like MergeMeshes would help to convert meshes imported from existing assets.
WebGPU mdi proposal is staled for almost a year and a half, no change to that PR since Nov 19, 2024, and no sign in recent meetings that the work group is pushing this forward in recent weeks.
Another thing to highlight is that the main bottleneck of browser-based rendering is bind instead of draw, see here for a profile. the performance gain of WEBGL_multi_draw is mainly from 2 sources, one is batching js-cpp call conversion and webgl validation, the other is it forces the rendering model of bind once, draw many. Bindless is also part of focused plan of the workgroup in recent weeks.