Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Float16Array #3531

Open
bakkot opened this issue Mar 22, 2023 · 3 comments
Open

Using Float16Array #3531

bakkot opened this issue Mar 22, 2023 · 3 comments

Comments

@bakkot
Copy link
Contributor

bakkot commented Mar 22, 2023

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.

@greggman
Copy link
Contributor

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

@mrdoob
Copy link

mrdoob commented Mar 24, 2023

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

@bakkot
Copy link
Contributor Author

bakkot commented May 16, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants