[Public WebGL] New multi_draw extensions

Austin Eng ([email protected]) [email protected]
Fri Feb 22 10:21:47 PST 2019


Resending this because the previous email was likely marked as spam.

WebGL community,

Two new extensions are in development which provide better batching for
draw calls:

WEBGL_multi_draw
<https://www.khronos.org/registry/webgl/extensions/WEBGL_multi_draw/>

WEBGL_multi_draw_instanced
<https://www.khronos.org/registry/webgl/extensions/WEBGL_multi_draw_instanced/>

Compared to instancing, which is available as an extension in WebGL 1.0 and
is core in WebGL 2.0, multi_draw provides more flexibility. It essentially
allows the parameters to multiple calls to drawArrays and drawElements to
be assembled in arrays, and sent down to the WebGL implementation with one
call. This eliminates a large amount of overhead when repeatedly calling
from the JavaScript application down into the WebGL implementation.

Per-draw-call data can be sent down in multiple ways, including in uniform
buffers (WebGL 2.0) indexed by a new gl_DrawID variable available in
shaders.

A few examples of how these APIs can be used are in this repository:

https://github.com/kenrussell/webgl-animometer

The potential speedups are dramatic. Microbenchmarks
<https://docs.google.com/presentation/d/1iznxalgXLLSWVNHQ6le9Gzv_TYzsD5R_gg8yT5ckf2A/edit?usp=sharing>
show anywhere from a 2-3x speedup to a 70x (!) speedup in Chrome, compared
to making tiny individual draw calls from JavaScript. Prototypes in other
browsers show ~4x speedups too; the benefits are universal.

Please give these extensions a try. They’re currently available in Chrome
Canary on all platforms by enabling WebGL draft extensions in about:flags,
and are coming to more browsers soon. A BaseVertex variant of the
extensions is also planned.

We would appreciate your feedback on how well the multi_draw extensions
work for your applications, and any suggestions for continued enhancement.

Thanks to Kai Ninomiya from Google for support in developing these
extensions!


- Austin Eng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://khronos.org/pipermail/public_webgl_khronos.org/attachments/20190222/cc72116e/attachment.html>


More information about the public_webgl mailing list