-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Summary
Beginning in CesiumJS 1.140, billboards and labels will require device support for WebGL 2, or WebGL 1 with ANGLE_instanced_arrays and MAX_VERTEX_TEXTURE_IMAGE_UNITS > 0.
UPDATE: Cross-posted to the community forum for input, at: https://community.cesium.com/c/cesiumjs/5
Background
While working on some fixes for billboards, one challenge has been the device-dependent code paths involved. As support for newer WebGL features has been added, fallbacks for legacy WebGL implementations were (very reasonably!) kept around:
- Power-of-two texture atlas size vs. unrestricted atlas size (requires WebGL 2)
- Vertex shader three-point depth test vs. fragment depth test (requires MAX_VERTEX_TEXTURE_IMAGE_UNITS > 0)
- Use of instancing vs. batching (requires ANGLE_instanced_arrays)
Based on https://web3dsurvey.com/webgl, about 99.1% of devices support WebGL 1 to some degree, of which 3.45% have a major performance caveat. For the remaining ~95% of devices, support in CesiumJS is at least a plausible discussion. Note that https://caniuse.com is not a relevant source in this case, because it includes only browser support, where these features require both browser support and device/hardware support.
Of the 99.1% of devices with WebGL 1 support, all but 0.02% support MAX_VERTEX_TEXTURE_IMAGE_UNITS > 0, and all but 0.02% support ANGLE_instanced_arrays. I don't have statistics about how those subsets overlap with each other or with the "major performance caveat" group, but regardless — support for these features is very broadly available.
Changes proposed
The billboard codebase constructs vertex attributes, shaders, and the texture atlas in different ways depending on availability of these features. In addition to testing and maintaining all branches' basic functionality, the branches require separate debugging and improvements in cases like #5154.
Nothing in the billboard implementation would justify the impact of removing WebGL 1 support; that will stay. But I believe ANGLE_instanced_arrays and MAX_VERTEX_TEXTURE_IMAGE_UNITS could very safely become required features. Combined with the changes in #13042 to use power-of-two texture atlases by default (compatible with WebGL 1), all of these branches would be collapsed down to a single device-agnostic code path, which should simplify testing and bug reproductions.
Proposed deprecation notice for 1.137, with affected code to be removed in 1.140:
Feedback
If there are concerns or unforeseen impacts of this change (perhaps certain devices that are important, but not captured in the statistics above?), feedback on this issue would be welcome!