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

Half Float Textures: Fixed behavior of Float32 and Float16 array type support logic for both WebGL 1 and 2 APIs #2

Merged

Conversation

keltonhalbert
Copy link
Contributor

This was a bit of a beast to figure out, but I feel mostly confident it works.

The crux of the issue came down to WebGL 1 vs WebGL2 behavior. If in a WebGL1 rendering context, then loading these extensions (I corrected the half-float one) is a reasonable way to check for support, since Safari/WebKit returns null for OES_texture_float_linear on iOS and iPadOS. However, in WebGL2, many of these extensions were baselined into the standard. This means getExtension returns null, and all extension checks are only valid in the case of WebGL 1. Unfortunately, safari lies to the API and says it supports float textures, so the only way I knew how to fix it was to do an OS check. This OS check also works in the case a client has "request desktop website" enabled, so that it gracefully fails as intended.

…d; tested and implemented support checks for iOS and FLoat32 arrays
…d; tested and implemented support checks for iOS and FLoat32 arrays
@keltonhalbert
Copy link
Contributor Author

I'll also add that I have tested this in production for both Float32 and Float16, with WebGL 1 and 2, and on the following systems: Linux Desktop, MacBook, iPhone, iPad

@keltonhalbert keltonhalbert changed the title Half float textures Half Float Textures: Fixed behavior of Float32 and Float16 array type support logic for both WebGL 1 and 2 APIs Nov 4, 2023
src/utils.ts Outdated Show resolved Hide resolved
@tsupinie tsupinie merged commit aec6124 into tsupinie:half-float-textures Nov 4, 2023
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

Successfully merging this pull request may close these issues.

2 participants