In WebGL2, there are additional versions of most existing functions that accept
ArrayBuffers that allow passing in offset and length inside these buffers. Supposedly, this should make it easier to pass in data from WebAssembly memory without creating temporary views, but there’s a catch: those functions only accept
- What is the reason for such limitation? Why should a function that copies bytes to GPU care about their semantics, i.e. Uint8/Int32/Float32, etc?
- How to get around it, without creating a
DataViewevery time (which would completely defeat the purpose of using those functions in the first place)? Creating DataView once wouldn’t work because WebAssembly memory can re-allocate its buffer, and there is no way to set a callback for memory resize.