KhronosGroup/WebGL

Add non-normative note to multi-draw extensions about types of typed arrays

Opened this issue · 2 comments

On the webgl-dev-list a colleague just pointed out a performance hazard which affects the multi-draw extensions in particular due to the large numbers of typed arrays these APIs take:
https://groups.google.com/g/webgl-dev-list/c/ChKpSHZNbI8/m/p8-YTM0gCQAJ

We should add non-normative notes to the multi-draw extensions highlighting to users to exactly match the type of the typed array when calling the APIs (e.g. Int32Array and Uint32Array), or otherwise expensive conversions will be silently triggered.

In my case it was Uint32Array -> Int32Array conversion that is easily mitigated by JS new Int32Array(uint32Array.buffer)

I didn't realize it would implicitly do such a heavy conversion!
Though, as implementors, it's allowed for us to secretly fastpath these anyways. We should probably formalize this by adding overloads for at least (Int32, Uint32) for all these