Bug 240919 - Material issues on Mac/iOS with WebGL via Metal
Summary: Material issues on Mac/iOS with WebGL via Metal
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: ANGLE (show other bugs)
Version: Safari 15
Hardware: All iOS 15
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-25 12:39 PDT by Gabby Getz
Modified: 2022-05-31 23:48 PDT (History)
4 users (show)

See Also:


Attachments
Translucency issue - Cesium minimal scene (1.18 KB, application/zip)
2022-05-31 07:49 PDT, Gabby Getz
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabby Getz 2022-05-25 12:39:31 PDT
We've received reports of rendering issues with materials in CesiumJS (https://github.com/CesiumGS/cesium/issues/9827), including translucent and dashed materials, on iOS devices using WebGL via Metal.

These were occurring as of the latest Safari 15.5 release.

Disabling order independent translucent in the engine appears to remedy the issue, so we're working on narrowing the issue down to a specific extension, though we believe it may be related to EXT_color_buffer_float.
Comment 1 Kenneth Russell 2022-05-25 14:56:25 PDT
Unfortunately this doesn't reproduce on M1 hardware, so Apple engineers will have to triage it.

Submitter, please tell us any specific iOS device types that demonstrate the failure.
Comment 2 Kimmo Kinnunen 2022-05-30 04:17:21 PDT
I can repro on iPad Pro 4th gen

https://sandcastle.cesium.com/gallery/Wall.html

observe the blue translucent wall rendered as wire-frame only, no blue.
Comment 3 Kimmo Kinnunen 2022-05-30 05:05:34 PDT
Gabby, if it is simple for you to do and you have the time:
- It'd be of great help debugging this if there was a .zip file with one scene that reproduces this, as simple scene as possible, with all the source files that are needed.
- Additionally I notice that it was worked around with disabling the order independent translucency. It would be great if the example disabled this workaround, so that the example would reproduce the issue.
Comment 4 Kimmo Kinnunen 2022-05-30 05:08:15 PDT
iPad Pro 4th gen is Apple5 A12 iOS GPU Family 5
Comment 5 Gabby Getz 2022-05-31 07:49:31 PDT
Created attachment 459888 [details]
Translucency issue - Cesium minimal scene

Thanks! Attached is a minimal scene with the workaround disabled. It uses a CDN of the unminified CesiumJS library. If you need an example which packages the source code directly, please let me know.
Comment 6 Kyle Piddington 2022-05-31 15:17:28 PDT
Looks like this a lack of support for GL_EXT_float_blend. Commenting this out causes M1 hardware to stop rendering the squares.
Comment 7 Kyle Piddington 2022-05-31 16:40:21 PDT
I think I understand what's going on:

We've added EXT_Color_buffer_float support to the Metal based backend for WebGL. However, Cesium doesn't consider the limitations of EXT_Color_buffer_float when performing rendering.

Specifically, please note the limitations here:
https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_color_buffer_float.txt

By default, EXT_color_buffer_float does not require blending for R32F, RG32F, and RGBA32F textures. You also must check for GL_EXT_float_blend support.
Comment 8 Kyle Piddington 2022-05-31 16:42:12 PDT
Contrast this with the OpenGL backend, which has no support for EXT_Color_buffer_float, so OIT.js line 28 (const extensionsSupported = context.colorBufferFloat && context.depthTexture;) returns false. _translucentMRTSupport, and _translucentMultipassSupport will both be false, so we never create a render pass that requests blending.

I suggest also adding context.floatBlend to the list of extensions required for OIT.
Comment 9 Kimmo Kinnunen 2022-05-31 23:48:57 PDT
Just pasting this for my personal use future use:
- OpenGL ES 3.0 states floating-point textures are not color-renderable (render to floating-point texture)
- EXT_color_buffer_float makes floating-point textures color-renderable
- EXT_color_buffer_float requires blending to be disabled when rendering to floating-point textures.
- EXT_float_blend allows blending to be enabled when rendering to floating-point textures.

In WebGL, EXT_float_blend is automatically enabled when enabling EXT_color_buffer_float, but only if EXT_float_blend is supported in the first place.

https://www.khronos.org/registry/webgl/extensions/EXT_color_buffer_float/
https://www.khronos.org/registry/webgl/extensions/EXT_float_blend/
https://www.khronos.org/registry/webgl/specs/latest/1.0/
https://www.khronos.org/registry/webgl/specs/2.0/
https://www.khronos.org/registry/OpenGL/specs/es/3.0/es_spec_3.0.pdf
https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_float_blend.txt
https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_color_buffer_float.txt

Closing as working as intended.
There's something to be said about Web Inspector being able to identify this, but likely it wouldn't have helped as this was failing on device and people (including me) rarely look for the errors on device...