Half Float Textures: Fixed behavior of Float32 and Float16 array type support logic for both WebGL 1 and 2 APIs #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.