KhronosGroup/WebGL

Using Float16Array

Opened this issue · 3 comments

I'm on TC39, and I'm working on advancing a proposal for Float16Array in JavaScript, which would hold IEEE binary16 floats. As part of that I'm exploring integration with the rest of the web platform, including WebGL.

I don't have very much experience with WebGL, so please correct me if I'm mistaken about anything here, or otherwise missing context.

I see the texImage2D API accepts Uint16Arrays for ext.HALF_FLOAT_OES types. I would hope that could easily be extended to also accept Float16Array. Is that correct, and would the WebGL group be open to such a change? (Ideally, would someone else be willing to make the change, assuming Float16Array gets added?)

Are there any other places that Float16Arrays could be relevant? I'm especially interested in any places which are currently synthesizing and returning new Uint16Arrays to represent float16 values, since those would be confusing in a world where Float16Array exists - I couldn't find any, but as I said I don't have much experience here.

The Float16Array polyfill is used in the WebGPU CTS. WebGPU also supports float16, not just for textures but for compute shaders, so it would be really useful for Float16Array support to work natively in the browser

We would love to have Float16Array: mrdoob/three.js#20587 mrdoob/three.js#25519

bakkot commented

Update: the proposal to add Float16Array to JavaScript today reached stage 3, meaning the design is finished, the committee is in favor, and engines can start implementing and shipping it.

Can anyone confirm that the only work needed for webgl is to update texImage2D so that it can take a Float16Array in addition to a Uint16Array?