When we take a Vec<u8, i32, f32, ...> and upload the data to a WebGL buffer. Does the data go directly from wasm memory to WebGL, or does the API always construct a JS typed array, copy wasm memory into JS typed array, then upload the JS typed array to WebGL buffer ?
That will likely copy. I think you can use bufferSubData to directly copy a slice of the wasm linear memory to a webgl buffer if you pass in the wasm linear memory of the module itself as source buffer.